/**
  * Handle request
  *
  * Does the tagging and returns results.
  *
  * @param Array $args unused.
  *
  * @return void
  */
 function handle($args)
 {
     // Throws exception on error
     $ptag = Profile_tag::setTag($this->user->id, $this->tagged->id, $this->peopletag->tag);
     if (!$ptag) {
         $user = User::staticGet('id', $id);
         if ($user) {
             $this->clientError(sprintf(_('There was an unexpected error while listing %s.'), $user->nickname));
         } else {
             // TRANS: Client error displayed when an unknown error occurs when adding a user to a list.
             // TRANS: %s is a profile URL.
             $this->clientError(sprintf(_('There was a problem listing %s. ' . 'The remote server is probably not responding correctly. ' . 'Please try retrying later.'), $this->profile->profileurl));
         }
         return false;
     }
     if ($this->boolean('ajax')) {
         $this->startHTML('text/xml;charset=utf-8');
         $this->elementStart('head');
         // TRANS: Title after adding a user to a list.
         $this->element('title', null, _m('TITLE', 'Listed'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $unsubscribe = new UntagButton($this, $this->tagged, $this->peopletag);
         $unsubscribe->show();
         $this->elementEnd('body');
         $this->elementEnd('html');
     } else {
         $url = common_local_url('subscriptions', array('nickname' => $this->user->nickname));
         common_redirect($url, 303);
     }
 }
Beispiel #2
0
 function showProfileItem($profile)
 {
     $this->elementStart('li', 'entity_removable_profile');
     $item = new TaggedProfileItem($this, $profile);
     $item->show();
     $this->elementStart('span', 'entity_actions');
     if ($profile->isTagged($this->peopletag)) {
         $untag = new UntagButton($this, $profile, $this->peopletag);
         $untag->show();
     } else {
         $tag = new TagButton($this, $profile, $this->peopletag);
         $tag->show();
     }
     $this->elementEnd('span');
     $this->elementEnd('li');
 }
 /**
  * Data elements of the form
  *
  * @return void
  */
 function formData()
 {
     UntagButton::formData();
 }
 function showProfileList()
 {
     $tagged = $this->peopletag->getTagged();
     // TRANS: Header in list edit form.
     $this->out->element('h2', null, _('Add or remove people'));
     $this->out->elementStart('div', 'profile_search_wrap');
     // TRANS: Header in list edit form.
     $this->out->element('h3', null, _m('HEADER', 'Search'));
     $search = new SearchProfileForm($this->out, $this->peopletag);
     $search->show();
     $this->out->element('ul', array('id' => 'profile_search_results', 'class' => 'empty'));
     $this->out->elementEnd('div');
     $this->out->elementStart('ul', 'profile-lister');
     while ($tagged->fetch()) {
         $this->out->elementStart('li', 'entity_removable_profile');
         $this->showProfileItem($tagged);
         $this->out->elementStart('span', 'entity_actions');
         $untag = new UntagButton($this->out, $tagged, $this->peopletag);
         $untag->show();
         $this->out->elementEnd('span');
         $this->out->elementEnd('li');
     }
     $this->out->elementEnd('ul');
 }