function getPages($query = null) { Loader::model('page_list'); $db = Loader::db(); $bID = $this->bID; if ($this->bID) { $q = "select * from btDateNav 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(); //$pl->sortByPublicDate(); $pl->sortByPublicDateDescending(); $num = (int) $row['num']; if ($num > 0) { $pl->setItemsPerPage($num); } $c = $this->getCollectionObject(); if (is_object($c)) { $this->cID = $c->getCollectionID(); } $cParentID = $row['cThis'] ? $this->cID : $row['cParentID']; if ($this->displayFeaturedOnly == 1) { Loader::model('attribute/categories/collection'); $cak = CollectionAttributeKey::getByHandle('is_featured'); if (is_object($cak)) { $pl->filterByIsFeatured(1); } } $pl->filter('cvName', '', '!='); if ($row['ctID']) { $pl->filterByCollectionTypeID($row['ctID']); } $pl->filterByAttribute('exclude_nav', false); if ($row['cParentID'] != 0) { $pl->filterByParentID($cParentID); } if ($num > 0) { $pages = $pl->getPage(); } else { $pages = $pl->get(); } $this->set('pl', $pl); return $pages; }
public function getRequestedSearchResults() { $dh = Loader::helper('concrete/dashboard/sitemap'); if (!$dh->canRead()) { return false; } $pageList = new PageList(); $pageList->ignoreAliases(); $pageList->enableStickySearchRequest(); if ($_REQUEST['submit_search']) { $pageList->resetSearchRequest(); } $req = $pageList->getSearchRequest(); $pageList->displayUnapprovedPages(); $pageList->sortBy('cDateModified', 'desc'); $columns = PageSearchColumnSet::getCurrent(); $this->set('columns', $columns); $cvName = htmlentities($req['cvName'], ENT_QUOTES, APP_CHARSET); if ($cvName != '') { $pageList->filterByName($cvName); } if ($req['cParentIDSearchField'] > 0) { if ($req['cParentAll'] == 1) { $pc = Page::getByID($req['cParentIDSearchField']); $cPath = $pc->getCollectionPath(); $pageList->filterByPath($cPath); } else { $pageList->filterByParentID($req['cParentIDSearchField']); } $parentDialogOpen = 1; } $keywords = htmlentities($req['keywords'], ENT_QUOTES, APP_CHARSET); $pageList->filterByKeywords($keywords); if ($req['numResults']) { $pageList->setItemsPerPage($req['numResults']); } if ($req['ctID']) { $pageList->filterByCollectionTypeID($req['ctID']); } if ($_REQUEST['noKeywords'] == 1) { $pageList->filter('CollectionSearchIndexAttributes.ak_meta_keywords', NULL, '='); $this->set('keywordCheck', true); $parentDialogOpen = 1; } if ($_REQUEST['noDescription'] == 1) { $pageList->filter('CollectionSearchIndexAttributes.ak_meta_description', NULL, '='); $this->set('descCheck', true); $parentDialogOpen = 1; } $this->set('searchRequest', $req); $this->set('parentDialogOpen', $parentDialogOpen); return $pageList; }
/** * Gets a list of all pages of the collection type * specified by $ctID * * @param int $ctID ID of collection type */ public function show($ctID) { $hh = Loader::helper('html'); $th = Loader::helper('text'); $emptyList = false; $this->view(false); Loader::model('page_list'); $pl = new PageList(); $pl->filterByCollectionTypeID($ctID); if (array_key_exists('cvName', $_REQUEST)) { $cvName = $th->sanitize($_REQUEST['cvName']); $this->set('cvName', $cvName); $pl->filterByName($cvName); if (count($pl->getPage()) <= 0) { $pl = new PageList(); $emptyList = true; } } if (!$emptyList) { $pl->addtoQuery('left join Pages parent ON(p1.cParentID = parent.cID)'); $pl->sortByMultiple('parent.cDisplayOrder asc', 'p1.cDisplayOrder asc'); $pages = $pl->getPage(); } else { $pages = ''; $this->set('emptyList', t('No entries found')); } $ct = CollectionType::getByID($ctID); // add all necessary header items like JavaScript and CSS files if (!array_key_exists('cvName', $_REQUEST) || $cvName == '') { $this->addHeaderItem($hh->css('composer.sort.css', 'remo_composer_list')); $this->addHeaderItem($hh->javascript('composer.sort.js', 'remo_composer_list')); } $this->addHeaderItem($hh->javascript('composer.overview.js', 'remo_composer_list')); // add variables used by view $this->set('customColumns', $this->loadCustomColumns($ctID)); $this->set('ctID', $ctID); $this->set('ctPublishMethod', $ct->getCollectionTypeComposerPublishMethod()); $this->set('pages', $pages); $this->set('displaySearchBox', $this->displaySearchBox()); $this->set('composerListTitel', $ct->getCollectionTypeName()); $this->set('pagesPagination', $pl->displayPaging(false, true)); }
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; }
public function getPages() { // returns an array of pages of this type. Does not check permissions // since this can get pretty long it actually returns a limited amount of data; $pl = new PageList(); $pl->filterByCollectionTypeID($this->getCollectionTypeID()); $pl->ignorePermissions(); $pl->ignoreAliases(); $pages = $pl->get(); return $pages; }
public function getRequestedSearchResults() { $dh = Loader::helper('concrete/dashboard/sitemap'); if (!$dh->canRead()) { return false; } $pageList = new PageList(); $pageList->ignoreAliases(); $pageList->enableStickySearchRequest(); if ($_REQUEST['submit_search']) { $pageList->resetSearchRequest(); } $req = $pageList->getSearchRequest(); $pageList->displayUnapprovedPages(); $columns = PageSearchColumnSet::getCurrent(); $this->set('columns', $columns); $cvName = h($req['cvName']); if ($cvName != '') { $pageList->filterByName($cvName); } if ($req['numResults'] && Loader::helper('validation/numbers')->integer($req['numResults'])) { $pageList->setItemsPerPage($req['numResults']); } if ($req['ctID']) { $pageList->filterByCollectionTypeID($req['ctID']); } if (is_array($req['selectedSearchField'])) { foreach ($req['selectedSearchField'] as $i => $item) { // due to the way the form is setup, index will always be one more than the arrays if ($item != '') { switch ($item) { case 'keywords': $keywords = htmlentities($req['keywords'], ENT_QUOTES, APP_CHARSET); $pageList->filterByKeywords($keywords); break; case 'num_children': $symbol = '='; if ($req['cChildrenSelect'] == 'gt') { $symbol = '>'; } else { if ($req['cChildrenSelect'] == 'lt') { $symbol = '<'; } } $pageList->filterByNumberOfChildren($req['cChildren'], $symbol); break; case 'owner': $ui = UserInfo::getByUserName($req['owner']); if (is_object($ui)) { $pageList->filterByUserID($ui->getUserID()); } else { $pageList->filterByUserID(-1); } break; case 'theme': $pageList->filter('ptID', $_REQUEST['ptID']); break; case 'parent': if (isset($req['_cParentAll'])) { $req['cParentAll'] = $req['_cParentAll']; } if ($req['cParentIDSearchField'] > 0) { if ($req['cParentAll'] == 1) { $pc = Page::getByID($req['cParentIDSearchField']); $cPath = $pc->getCollectionPath(); $pageList->filterByPath($cPath); } else { $pageList->filterByParentID($req['cParentIDSearchField']); } } break; case 'version_status': if (isset($req['_cvIsApproved'])) { $req['cvIsApproved'] = $req['_cvIsApproved']; } $pageList->filterByIsApproved($req['cvIsApproved']); break; case 'permissions_inheritance': $pageList->filter('cInheritPermissionsFrom', $req['cInheritPermissionsFrom']); break; case "date_public": $dateFrom = $req['date_public_from']; $dateTo = $req['date_public_to']; if ($dateFrom != '') { $dateFrom = date('Y-m-d', strtotime($dateFrom)); $pageList->filterByPublicDate($dateFrom, '>='); $dateFrom .= ' 00:00:00'; } if ($dateTo != '') { $dateTo = date('Y-m-d', strtotime($dateTo)); $dateTo .= ' 23:59:59'; $pageList->filterByPublicDate($dateTo, '<='); } break; case "last_modified": $dateFrom = $req['last_modified_from']; $dateTo = $req['last_modified_to']; if ($dateFrom != '') { $dateFrom = date('Y-m-d', strtotime($dateFrom)); $pageList->filterByDateLastModified($dateFrom, '>='); $dateFrom .= ' 00:00:00'; } if ($dateTo != '') { $dateTo = date('Y-m-d', strtotime($dateTo)); $dateTo .= ' 23:59:59'; $pageList->filterByDateLastModified($dateTo, '<='); } break; case "date_added": $dateFrom = $req['date_added_from']; $dateTo = $req['date_added_to']; if ($dateFrom != '') { $dateFrom = date('Y-m-d', strtotime($dateFrom)); $pageList->filterByDateAdded($dateFrom, '>='); $dateFrom .= ' 00:00:00'; } if ($dateTo != '') { $dateTo = date('Y-m-d', strtotime($dateTo)); $dateTo .= ' 23:59:59'; $pageList->filterByDateAdded($dateTo, '<='); } break; default: Loader::model('attribute/categories/collection'); $akID = $item; $fak = CollectionAttributeKey::get($akID); if (!is_object($fak) || !$fak instanceof CollectionAttributeKey) { break; } $type = $fak->getAttributeType(); $cnt = $type->getController(); $cnt->setRequestArray($req); $cnt->setAttributeKey($fak); $cnt->searchForm($pageList); break; } } } } $this->set('searchRequest', $req); return $pageList; }
die(t('Access Denied')); } $ct = CollectionType::getByID($entry->getCollectionTypeID()); $function = 'ccm_composerSelectParentPage'; if ($_REQUEST['submitOnChoose']) { $function = 'ccm_composerSelectParentPageAndSubmit'; } switch($ct->getCollectionTypeComposerPublishMethod()) { case 'PAGE_TYPE': Loader::model('page_list'); $pages = array(); $pl = new PageList(); $pl->sortByName(); $pl->filterByCollectionTypeID($ct->getCollectionTypeComposerPublishPageTypeID()); $pages = $pl->get(); ?> <h1><?php echo t("Where do you want to publish this page?")?></h1> <ul class="icon-select-list"> <?php foreach($pages as $p) { $trail = $navigation->getTrailToCollection($p); $crumbs = array(); if(is_array($trail) && count($trail)) { $trail = array_reverse($trail,false); foreach($trail as $t) { $crumbs[] = $th->shortText($t->getCollectionName(),10); } }
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; }
if ($row['displayFeaturedOnly'] == 1) { Loader::model('attribute/categories/collection'); $cak = CollectionAttributeKey::getByHandle('is_featured'); 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); }