]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/YammerImport/lib/yammerauthverifyform.php
bb82eba6ae52f361bbe8237b9c4579a64a495672
[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 form_settings';
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         // TRANS: Form legend.
57         $this->out->element('legend', null, _m('Connect to Yammer'));
58     }
59
60     /**
61      * Data elements of the form
62      *
63      * @return void
64      */
65
66     function formData()
67     {
68         $this->out->hidden('subaction', 'authverify');
69
70         $this->out->elementStart('fieldset');
71
72         $this->out->elementStart('p');
73         // TRANS: Form instructions.
74         $this->out->text(_m('Follow this link to confirm authorization at Yammer; you will be prompted to log in if necessary:'));
75         $this->out->elementEnd('p');
76
77         // iframe would be nice to avoid leaving -- since they don't seem to have callback url O_O
78         /*
79         $this->out->element('iframe', array('id' => 'yammer-oauth',
80                                             'src' => $this->runner->getAuthUrl()));
81         */
82         // yeah, it ignores the callback_url
83         // soo... crappy link. :(
84
85         $this->out->elementStart('p', array('class' => 'magiclink'));
86         $this->out->element('a',
87             array('href' => $this->runner->getAuthUrl(),
88                   'target' => '_blank'),
89             // TRANS: Link description for a link in an external Yammer system.
90             _m('Open Yammer authentication window'));
91         $this->out->elementEnd('p');
92
93         // TRANS: Form instructions.
94         $this->out->element('p', array(), _m('Copy the verification code you are given below:'));
95
96         $this->out->elementStart('ul', array('class' => 'form_data'));
97         $this->out->elementStart('li');
98         // TRANS: Field label.
99         $this->out->input('verify_token', _m('Verification code:'));
100         $this->out->elementEnd('li');
101         $this->out->elementEnd('ul');
102
103         // TRANS: Button text for saving  Yammer authorisation data and starting Yammer import.
104         $this->out->submit('submit', _m('BUTTON','Continue'),
105                            // TRANS: Button title for saving  Yammer authorisation data and starting Yammer import.
106                            'submit', null, _m('Save the verification code and begin import.'));
107         $this->out->elementEnd('fieldset');
108     }
109
110     /**
111      * Action elements
112      *
113      * @return void
114      */
115
116     function formActions()
117     {
118     }
119 }