Beispiel #1
0
 function showContent()
 {
     $offset = ($this->page - 1) * PEOPLETAGS_PER_PAGE;
     $limit = PEOPLETAGS_PER_PAGE + 1;
     $ptags = new Profile_list();
     $ptags->tag = $this->tag;
     $user = common_current_user();
     if (empty($user)) {
         $ckey = sprintf('profile_list:tag:%s', $this->tag);
         $ptags->private = false;
         $ptags->orderBy('profile_list.modified DESC');
         $c = Cache::instance();
         if ($offset + $limit <= PEOPLETAG_CACHE_WINDOW && !empty($c)) {
             $cached_ptags = Profile_list::getCached($ckey, $offset, $limit);
             if ($cached_ptags === false) {
                 $ptags->limit(0, PEOPLETAG_CACHE_WINDOW);
                 $ptags->find();
                 Profile_list::setCache($ckey, $ptags, $offset, $limit);
             } else {
                 $ptags = clone $cached_ptags;
             }
         } else {
             $ptags->limit($offset, $limit);
             $ptags->find();
         }
     } else {
         $ptags->whereAdd('(profile_list.private = false OR (' . ' profile_list.tagger =' . $user->id . ' AND profile_list.private = true) )');
         $ptags->orderBy('profile_list.modified DESC');
         $ptags->find();
     }
     $pl = new PeopletagList($ptags, $this);
     $cnt = $pl->show();
     $this->pagination($this->page > 1, $cnt > PEOPLETAGS_PER_PAGE, $this->page, 'peopletag', array('tag' => $this->tag));
 }
Beispiel #2
0
 function getTagSubscriptions($offset = 0, $limit = null, $since_id = 0, $max_id = 0)
 {
     $lists = new Profile_list();
     $subs = new Profile_tag_subscription();
     $lists->joinAdd(array('id', 'profile_tag_subscription:profile_tag_id'));
     #@fixme: postgres (round(date_part('epoch', my_date)))
     $lists->selectAdd('unix_timestamp(profile_tag_subscription.created) as "cursor"');
     $lists->whereAdd('profile_tag_subscription.profile_id = ' . $this->id);
     if ($since_id > 0) {
         $lists->whereAdd('cursor > ' . $since_id);
     }
     if ($max_id > 0) {
         $lists->whereAdd('cursor <= ' . $max_id);
     }
     if ($offset >= 0 && !is_null($limit)) {
         $lists->limit($offset, $limit);
     }
     $lists->orderBy('"cursor" DESC');
     $lists->find();
     return $lists;
 }