3 * StatusNet, the distributed open-source microblogging tool
5 * Form for editing 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 Shashi Gowda <connect2shashi@gmail.com>
25 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
26 * @link http://status.net/
29 if (!defined('STATUSNET') && !defined('LACONICA')) {
33 require_once INSTALLDIR.'/lib/form.php';
36 * Form for editing a peopletag
40 * @author Shashi Gowda <connect2shashi@gmail.com>
41 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
42 * @link http://status.net/
46 class SearchProfileForm extends Form
50 function __construct($out, Profile_list $peopletag)
52 parent::__construct($out);
53 $this->peopletag = $peopletag;
59 * @return string ID of the form
63 return 'form_peopletag-add-' . $this->peopletag->id;
69 * @return string of the form class
73 return 'form_peopletag_edit_user_search';
79 * @return string URL of the action
83 return common_local_url('profilecompletion');
93 // TRANS: Form legend.
94 $this->out->element('legend', null, sprintf(_('Search and list people')));
98 * Data elements of the form
104 // TRANS: Dropdown option for searching in profiles.
105 $fields = array('fulltext' => _('Everything'),
106 // TRANS: Dropdown option for searching in profiles.
107 'nickname' => _('Nickname'),
108 // TRANS: Dropdown option for searching in profiles.
109 'fullname' => _('Fullname'),
110 // TRANS: Dropdown option for searching in profiles.
111 'description' => _('Description'),
112 // TRANS: Dropdown option for searching in profiles.
113 'location' => _('Location'),
114 // TRANS: Dropdown option for searching in profiles.
115 'uri' => _('URI (Remote users)'));
118 $this->out->hidden('peopletag_id', $this->peopletag->id);
119 $this->out->input('q', null);
120 // TRANS: Dropdown field label.
121 $this->out->dropdown('field', _m('LABEL','Search in'), $fields,
122 // TRANS: Dropdown field title.
123 _('Choose a field to search.'), false, 'fulltext');
131 function formActions()
133 // TRANS: Button text to search profiles.
134 $this->out->submit('submit', _m('BUTTON','Search'));
138 class UntagButton extends Form
143 function __construct($out, Profile $profile, Profile_list $peopletag)
145 parent::__construct($out);
146 $this->profile = $profile;
147 $this->peopletag = $peopletag;
153 * @return string ID of the form
157 return 'form_peopletag-' . $this->peopletag->id . '-remove-' . $this->profile->id;
163 * @return string of the form class
167 return 'form_user_remove_peopletag';
173 * @return string URL of the action
178 return common_local_url('removepeopletag');
186 function formLegend()
188 // TRANS: Form legend.
189 // TRANS: %1$s is a nickname, $2$s is a people tag.
190 $this->out->element('legend', null, sprintf(_('Untag %1$s as %2$s'),
191 $this->profile->nickname, $this->peopletag->tag));
195 * Data elements of the form
201 $this->out->hidden('peopletag_id', $this->peopletag->id);
202 $this->out->hidden('tagged', $this->profile->id);
210 function formActions()
212 // TRANS: Button text to untag a profile.
213 $this->out->submit('submit', _m('BUTTON','Remove'));
217 class TagButton extends Form
222 function __construct($out, Profile $profile, Profile_list $peopletag)
224 parent::__construct($out);
225 $this->profile = $profile;
226 $this->peopletag = $peopletag;
232 * @return string ID of the form
236 return 'form_peopletag-' . $this->peopletag->id . '-add-' . $this->profile->id;
242 * @return string of the form class
246 return 'form_user_add_peopletag';
252 * @return string URL of the action
256 return common_local_url('addpeopletag');
264 function formLegend()
266 // TRANS: Legend on form to add a tag to a profile.
267 // TRANS: %1$s is a nickname, %2$s ia a people tag.
268 $this->out->element('legend', null, sprintf(_('Tag %1$s as %2$s'),
269 $this->profile->nickname, $this->peopletag->tag));
273 * Data elements of the form
279 UntagButton::formData();
287 function formActions()
289 // TRANS: Button text to tag a profile.
290 $this->out->submit('submit', _m('BUTTON','Add'));
294 class TaggedProfileItem extends Widget
298 function __construct($out=null, $profile)
300 parent::__construct($out);
301 $this->profile = $profile;
306 $this->out->elementStart('a', array('class' => 'url',
307 'href' => $this->profile->profileurl,
308 'title' => $this->profile->getBestName()));
309 $avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE);
310 $this->out->element('img', array('src' => (($avatar) ? $avatar->displayUrl() :
311 Avatar::defaultImage(AVATAR_MINI_SIZE)),
312 'width' => AVATAR_MINI_SIZE,
313 'height' => AVATAR_MINI_SIZE,
314 'class' => 'avatar photo',
315 'alt' => $this->profile->getBestName()));
316 $this->out->element('span', 'fn nickname', $this->profile->nickname);
317 $this->out->elementEnd('a');