public function getPageList() { Loader::model('page_list'); $db = Loader::db(); $bID = $this->bID; if ($this->bID) { $q = 'select num, cParentID, cThis, orderBy, ctID, displayAliases, rss from btPageList where bID = \'' . $bID . '\''; $r = $db->query($q); if ($r) { $row = $r->fetchRow(); } } else { $row['num'] = $this->num; $row['cParentID'] = $this->cParentID; $row['cThis'] = $this->cThis; $row['orderBy'] = $this->orderBy; $row['ctID'] = $this->ctID; $row['rss'] = $this->rss; $row['displayAliases'] = $this->displayAliases; } $pl = new PageList(); $pl->setNameSpace('b' . $this->bID); $cArray = array(); switch ($row['orderBy']) { case 'display_asc': $pl->sortByDisplayOrder(); break; case 'display_desc': $pl->sortByDisplayOrderDescending(); break; case 'chrono_asc': $pl->sortByPublicDate(); break; case 'alpha_asc': $pl->sortByName(); break; case 'alpha_desc': $pl->sortByNameDescending(); break; case 'random': $pl->sortBy('RAND()'); break; default: $pl->sortByPublicDateDescending(); break; } $num = (int) $row['num']; $pl->setItemsPerPage($num); $c = Page::getCurrentPage(); if (is_object($c)) { $this->cID = $c->getCollectionID(); } Loader::model('attribute/categories/collection'); if ((int) $this->displayFeaturedOnly === 1) { $cak = CollectionAttributeKey::getByHandle('is_featured'); if (is_object($cak)) { $pl->filterByIsFeatured(1); } } if (!$row['displayAliases']) { $pl->filterByIsAlias(0); } $pl->filter('cvName', '', '!='); if ($row['ctID']) { $pl->filterByCollectionTypeID($row['ctID']); } $columns = $db->MetaColumns(CollectionAttributeKey::getIndexedSearchTable()); if (isset($columns['AK_EXCLUDE_PAGE_LIST'])) { $pl->filter(false, '(ak_exclude_page_list = 0 or ak_exclude_page_list is null)'); } if (intval($row['cParentID']) != 0) { $cParentID = $row['cThis'] ? $this->cID : $row['cParentID']; if ($this->includeAllDescendents) { $pl->filterByPath(Page::getByID($cParentID)->getCollectionPath()); } else { $pl->filterByParentID($cParentID); } } return $pl; }
function getPages($query = null) { Loader::model('page_list'); $db = Loader::db(); $bID = $this->bID; if ($this->bID) { $q = "select num, cParentID, cThis, orderBy, ctID, displayAliases, rss from btEasyNewsList where bID = '{$bID}'"; $r = $db->query($q); if ($r) { $row = $r->fetchRow(); } } else { $row['num'] = $this->num; $row['cParentID'] = $this->cParentID; $row['cThis'] = $this->cThis; $row['orderBy'] = $this->orderBy; $row['ctID'] = $this->ctID; $row['rss'] = $this->rss; } $pl = new PageList(); $pl->setNameSpace('b' . $this->bID); $cArray = array(); switch ($row['orderBy']) { case 'public_desc': $pl->sortBy('cvDatePublic', 'desc'); break; case 'public_asc': $pl->sortBy('cvDatePublic', 'asc'); break; case 'display_asc': $pl->sortByDisplayOrder(); break; case 'display_desc': $pl->sortByDisplayOrderDescending(); break; case 'chrono_asc': $pl->sortByPublicDate(); break; case 'alpha_asc': $pl->sortByName(); break; case 'alpha_desc': $pl->sortByNameDescending(); break; default: $pl->sortByPublicDateDescending(); break; } $num = (int) $row['num']; if ($num > 0) { $pl->setItemsPerPage($num); } $c = Page::getCurrentPage(); if (is_object($c)) { $this->cID = $c->getCollectionID(); } $cParentID = $row['cThis'] ? $this->cID : $row['cParentID']; Loader::model('attribute/categories/collection'); if ($this->displayFeaturedOnly == 1) { $cak = CollectionAttributeKey::getByHandle('is_featured'); if (is_object($cak)) { $pl->filterByIsFeatured(1); } } if (!$row['displayAliases']) { $pl->filterByIsAlias(0); } $pl->filter('cvName', '', '!='); if ($row['ctID']) { $pl->filterByCollectionTypeID($row['ctID']); } $columns = $db->MetaColumns(CollectionAttributeKey::getIndexedSearchTable()); if (isset($columns['AK_EXCLUDE_PAGE_LIST'])) { $pl->filter(false, '(ak_exclude_page_list = 0 or ak_exclude_page_list is null)'); } if (intval($row['cParentID']) != 0) { $pl->filterByParentID($cParentID); } //Publish Date Filter $dt = Loader::helper('date'); $pl->filter('cvDatePublic', $dt->getLocalDateTime(), '<'); if ($num > 0) { $pages = $pl->getPage(); } else { $pages = $pl->get(); } $this->set('pl', $pl); return $pages; }
if (is_object($cak)) { $pl->filterByIsFeatured(1); } } // Display page aliases if (!$row['displayAliases']) { $pl->filterByIsAlias(0); } $pl->filter('cvName', '', '!='); // Presume this removes any unpublished page versions/page versions with no name? // Filter by page type ID if ($row['ctID']) { $pl->filterByCollectionTypeID($row['ctID']); } // Filter by exclude from page list $columns = $db->MetaColumns(CollectionAttributeKey::getIndexedSearchTable()); if (isset($columns['AK_EXCLUDE_PAGE_LIST'])) { $pl->filter(false, '(ak_exclude_page_list = 0 or ak_exclude_page_list is null)'); } // Set parent page if (intval($row['cParentID']) != 0) { $c = Page::getCurrentPage(); $cParentID = $row['cThis'] ? $row['cID'] : $row['cParentID']; if ($row['includeAllDescendents']) { $pl->filterByPath(Page::getByID($cParentID)->getCollectionPath()); } else { $pl->filterByParentID($cParentID); } } // Filter by select attribute if (count($row['filterAttributes']) > 0) {