public function get($num = 0, $offset = 0) { $messages = $this->sortThreadedArrays($this->messages); // now we turn the threaded messages array into the flat items array $this->flattenMessages($messages); return parent::get($num, $offset); }
public function view() { $this->ptID = intval($this->request->query->get('ptID')); $this->cParentID = intval($this->request->query->get('cParentID')); $this->lastestversion = isset($_GET['lastestversion']) ? true : false; $list = new PageList(); $list->sortByDisplayOrder(); if ($this->ptID > 0) { $list->filterByPageTypeID(intval($this->ptID)); } if ($this->cParentID != 0) { $list->filterByPath(Page::getByID($this->cParentID)->getCollectionPath()); } $page_result = $list->getResults(); $cv_list = array(); $nh = Core::make('helper/navigation'); foreach ($page_result as $res) { $cp = new Permissions($res); if ($cp->canViewPageVersions()) { $cv = new VersionList($res); if (is_object($cv)) { if ($this->lastestversion == true) { $cvcheck = $cv->getPage(-1); if ($cvcheck[0]->cvIsApproved != 1) { $cv_list[$res->getCollectionID()]['vObj'] = $cv->getPage(-1); $cv_list[$res->getCollectionID()]['cName'] = $res->getCollectionName(); $cv_list[$res->getCollectionID()]['cID'] = $res->getCollectionID(); $cv_list[$res->getCollectionID()]['link'] = $nh->getLinkToCollection($res); } } else { $cv_list[$res->getCollectionID()]['vObj'] = $cv->getPage(-1); $cv_list[$res->getCollectionID()]['cName'] = $res->getCollectionName(); $cv_list[$res->getCollectionID()]['cID'] = $res->getCollectionID(); $cv_list[$res->getCollectionID()]['link'] = $nh->getLinkToCollection($res); } } } } $cvl = new ItemList(); $cvl->setItems($cv_list); $cvl->setItemsPerPage(10); $showPagination = false; if ($cvl->getSummary()->pages > 1) { $showPagination = true; $paginator = $cvl->getPagination(); } $this->set('cParentID', $this->cParentID); $this->set('paginator', $paginator); $this->set('showPagination', $showPagination); $this->set('lastestversion', $this->lastestversion); $this->set('cvlresult', $cvl->getPage()); $this->set('ptID', $this->ptID); $pagetypes = \PageType::getList(); $this->set('pts', $pagetypes); }