3 * StatusNet, the distributed open-source microblogging tool
5 * Form for tagging a profile with a peopletag
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 * @author Sarven Capadisli <csarven@status.net>
26 * @copyright 2009 StatusNet, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://status.net/
31 if (!defined('GNUSOCIAL')) { exit(1); }
34 * Form for tagging a profile with a peopletag
38 * @author Evan Prodromou <evan@status.net>
39 * @author Sarven Capadisli <csarven@status.net>
40 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
41 * @link http://status.net/
45 class TagProfileForm extends Form
47 protected $target = null;
52 * @param Action $action Action we're being embedded into
53 * @param array $options Array of optional parameters
54 * 'user' a user instead of current
55 * 'content' notice content
56 * 'inreplyto' ID of notice to reply to
59 * 'location_id' ID of location
60 * 'location_ns' Namespace of location
62 function __construct(Action $action, Profile $target)
64 parent::__construct($action);
66 $this->target = $target;
72 * @return string ID of the form
77 return 'form_tagprofile_'.$target->id;
83 * @return string class of the form
88 return 'form_tagprofile form_settings';
94 * @return string URL of the action
99 return common_local_url('tagprofile', array('id' => $this->target->id));
107 function formLegend()
109 // TRANS: Form legend for notice form.
110 $this->out->element('legend', null, sprintf(_m('ADDTOLIST', 'List %s'), $this->target->getNickname()));
121 if (Event::handle('StartShowTagProfileFormData', array($this))) {
122 $this->hidden('token', common_session_token());
123 $this->hidden('id', $this->target->id);
125 $this->elementStart('ul', 'form_data');
126 $this->elementStart('li');
128 $tags = Profile_tag::getTagsArray($this->out->getScoped()->id, $this->target->id, $this->out->getScoped()->id);
129 // TRANS: Field label on list form.
130 $this->input('tags', _m('LABEL','Lists'),
131 ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $tags),
132 // TRANS: Field title on list form.
133 _('Lists for this user (letters, numbers, -, ., and _), comma- or space- separated.'));
134 $this->elementEnd('li');
135 $this->elementEnd('ul');
136 Event::handle('EndShowTagProfileFormData', array($this));
140 function formActions()
142 // TRANS: Button text to save lists.
143 $this->out->submit('save', _m('BUTTON', 'Save'));