]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/groupblockform.php
Misses this file to merge. I like the comments.
[quix0rs-gnu-social.git] / lib / groupblockform.php
1 <?php
2 // @todo FIXME: standard file header missing.
3 /**
4  * Form for blocking a user from 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  * @see      BlockForm
14  */
15 class GroupBlockForm extends Form
16 {
17     /**
18      * Profile of user to block
19      */
20
21     var $profile = null;
22
23     /**
24      * Group to block the user from
25      */
26
27     var $group = null;
28
29     /**
30      * Return-to args
31      */
32
33     var $args = null;
34
35     /**
36      * Constructor
37      *
38      * @param HTMLOutputter $out     output channel
39      * @param Profile       $profile profile of user to block
40      * @param User_group    $group   group to block user from
41      * @param array         $args    return-to args
42      */
43     function __construct($out=null, $profile=null, $group=null, $args=null)
44     {
45         parent::__construct($out);
46
47         $this->profile = $profile;
48         $this->group   = $group;
49         $this->args    = $args;
50     }
51
52     /**
53      * ID of the form
54      *
55      * @return int ID of the form
56      */
57     function id()
58     {
59         // This should be unique for the page.
60         return 'block-' . $this->profile->id;
61     }
62
63     /**
64      * class of the form
65      *
66      * @return string class of the form
67      */
68     function formClass()
69     {
70         return 'form_group_block';
71     }
72
73     /**
74      * Action of the form
75      *
76      * @return string URL of the action
77      */
78     function action()
79     {
80         return common_local_url('groupblock');
81     }
82
83     /**
84      * Legend of the Form
85      *
86      * @return void
87      */
88     function formLegend()
89     {
90         // TRANS: Form legend for form to block user from a group.
91         $this->out->element('legend', null, _('Block user from group'));
92     }
93
94     /**
95      * Data elements of the form
96      *
97      * @return void
98      */
99     function formData()
100     {
101         $this->out->hidden('blockto-' . $this->profile->id,
102                            $this->profile->id,
103                            'blockto');
104         $this->out->hidden('blockgroup-' . $this->group->id,
105                            $this->group->id,
106                            'blockgroup');
107         if ($this->args) {
108             foreach ($this->args as $k => $v) {
109                 $this->out->hidden('returnto-' . $k, $v);
110             }
111         }
112     }
113
114     /**
115      * Action elements
116      *
117      * @return void
118      */
119     function formActions()
120     {
121         $this->out->submit(
122             'submit',
123             // TRANS: Button text for the form that will block a user from a group.
124             _m('BUTTON','Block'),
125             'submit',
126             null,
127             // TRANS: Submit button title.
128             _m('TOOLTIP', 'Block this user so that they can no longer post messages to it.'));
129     }
130 }