]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/makeadminform.php
Split up some list/form classes, and get the 'approve' and 'cancel' links on group...
[quix0rs-gnu-social.git] / lib / makeadminform.php
1 <?php
2
3 /**
4  * Form for making a user an admin for a group
5  *
6  * @category Form
7  * @package  StatusNet
8  * @author   Evan Prodromou <evan@status.net>
9  * @author   Sarven Capadisli <csarven@status.net>
10  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
11  * @link     http://status.net/
12  */
13 class MakeAdminForm extends Form
14 {
15     /**
16      * Profile of user to block
17      */
18     var $profile = null;
19
20     /**
21      * Group to block the user from
22      */
23     var $group = null;
24
25     /**
26      * Return-to args
27      */
28     var $args = null;
29
30     /**
31      * Constructor
32      *
33      * @param HTMLOutputter $out     output channel
34      * @param Profile       $profile profile of user to block
35      * @param User_group    $group   group to block user from
36      * @param array         $args    return-to args
37      */
38     function __construct($out=null, $profile=null, $group=null, $args=null)
39     {
40         parent::__construct($out);
41
42         $this->profile = $profile;
43         $this->group   = $group;
44         $this->args    = $args;
45     }
46
47     /**
48      * ID of the form
49      *
50      * @return int ID of the form
51      */
52     function id()
53     {
54         // This should be unique for the page.
55         return 'makeadmin-' . $this->profile->id;
56     }
57
58     /**
59      * class of the form
60      *
61      * @return string class of the form
62      */
63     function formClass()
64     {
65         return 'form_make_admin';
66     }
67
68     /**
69      * Action of the form
70      *
71      * @return string URL of the action
72      */
73     function action()
74     {
75         return common_local_url('makeadmin', array('nickname' => $this->group->nickname));
76     }
77
78     /**
79      * Legend of the Form
80      *
81      * @return void
82      */
83     function formLegend()
84     {
85         // TRANS: Form legend for form to make a user a group admin.
86         $this->out->element('legend', null, _('Make user an admin of the group'));
87     }
88
89     /**
90      * Data elements of the form
91      *
92      * @return void
93      */
94     function formData()
95     {
96         $this->out->hidden('profileid-' . $this->profile->id,
97                            $this->profile->id,
98                            'profileid');
99         $this->out->hidden('groupid-' . $this->group->id,
100                            $this->group->id,
101                            'groupid');
102         if ($this->args) {
103             foreach ($this->args as $k => $v) {
104                 $this->out->hidden('returnto-' . $k, $v);
105             }
106         }
107     }
108
109     /**
110      * Action elements
111      *
112      * @return void
113      */
114     function formActions()
115     {
116         $this->out->submit(
117           'submit',
118           // TRANS: Button text for the form that will make a user administrator.
119           _m('BUTTON','Make Admin'),
120           'submit',
121           null,
122           // TRANS: Submit button title.
123           _m('TOOLTIP','Make this user an admin'));
124     }
125 }