. * * @category Form * @package StatusNet * @author Evan Prodromou * @author Sarven Capadisli * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ if (!defined('GNUSOCIAL')) { exit(1); } /** * Form for tagging a profile with a peopletag * * @category Form * @package StatusNet * @author Evan Prodromou * @author Sarven Capadisli * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ * * @see HTMLOutputter */ class TagProfileForm extends Form { protected $target = null; /** * Constructor * * @param Action $action Action we're being embedded into * @param array $options Array of optional parameters * 'user' a user instead of current * 'content' notice content * 'inreplyto' ID of notice to reply to * 'lat' Latitude * 'lon' Longitude * 'location_id' ID of location * 'location_ns' Namespace of location */ function __construct(Action $action, Profile $target) { parent::__construct($action); $this->target = $target; } /** * ID of the form * * @return string ID of the form */ function id() { return 'form_tagprofile_'.$target->id; } /** * Class of the form * * @return string class of the form */ function formClass() { return 'form_tagprofile form_settings'; } /** * Action of the form * * @return string URL of the action */ function action() { return common_local_url('tagprofile', array('id' => $this->target->id)); } /** * Legend of the Form * * @return void */ function formLegend() { // TRANS: Form legend for notice form. $this->out->element('legend', null, sprintf(_m('ADDTOLIST', 'List %s'), $this->target->getNickname())); } /** * Data elements * * @return void */ function formData() { if (Event::handle('StartShowTagProfileFormData', array($this))) { $this->hidden('token', common_session_token()); $this->hidden('id', $this->target->id); $this->elementStart('ul', 'form_data'); $this->elementStart('li'); $tags = Profile_tag::getTagsArray($this->out->getScoped()->id, $this->target->id, $this->out->getScoped()->id); // TRANS: Field label on list form. $this->input('tags', _m('LABEL','Lists'), ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $tags), // TRANS: Field title on list form. _('Lists for this user (letters, numbers, -, ., and _), comma- or space- separated.')); $this->elementEnd('li'); $this->elementEnd('ul'); Event::handle('EndShowTagProfileFormData', array($this)); } } function formActions() { // TRANS: Button text to save lists. $this->out->submit('save', _m('BUTTON', 'Save')); } }