]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/UserFlag/flagprofileform.php
insert profile flags more or less correctly
[quix0rs-gnu-social.git] / plugins / UserFlag / flagprofileform.php
1 <?php
2 /**
3  * StatusNet, the distributed open-source microblogging tool
4  *
5  * Form for flagging a profile
6  *
7  * PHP version 5
8  *
9  * LICENCE: This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU Affero General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Affero General Public License for more details.
18  *
19  * You should have received a copy of the GNU Affero General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  * @category  Form
23  * @package   StatusNet
24  * @author    Evan Prodromou <evan@status.net>
25  * @copyright 2009 StatusNet, Inc.
26  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
27  * @link      http://status.net/
28  */
29
30 if (!defined('STATUSNET')) {
31     exit(1);
32 }
33
34 require_once INSTALLDIR.'/lib/form.php';
35
36 /**
37  * Form for flagging a profile
38  *
39  * A form for flagging a profile
40  *
41  * @category Form
42  * @package  StatusNet
43  * @author   Evan Prodromou <evan@status.net>
44  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
45  * @link     http://status.net/
46  */
47
48 class FlagProfileForm extends Form
49 {
50     /**
51      * Profile of profile to flag
52      */
53
54     var $profile = null;
55
56     /**
57      * Return-to args
58      */
59
60     var $args = null;
61
62     /**
63      * Constructor
64      *
65      * @param HTMLOutputter $out     output channel
66      * @param Profile       $profile profile of user to flag
67      * @param array         $args    return-to args
68      */
69
70     function __construct($out=null, $profile=null, $args=null)
71     {
72         parent::__construct($out);
73
74         $this->profile = $profile;
75         $this->args    = $args;
76     }
77
78     /**
79      * ID of the form
80      *
81      * @return int ID of the form
82      */
83
84     function id()
85     {
86         return 'flagprofile-' . $this->profile->id;
87     }
88
89     /**
90      * class of the form
91      *
92      * @return string class of the form
93      */
94
95     function formClass()
96     {
97         return 'form_profile_flag';
98     }
99
100     /**
101      * Action of the form
102      *
103      * @return string URL of the action
104      */
105
106     function action()
107     {
108         return common_local_url('flagprofile');
109     }
110
111     /**
112      * Legend of the Form
113      *
114      * @return void
115      */
116     function formLegend()
117     {
118         $this->out->element('legend', null, _('Flag this profile'));
119     }
120
121     /**
122      * Data elements of the form
123      *
124      * @return void
125      */
126
127     function formData()
128     {
129         // TODO: let the user choose a flag
130
131         $this->out->hidden('flagprofileto-' . $this->profile->id,
132                            $this->profile->id,
133                            'flagprofileto');
134
135         if ($this->args) {
136             foreach ($this->args as $k => $v) {
137                 $this->out->hidden('returnto-' . $k, $v);
138             }
139         }
140     }
141
142     /**
143      * Action elements
144      *
145      * @return void
146      */
147
148     function formActions()
149     {
150         $this->out->submit('submit', _('Flag'), 'submit', null, _('Flag this profile'));
151     }
152 }