]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/YammerImport/lib/yammerauthverifyform.php
Yammer import (work run via background queues) now can be started from the admin...
[quix0rs-gnu-social.git] / plugins / YammerImport / lib / yammerauthverifyform.php
1 <?php
2
3 class YammerAuthVerifyForm extends Form
4 {
5     private $runner;
6
7     function __construct($out, YammerRunner $runner)
8     {
9         parent::__construct($out);
10         $this->runner = $runner;
11     }
12
13     /**
14      * ID of the form
15      *
16      * @return int ID of the form
17      */
18
19     function id()
20     {
21         return 'yammer-auth-verify-form';
22     }
23
24
25     /**
26      * class of the form
27      *
28      * @return string of the form class
29      */
30
31     function formClass()
32     {
33         return 'form_yammer_auth_verify';
34     }
35
36
37     /**
38      * Action of the form
39      *
40      * @return string URL of the action
41      */
42
43     function action()
44     {
45         return common_local_url('yammeradminpanel');
46     }
47
48
49     /**
50      * Legend of the Form
51      *
52      * @return void
53      */
54     function formLegend()
55     {
56         $this->out->element('legend', null, _m('Connect to Yammer'));
57     }
58
59     /**
60      * Data elements of the form
61      *
62      * @return void
63      */
64
65     function formData()
66     {
67         $this->out->elementStart('p');
68         $this->out->text(_m('Follow this link to confirm authorization at Yammer; you will be prompted to log in if necessary:'));
69         $this->out->elementEnd('p');
70
71         $this->out->elementStart('blockquote');
72         $this->out->element('a',
73             array('href' => $this->runner->getAuthUrl(),
74                   'target' => '_blank'),
75             _m('Open Yammer authentication window'));
76         $this->out->elementEnd('blockquote');
77         
78         $this->out->element('p', array(), _m('Copy the verification code you are given into the form below:'));
79
80         $this->out->input('verify_token', _m('Verification code:'));
81         
82         // iframe would be nice to avoid leaving -- since they don't seem to have callback url O_O
83         /*
84         $this->out->element('iframe', array('id' => 'yammer-oauth',
85                                             'src' => $this->runner->getAuthUrl()));
86         */
87         // yeah, it ignores the callback_url
88     }
89
90     /**
91      * Action elements
92      *
93      * @return void
94      */
95
96     function formActions()
97     {
98         $this->out->submit('submit', _m('Verify code'), 'submit', null, _m('Verification code'));
99     }
100 }