3 * StatusNet, the distributed open-source microblogging tool
5 * Superclass for forms that operate on a profile
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.
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.
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/>.
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/
30 if (!defined('STATUSNET')) {
35 * Superclass for forms that operate on a profile
37 * Certain forms (block, silence, userflag, sandbox, delete) work on
38 * a single profile and work almost the same. So, this form extracts
39 * a lot of the common code to simplify those forms.
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/
48 class ProfileActionForm extends Form
51 * Profile of user to act on
65 * @param HTMLOutputter $out output channel
66 * @param Profile $profile profile of user to act on
67 * @param array $args return-to args
70 function __construct($out=null, $profile=null, $args=null)
72 parent::__construct($out);
74 $this->profile = $profile;
81 * @return int ID of the form
86 return $this->target() . '-' . $this->profile->id;
92 * @return string class of the form
97 return 'form_user_'.$this->target();
103 * @return string URL of the action
108 return common_local_url($this->target());
117 function formLegend()
119 $this->out->element('legend', null, $this->description());
123 * Data elements of the form
130 $action = $this->target();
132 $this->out->hidden($action.'to-' . $this->profile->id,
137 foreach ($this->args as $k => $v) {
138 $this->out->hidden('returnto-' . $k, $v);
149 function formActions()
151 $this->out->submit('submit', $this->title(), 'submit',
152 null, $this->description());
156 * Action this form targets
158 * @return string Name of the action, lowercased.
169 * @return string Title of the form, internationalized
178 * Description of the form
180 * @return string description of the form, internationalized
183 function description()