private function fetchPosts($pageid) { $offset = intval($this->getMain()->getVal('offset', 0)); $page = new Page($pageid); $page->type = Post::STATUS_NORMAL; $page->offset = $offset; $page->fetch(); $comments = $this->convertPosts($page->posts); $obj = array("posts" => $comments, "count" => $page->totalCount); return $obj; }
private function fetchPosts($pageid) { $offset = intval($this->getMain()->getVal('offset', 0)); $page = new Page($pageid); $page->type = Post::STATUS_NORMAL; $page->offset = $offset; $page->fetch(); $comments = array(); foreach ($page->posts as $post) { // No longer need to filter out invisible posts $favorCount = $post->getFavorCount(); $myAtt = $post->getUserAttitude($this->getUser()); $data = array('id' => $post->id->getHex(), 'userid' => $post->userid, 'username' => $post->username, 'text' => $post->text, 'timestamp' => $post->id->getTimestamp(), 'parentid' => $post->parentid ? $post->parentid->getHex() : '', 'like' => $favorCount, 'myatt' => $myAtt); $comments[] = $data; } $obj = array("posts" => $comments, "count" => $page->totalCount); return $obj; }
protected function fetch($row) { return Page::fetch($row, 'Page'); }