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/
47 class SearchProfileForm extends Form
51 function __construct($out, Profile_list $peopletag)
53 parent::__construct($out);
54 $this->peopletag = $peopletag;
60 * @return string ID of the form
65 return 'form_peopletag-add-' . $this->peopletag->id;
71 * @return string of the form class
76 return 'form_peopletag_edit_user_search';
82 * @return string URL of the action
87 return common_local_url('profilecompletion');
98 $this->out->element('legend', null, sprintf(_('Search and list people')));
102 * Data elements of the form
109 $fields = array('fulltext' => 'Everything',
110 'nickname' => 'Nickname',
111 'fullname' => 'Fullname',
112 'description' => 'Description',
113 'location' => 'Location',
114 'uri' => 'Uri (Remote users)');
117 $this->out->hidden('peopletag_id', $this->peopletag->id);
118 $this->out->input('q', null);
119 $this->out->dropdown('field', _('Search in'), $fields,
120 _('Choose a field to search'), false, 'fulltext');
129 function formActions()
131 $this->out->submit('submit', _('Search'));
135 class UntagButton extends Form
140 function __construct($out, Profile $profile, Profile_list $peopletag)
142 parent::__construct($out);
143 $this->profile = $profile;
144 $this->peopletag = $peopletag;
150 * @return string ID of the form
155 return 'form_peopletag-' . $this->peopletag->id . '-remove-' . $this->profile->id;
161 * @return string of the form class
166 return 'form_user_remove_peopletag';
172 * @return string URL of the action
177 return common_local_url('removepeopletag');
186 function formLegend()
188 $this->out->element('legend', null, sprintf(_('Untag %s as %s'),
189 $this->profile->nickname, $this->peopletag->tag));
193 * Data elements of the form
200 $this->out->hidden('peopletag_id', $this->peopletag->id);
201 $this->out->hidden('tagged', $this->profile->id);
210 function formActions()
212 $this->out->submit('submit', _('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
237 return 'form_peopletag-' . $this->peopletag->id . '-add-' . $this->profile->id;
243 * @return string of the form class
248 return 'form_user_add_peopletag';
254 * @return string URL of the action
259 return common_local_url('addpeopletag');
268 function formLegend()
270 $this->out->element('legend', null, sprintf(_('Tag %s as %s'),
271 $this->profile->nickname, $this->peopletag->tag));
275 * Data elements of the form
282 UntagButton::formData();
291 function formActions()
293 $this->out->submit('submit', _('Add'));
297 class TaggedProfileItem extends Widget
301 function __construct($out=null, $profile)
303 parent::__construct($out);
304 $this->profile = $profile;
309 $this->out->elementStart('a', array('class' => 'url',
310 'href' => $this->profile->profileurl,
311 'title' => $this->profile->getBestName()));
312 $avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE);
313 $this->out->element('img', array('src' => (($avatar) ? $avatar->displayUrl() :
314 Avatar::defaultImage(AVATAR_MINI_SIZE)),
315 'width' => AVATAR_MINI_SIZE,
316 'height' => AVATAR_MINI_SIZE,
317 'class' => 'avatar photo',
318 'alt' => $this->profile->getBestName()));
319 $this->out->element('span', 'fn nickname', $this->profile->nickname);
320 $this->out->elementEnd('a');