コード例 #1
0
ファイル: tagsubs.php プロジェクト: bashrc/gnusocial-debian
 function showContent()
 {
     if (Event::handle('StartShowTagSubscriptionsContent', array($this))) {
         parent::showContent();
         $offset = ($this->page - 1) * PROFILES_PER_PAGE;
         $limit = PROFILES_PER_PAGE + 1;
         $cnt = 0;
         $tagsub = new TagSub();
         $tagsub->profile_id = $this->getTarget()->getID();
         $tagsub->limit($limit, $offset);
         $tagsub->find();
         if ($tagsub->N) {
             $list = new TagSubscriptionsList($tagsub, $this->getTarget(), $this);
             $cnt = $list->show();
             if (0 == $cnt) {
                 $this->showEmptyListMessage();
             }
         } else {
             $this->showEmptyListMessage();
         }
         $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE, $this->page, 'tagsubs', array('nickname' => $this->getTarget()->getNickname()));
         Event::handle('EndShowTagSubscriptionsContent', array($this));
     }
 }
コード例 #2
0
ファイル: tagunsub.php プロジェクト: bashrc/gnusocial-debian
 /**
  * Handle request
  *
  * Does the subscription and returns results.
  *
  * @param Array $args unused.
  *
  * @return void
  */
 function handle($args)
 {
     // Throws exception on error
     TagSub::cancel($this->user->getProfile(), $this->tag);
     if ($this->boolean('ajax')) {
         $this->startHTML('text/xml;charset=utf-8');
         $this->elementStart('head');
         // TRANS: Page title when tag unsubscription succeeded.
         $this->element('title', null, _m('Unsubscribed'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $subscribe = new TagSubForm($this, $this->tag);
         $subscribe->show();
         $this->elementEnd('body');
         $this->endHTML();
     } else {
         $url = common_local_url('tag', array('tag' => $this->tag));
         common_redirect($url, 303);
     }
 }
コード例 #3
0
ファイル: TagSubPlugin.php プロジェクト: Grasia/bolotweet
 function onEndDefaultLocalNav($menu, $user)
 {
     $user = common_current_user();
     if (!empty($user)) {
         $tags = TagSub::forProfile($user->getProfile());
         if (!empty($tags) && count($tags) > 0) {
             $tagSubMenu = new TagSubMenu($menu->out, $user, $tags);
             // TRANS: Menu item text for tags submenu.
             $menu->submenu(_m('Tags'), $tagSubMenu);
         }
     }
     return true;
 }
コード例 #4
0
ファイル: TagSub.php プロジェクト: bashrc/gnusocial-debian
 static function forProfile(Profile $profile)
 {
     $tags = array();
     $keypart = sprintf('tagsub:by_profile:%d', $profile->id);
     $tagstring = self::cacheGet($keypart);
     if ($tagstring !== false) {
         // cache hit
         if (!empty($tagstring)) {
             $tags = explode(',', $tagstring);
         }
     } else {
         $tagsub = new TagSub();
         $tagsub->profile_id = $profile->id;
         $tagsub->selectAdd();
         $tagsub->selectAdd('tag');
         if ($tagsub->find()) {
             $tags = $tagsub->fetchAll('tag');
         }
         self::cacheSet($keypart, implode(',', $tags));
     }
     return $tags;
 }
コード例 #5
0
ファイル: TagSub.php プロジェクト: harriewang/InnertieWebsite
 static function forProfile(Profile $profile)
 {
     $tags = array();
     $keypart = sprintf('tagsub:by_profile:%d', $profile->id);
     $tagstring = self::cacheGet($keypart);
     if ($tagstring !== false && !empty($tagstring)) {
         $tags = explode(',', $tagstring);
     } else {
         $tagsub = new TagSub();
         $tagsub->profile_id = $profile->id;
         if ($tagsub->find()) {
             while ($tagsub->fetch()) {
                 if (!empty($tagsub->tag)) {
                     $tags[] = $tagsub->tag;
                 }
             }
         }
         self::cacheSet($keypart, implode(',', $tags));
     }
     return $tags;
 }