コード例 #1
0
 /**
  * Gets the latest posts that _this_ member can view
  */
 public function getUnreadPosts($target = '')
 {
     // this little cache bit has absolutely no effect because SS will re-create (And requery) the database
     // on EVERY call to currentMember
     if (!$this->unreadPosts) {
         $filter = array('Created:GreaterThan' => $this->owner->LastPostView);
         if (strlen($target)) {
             $filter['Target'] = $target;
         }
         $this->unreadPosts = $this->microBlogService->globalFeed($filter, $orderBy = 'ID DESC', $since = null, $number = 20, $markViewed = false);
     }
     return $this->unreadPosts;
 }
コード例 #2
0
 public function OwnerFeed()
 {
     $since = $this->request->getVar('since');
     $offset = (int) $this->request->getVar('before');
     $owner = $this->contextUser;
     $data = ArrayList::create();
     if (!$owner || !$owner->exists()) {
         $data = $this->microBlogService->globalFeed();
     } else {
         $replies = (bool) $this->request->getVar('replies');
         $data = $this->microBlogService->getStatusUpdates($owner, null, $since, $offset, !$replies);
     }
     $props = array('Posts' => $data, 'Options' => $this->Options(), 'QueryOffset' => $data->QueryOffset, 'SortBy' => 'ID');
     return trim($this->customise($props)->renderWith('Timeline'));
 }