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