public function getChildPages($parent) { $list = new PageList(); $list->filterByExcludeNav(false); $list->sortByDisplayOrder(); $list->filterByParentID($parent->getCollectionID()); $pages = $list->getResults(); return $pages; }
public function view() { $pl = new PageList(); $pl->filterByPageTypeHandle('catalog'); $parentCID = Page::getCurrentPage()->getCollectionID(); $pl->filterByParentID($parentCID); $catalogs = $pl->getResults(); $this->set('catalogs', $catalogs); }
public static function getChildPage($cID, $ctHandle) { $pl = new PageList(); //Filters $pl->filterByParentID($cID); $pl->filterByPageTypeHandle($ctHandle); //Get the page List Results $res = $pl->get(1); return $res[0]; }
public function view() { $pl = new PageList(); $pl->filterByPageTypeHandle('catalog'); $pages = $pl->getResults(); $shop_page = Page::getByPath('/shop'); $shop_page_id = $shop_page->getCollectionID(); $tree = $this->generatePageTree($pages, $shop_page_id); $this->set('catalogMenu', $tree); }
public function view() { $ct = Type::getByDefaultsPage($this->page); $template = Template::getByID($this->page->getPageTemplateID()); $pl = new PageList(); $pl->filterByPageTypeID($ct->getPageTypeID()); $pl->filterByPageTemplate($template); $pl->ignorePermissions(); $this->set('total', $pl->getTotalResults()); }
public function view() { $pl = new PageList(); $pl->filterByPageTypeHandle('product'); $parentCID = Page::getCurrentPage()->getCollectionID(); $pl->filterByParentID($parentCID); // $pl->filterByPath($path, $includeAllChildren = true) $products = $pl->getResults(); $this->set('products', $products); }
public function view() { $pl = new PageList(); $pl->filterByPageTypeHandle('product'); $paginator = $pl->getPagination(); $pagination = $paginator->renderDefaultView(); $this->set('products', $paginator->getCurrentPageResults()); $this->set('pagination', $pagination); $this->set('paginator', $paginator); }
public static function getMyDesktop() { $list = new PageList(); $list->includeSystemPages(); $list->filterByAttribute('is_desktop', true); $list->sortByDesktopPriority('desc'); $results = $list->getResults(); if (is_object($results[0])) { return $results[0]; } }
public function getResults(Request $request) { $pl = new PageList(); $query = $request->query->all(); $keywords = $query['keywords']; $ptID = $query['ptID']; $startingPoint = intval($query['startingPoint']); $datetime = \Core::make('helper/form/date_time')->translate('datetime', $query); $pl->ignorePermissions(); if ($startingPoint) { $parent = \Page::getByID($startingPoint, 'ACTIVE'); $pl->filterByPath($parent->getCollectionPath()); } if ($datetime) { $pl->filterByPublicDate($datetime, '>='); } if ($ptID) { $pl->filterByPageTypeID($ptID); } if ($keywords) { $pl->filterByKeywords($keywords); } $pl->setItemsPerPage(1000); $results = $pl->getResults(); $items = array(); foreach ($results as $c) { $item = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\Page(); $item->setItemId($c->getCollectionID()); $items[] = $item; } return $items; }
/** * Removes any existing pages, files, stacks, block and page types and installs content from the package. * * @param $options */ public function swapContent(Package $package, $options) { if ($this->validateClearSiteContents($options)) { \Core::make('cache/request')->disable(); $pl = new PageList(); $pages = $pl->getResults(); foreach ($pages as $c) { $c->delete(); } $fl = new FileList(); $files = $fl->getResults(); foreach ($files as $f) { $f->delete(); } // clear stacks $sl = new StackList(); foreach ($sl->get() as $c) { $c->delete(); } $home = \Page::getByID(HOME_CID); $blocks = $home->getBlocks(); foreach ($blocks as $b) { $b->deleteBlock(); } $pageTypes = Type::getList(); foreach ($pageTypes as $ct) { $ct->delete(); } // Set the page type of the home page to 0, because // if it has a type the type will be gone since we just // deleted it $home = Page::getByID(HOME_CID); $home->setPageType(null); // now we add in any files that this package has if (is_dir($package->getPackagePath() . '/content_files')) { $ch = new ContentImporter(); $computeThumbnails = true; if ($package->contentProvidesFileThumbnails()) { $computeThumbnails = false; } $ch->importFiles($package->getPackagePath() . '/content_files', $computeThumbnails); } // now we parse the content.xml if it exists. $ci = new ContentImporter(); $ci->importContentFile($package->getPackagePath() . '/content.xml'); \Core::make('cache/request')->enable(); } }
public function deliverQueryObject() { $query = parent::deliverQueryObject(); $u = new User(); if ($u->isLoggedIn()) { $uID = $u->getUserID(); } else { $uID = -1; } if ($uID != -1) { // $query->leftJoin('p', 'UserPageFavorites', 'fav', 'p.cID = fav.cID'); // $query->addSelect('fav.uID IS NOT NULL as favorite'); // $query->leftJoin('p', 'UserPageFavorites', 'fav', 'p.pID = fav.pID and fav.uID = '.(int)$u->getUserID()); $relation = Database::get()->createQueryBuilder(); $relation->select('mpRelationID')->from('MultilingualPageRelations', 'mppr')->leftJoin('mppr', 'UserPageFavorites', 'fav', 'mppr.CID = fav.cID WHERE fav.uID = :uID')->setParameter('uID', (int) $uID); // // -> // andWhere('fav.uID = :uID'); $query->leftJoin('p', 'MultilingualPageRelations', 'mmpr2', 'p.cID = mmpr2.cID'); $query->addSelect('mmpr2.mpRelationID'); // $query->andWhere("mmpr2.mpRelationID in (" . $relation . ")"); $query->addSelect(' mmpr2.mpRelationID in (' . $relation . ') as favorite'); $query->andWhere("mmpr2.mpLocale = :loc"); $query->setParameter('uID', (int) $uID); $query->setParameter('loc', \Localization::activeLocale()); if ($this->onlyFavorites) { // Does this slow the query or what $query->andWhere('mmpr2.mpRelationID in (' . $relation . ')'); } // var_dump(\Localization::activeLocale()); // echo $query->getSql(); } return $query; }
public function view() { $blogify = Loader::helper('blogify'); $settings = $blogify->getBlogSettings(); $this->set('settings', $settings); $this->setupForm(); $blogList = new PageList(); $blogList->sortBy('cDateAdded', 'desc'); if (isset($_GET['cParentID']) && $_GET['cParentID'] > 0) { $blogList->filterByParentID($_GET['cParentID']); } else { $sections = $this->get('sections'); $keys = array_keys($sections); $keys[] = -1; $blogList->filterByParentID($keys); } }
/** * @return bool|PageList */ public function getRequestedSearchResults() { $dh = Loader::helper('concrete/dashboard/sitemap'); if (!$dh->canRead()) { return false; } $pageList = new PageList(); if ($_REQUEST['submit_search']) { $pageList->resetSearchRequest(); } $req = $_REQUEST; $pageList->displayUnapprovedPages(); $pageList->sortBy('cDateModified', 'desc'); $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, true); if ($req['numResults']) { $pageList->setItemsPerPage($req['numResults']); } if ($req['ptID']) { $pageList->filterByPageTypeID($req['ptID']); } 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; }
public function view() { $pl = new PageList(); if ($this->ptID) { $pl->filterByPageTypeID($this->ptID); } if ($this->cParentID) { $pl->filterByParentID($this->cParentID); } $query = $pl->deliverQueryObject(); $query->select('date_format(cv.cvDatePublic, "%Y") as navYear, date_format(cv.cvDatePublic, "%m") as navMonth'); $query->groupBy('navYear, navMonth'); $query->orderBy('navYear', 'desc')->addOrderBy('navMonth', 'desc'); $r = $query->execute(); $dates = []; while ($row = $r->fetch()) { $dates[] = ['year' => $row['navYear'], 'month' => $row['navMonth']]; } $this->set('dates', $dates); }
public function testFilterByPath() { $this->createPage('More Fun', '/test-page-1/foobler'); $this->list->filterByPath('/test-page-1'); $totalResults = $this->list->getTotalResults(); $this->assertEquals(2, $totalResults); $nl = new \Concrete\Core\Page\PageList(); $nl->ignorePermissions(); $nl->filterbyPath('/test-page-1', false); $pagination = $nl->getPagination(); $this->assertEquals(1, $pagination->getNBResults()); }
public function deliverQueryObject() { $query = parent::deliverQueryObject(); $u = new User(); if ($u->getUserID()) { $query->addSelect('fav.uID IS NOT NULL as favorite'); $query->leftJoin('p', 'UserPageFavorites', 'fav', 'p.pID = fav.pID and fav.uID = ' . (int) $u->getUserID()); } if ($this->favorites == true && $u->getUserID()) { $query->andWhere('fav.uID IS NOT NULL'); } return $query; }
public function finalizeQuery(QueryBuilder $query) { $query = parent::finalizeQuery($query); $mslist = Section::getList(); $relation = Database::get()->createQueryBuilder(); $relation->select('mpRelationID')->from('MultilingualPageRelations', 'mppr')->where('cID = p.cID')->setMaxResults(1); $query->addSelect('(' . $relation . ') as mpr'); foreach ($mslist as $ms) { $section = Database::get()->createQueryBuilder(); $section->select('count(mpRelationID)')->from('MultilingualPageRelations', 'mppr')->where('mpRelationID = mpr')->andWhere($section->expr()->comparison('mpLocale', '=', $query->createNamedParameter($ms->getLocale()))); $query->addSelect('(' . $section . ') as relationCount' . $ms->getCollectionID()); } return $query; }
public function finalizeQuery(QueryBuilder $query) { $db = Database::connection(); $query = parent::finalizeQuery($query); $mainRelation = $db->createQueryBuilder(); $mainRelation->select('mpr0.cID')->addSelect('MIN(mpr0.mpRelationID) as mpr')->from('MultilingualPageRelations', 'mpr0')->groupBy('mpr0.cID'); $query->addSelect('mppr.mpr')->leftJoin('p', '(' . $mainRelation . ')', 'mppr', 'p.cID = mppr.cID'); $mslist = Section::getList(); foreach ($mslist as $ms) { $cID = (int) $ms->getCollectionID(); $cLocale = (string) $ms->getLocale(); $query->addSelect("count(mppr{$cID}.mpRelationID) as relationCount{$cID}")->leftJoin('mppr', 'MultilingualPageRelations', "mppr{$cID}", "mppr.mpr = mppr{$cID}.mpRelationID AND " . $db->quote($cLocale) . " = mppr{$cID}.mpLocale"); } $query->addGroupBy(['p.cID', 'mppr.mpr']); return $query; }
public function getCommentsByParentIDs($IDs) { $db = Loader::db(); $child_pages = array(); $blogList = new PageList(); $blogList->sortBy('cDateAdded', 'desc'); //$blogList->filter(false,"(CHAR_LENGTH(cv.cvName) > 4 OR cv.cvName NOT REGEXP '^[0-9]')"); $blogList->filter(false, "ak_is_canonical_page < 1"); if (!$IDs) { $r = $db->EXECUTE("SELECT DISTINCT cnv.cID FROM ConversationMessages cnvm LEFT JOIN Conversations cnv ON cnvm.cnvID = cnv.cnvID ORDER BY cnvMessageDateCreated DESC"); while ($row = $r->fetchrow()) { $IDs[] = $row['cID']; } } if (is_array($IDs)) { foreach ($IDs as $id) { if ($fs) { $fs .= ' OR '; } $path = Page::getByID($id)->getCollectionPath() . '/'; $fs .= "pp.cPath LIKE '{$path}%'"; } $blogList->filter(false, "({$fs})"); } //$blogList->filter(false,"(CHAR_LENGTH(cv.cvName) > 4 OR cv.cvName NOT REGEXP '^[0-9]')"); $blogList->filter(false, "ak_is_canonical_page < 1"); $blogResults = $blogList->get(); foreach ($blogResults as $result) { $child_pages[] = $result->getCollectionID(); } $filter = ''; if ($this->request('comment_todo')) { $this->set('comment_todo', $this->request('comment_todo')); switch ($this->request('comment_todo')) { case 'approves': $filter = "WHERE cnvm.cnvIsMessageApproved = 1"; break; case 'unapproves': $filter = "WHERE cnvm.cnvIsMessageDeleted = 1"; break; } } $r = $db->EXECUTE("SELECT * FROM ConversationMessages cnvm LEFT JOIN Conversations cnv ON cnvm.cnvID = cnv.cnvID {$filter} ORDER BY cnvMessageDateCreated DESC"); $comments = array(); while ($row = $r->fetchrow()) { $ccObj = Page::getByID($row['cID']); $pID = $ccObj->getCollectionID(); //var_dump($pID.' - '.print_r($child_pages)); if (in_array($pID, $child_pages)) { $comments[] = $row; } } return $comments; }
function action_search_by_tag() { $q = $_GET['query']; // i have NO idea why we added this in rev 2000. I think I was being stupid. - andrew // $_q = trim(preg_replace('/[^A-Za-z0-9\s\']/i', ' ', $_REQUEST['query'])); $_q = $q; $ipl = new PageList(); $aksearch = false; if (empty($_GET['query']) && $aksearch == false) { return false; } if (isset($_GET['query'])) { $ak = CollectionAttributeKey::getByHandle('tags'); $akc = $ak->getController(); $isMultiSelect = $akc->getAllowMultipleValues(); $db = Loader::db(); $criteria = array(); $searchQuery = explode(',', $_GET['query']); if (is_array($_REQUEST['search_paths'])) { foreach ($_REQUEST['search_paths'] as $path) { if (!strlen($path)) { continue; } $ipl->filterByPath($path); } } elseif ($this->baseSearchPath != '') { $ipl->filterByPath($this->baseSearchPath); } if (is_array($searchQuery)) { foreach ($searchQuery as $v) { $escapedValue = $v; if ($isMultiSelect) { $criteria[] = "(ak_tags LIKE '%\n{$escapedValue}\n%')"; } else { $criteria[] = "(ak_tags = '\n{$escapedValue}\n')"; } } $where = '(' . implode($this->relation, $criteria) . ')'; $ipl->filter(false, $where); } } $pagination = $ipl->getPagination(); $results = $pagination->getCurrentPageResults(); $resultImage = array(); $linkProduct = array(); $ih = Loader::helper('image'); $counter = 0; $pageName = []; $pageDescription = []; $counter = 0; foreach ($results as $r) { $linkProduct[] = $r->getCollectionLink(); $oPage = Page::getById($r->getCollectionID()); $oThumb = $oPage->getAttribute('thumbnail'); if (isset($oThumb) && $oThumb != false) { $resultImage[] = $ih->getThumbnail($oThumb, 70, 95, false)->src; } else { $resultImage[] = ''; } $pageName[] = $r->getCollectionName(); $pageDescription[] = $r->getCollectionDescription(); $counter++; } $paginationView; if ($pagination->getTotalPages() > 1 && $pagination->haveToPaginate()) { $showPagination = true; $paginationView = $pagination->renderDefaultView(); } $totalPageNumber; if (count($results) != 0) { $totalPageNumber = $pagination->getTotal(); } else { $totalPageNumber = 0; } //print_r($results); $ajaxSearchResult = array('result' => $results, 'pageNames' => $pageName, 'pageDescription' => $pageDescription, 'page_thumb' => $resultImage, 'pagination' => $paginationView, 'product_links' => $linkProduct, 'total_number' => $totalPageNumber); if (isset($_GET['query']) && !empty($_GET['query'])) { echo json_encode($ajaxSearchResult); } else { echo json_encode(''); } die; }
public function getPackageItems(Package $package) { $list = new PageList(); $list->filterByPackage($package); return $list->getResults(); }
public function apply_to_site($pThemeID) { $pk = PermissionKey::getByHandle('customize_themes'); if ($this->validateAction() && $pk->can()) { $vl = $this->getValueListFromRequest($pThemeID); $pt = PageTheme::getByID($pThemeID); $vl->save(); $sccRecord = false; if ($this->request->request->has('sccRecordID')) { $sccRecord = \Concrete\Core\StyleCustomizer\CustomCssRecord::getByID($this->request->request->get('sccRecordID')); } $preset = false; if ($this->request->request->has('handle')) { $preset = $pt->getThemeCustomizablePreset($this->request->request->get('handle')); } // reset all custom styles on particular pages $pl = new PageList(); $pl->filterByPagesWithCustomStyles(); $results = $pl->getResults(); foreach ($results as $csc) { $cscv = $csc->getVersionToModify(); $cscv->resetCustomThemeStyles(); $vo = $csc->getVersionObject(); if ($vo->isApproved()) { $vo = $cscv->getVersionObject(); $vo->approve(); } } // set the global style object. $pt->setCustomStyleObject($vl, $preset, $sccRecord); $r = new PageEditResponse(); $r->setPage($this->page); $r->setRedirectURL(\URL::to($this->page)); $r->outputJSON(); } }
/** * @return \Concrete\Core\Page\PageList */ public function getPageListObject() { $pl = new PageList(); $pl->setItemsPerPage($this->itemsPerFeed); $pl->sortByPublicDateDescending(); if (!$this->checkPagePermissions) { $pl->ignorePermissions(); } else { $vp = \Concrete\Core\Permission\Key\Key::getByHandle('view_page'); $guest = \Group::getByID(GUEST_GROUP_ID); $access = GroupEntity::getOrCreate($guest); // we set page permissions to be Guest group only, because // authentication won't work with RSS feeds $pl->setPermissionsChecker(function ($page) use($vp, $access) { $vp->setPermissionObject($page); $pa = $vp->getPermissionAccessObject($page); if (!is_object($pa)) { return false; } return $pa->validateAccessEntities(array($access)); }); } if ($this->cParentID) { if ($this->pfIncludeAllDescendents) { $parent = \Page::getByID($this->cParentID); if (is_object($parent) && !$parent->isError()) { $pl->filterByPath($parent->getCollectionPath()); } } else { $pl->filterByParentID($this->cParentID); } } if ($this->pfDisplayAliases) { $pl->includeAliases(); } if ($this->ptID) { $pl->filterByPageTypeID($this->ptID); } if ($this->pfDisplayFeaturedOnly) { $pl->filterByAttribute('is_featured', true); } return $pl; }
public function view() { $html = Loader::helper('html'); // $this->addHeaderItem($html->css('css/font-awesome.css','problog')); // $this->addHeaderItem($html->css('css/seo_tools.css','problog')); // $this->addHeaderItem($html->css('app.css')); // $this->addHeaderItem($html->css('redactor.css')); // $this->addHeaderItem($html->css('jquery-ui.css')); // $this->addHeaderItem($html->javascript('jquery.js')); // $this->addHeaderItem('<script type="text/javascript"> var $ = jQuery.noConflict(); </script>'); // $this->addHeaderItem($html->javascript('legacy.js')); // $this->addHeaderItem($html->javascript('jquery-ui.js')); // $this->addHeaderItem($html->javascript('events.js')); //$this->addHeaderItem($html->javascript('app.js')); //$this->addHeaderItem($html->javascript('redactor.js')); // $this->addFooterItem($html->javascript('file-manager.js')); // $this->addFooterItem($html->javascript('seo_tools.js','problog')); $blogify = Loader::helper('blogify'); $settings = $blogify->getBlogSettings(); $blogSectionList = new PageList(); $blogSectionList->filter(false, "ak_blog_section = 1"); $blogSectionList->sortBy('cvName', 'asc'); $tmpSections = $blogSectionList->get(); $sections = array(); foreach ($tmpSections as $_c) { $spk = new AddSubpagePageKey(); $pp = $spk->validate($_c); if ($pp) { $pt = $p; $sections[$_c->getCollectionID()] = $_c->getCollectionName(); } } $ctArray = CollectionType::getList(''); $pageTypes = array(); foreach ($ctArray as $ct) { $spk = new AddSubpagePageKey(); $pp = $spk->validate($ct); if ($pp) { $pageTypes[$ct->getPageTypeID()] = $ct->getPageTypeName(); } } if ($_REQUEST['postID']) { $keys = array_keys($sections); $keys[] = -1; $current_page = Page::getByID($_REQUEST['postID']); $date = $current_page->getCollectionDatePublic(); $canonical_parent_id = $blogify->getCanonicalParent($date, $current_page); $cParentID = $canonical_parent_id; if (in_array($canonical_parent_id, $keys)) { $this->blog = $current_page; } } if (is_object($this->blog)) { $blogTitle = $this->blog->getCollectionName(); $blogDescription = $this->blog->getCollectionDescription(); $blogDate = $this->blog->getCollectionDatePublic(); $ctID = $this->blog->getCollectionTypeID(); $blogBody = ''; $eb = $this->blog->getBlocks('Main'); if (is_object($eb[0])) { $blogBody = $eb[0]->getInstance()->getContent(); } echo "<div class=\"event_warning\"><span class=\"tooltip icon edit\"></span> You are now editing <b><u>{$blogTitle}</u></b></div>"; $task = 'editthis'; $buttonText = t('Update Blog Entry'); $title = 'Update'; } else { $task = 'addthis'; $buttonText = t('Add Blog Entry'); $title = 'Add'; } $this->set('blog', $this->blog); $this->set('blogTitle', $blogTitle); $this->set('blogDescription', $blogDescription); $this->set('blogBody', $blogBody); $this->set('sections', $sections); $this->set('pageTypes', $pageTypes); $this->set('buttonText', $buttonText); }
public function search() { $dh = Loader::helper('concrete/dashboard/sitemap'); if (!$dh->canRead()) { return false; } if ($_REQUEST['submitSearch']) { $this->searchRequest->resetSearchRequest(); } $req = $this->searchRequest->getSearchRequest(); $columns = PageSearchColumnSet::getCurrent(); if (!$this->pageList->getActiveSortColumn()) { $col = $columns->getDefaultSortColumn(); $this->pageList->sanitizedSortBy($col->getColumnKey(), $col->getColumnDefaultSortDirection()); } $cvName = htmlentities($req['cvName'], ENT_QUOTES, APP_CHARSET); $this->pageList->setPageVersionToRetrieve(\Concrete\Core\Page\PageList::PAGE_VERSION_RECENT); if ($cvName != '') { $this->pageList->filterByName($cvName); } if ($req['numResults'] && Loader::helper('validation/numbers')->integer($req['numResults'])) { $this->pageList->setItemsPerPage($req['numResults']); } if ($req['ptID']) { $this->pageList->filterByPageTypeID($req['ptID']); } if (is_array($req['field'])) { foreach ($req['field'] as $i => $item) { $this->fields[] = $this->getField($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); $this->pageList->filterByFulltextKeywords($keywords); break; case 'num_children': $symbol = '='; if ($req['cChildrenSelect'] == 'gt') { $symbol = '>'; } elseif ($req['cChildrenSelect'] == 'lt') { $symbol = '<'; } $this->pageList->filterByNumberOfChildren($req['cChildren'], $symbol); break; case 'owner': $ui = \UserInfo::getByUserName($req['owner']); if (is_object($ui)) { $this->pageList->filterByUserID($ui->getUserID()); } else { $this->pageList->filterByUserID(-1); } break; case 'theme': $this->pageList->filter('pThemeID', $req['pThemeID']); 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(); $this->pageList->filterByPath($cPath); } else { $this->pageList->filterByParentID($req['cParentIDSearchField']); } } break; case 'version_status': if (in_array($req['versionToRetrieve'], array(\Concrete\Core\Page\PageList::PAGE_VERSION_RECENT, \Concrete\Core\Page\PageList::PAGE_VERSION_ACTIVE))) { $this->pageList->setPageVersionToRetrieve($req['versionToRetrieve']); } break; case 'permissions_inheritance': $this->pageList->filter('cInheritPermissionsFrom', $req['cInheritPermissionsFrom']); break; case "date_public": $wdt = Loader::helper('form/date_time'); /* @var $wdt \Concrete\Core\Form\Service\Widget\DateTime */ $dateFrom = $wdt->translate('date_public_from', $req); if ($dateFrom) { $this->pageList->filterByPublicDate($dateFrom, '>='); } $dateTo = $wdt->translate('date_public_to', $req); if ($dateTo != '') { if (preg_match('/^(.+\\d+:\\d+):00$/', $dateTo, $m)) { $dateTo = $m[1] . ':59'; } $this->pageList->filterByPublicDate($dateTo, '<='); } break; case "last_modified": $wdt = Loader::helper('form/date_time'); /* @var $wdt \Concrete\Core\Form\Service\Widget\DateTime */ $dateFrom = $wdt->translate('last_modified_from', $req); if ($dateFrom) { $this->pageList->filterByDateLastModified($dateFrom, '>='); } $dateTo = $wdt->translate('last_modified_to', $req); if ($dateTo) { if (preg_match('/^(.+\\d+:\\d+):00$/', $dateTo, $m)) { $dateTo = $m[1] . ':59'; } $this->pageList->filterByDateLastModified($dateTo, '<='); } break; case "date_added": $wdt = Loader::helper('form/date_time'); /* @var $wdt \Concrete\Core\Form\Service\Widget\DateTime */ $dateFrom = $wdt->translate('date_added_from', $req); if ($dateFrom) { $this->pageList->filterByDateAdded($dateFrom, '>='); } $dateTo = $wdt->translate('date_added_to', $req); if ($dateTo) { if (preg_match('/^(.+\\d+:\\d+):00$/', $dateTo, $m)) { $dateTo = $m[1] . ':59'; } $this->pageList->filterByDateAdded($dateTo, '<='); } break; default: $akID = $item; $fak = CollectionAttributeKey::getByID($akID); if (!is_object($fak) || !$fak instanceof CollectionAttributeKey) { break; } $type = $fak->getAttributeType(); $cnt = $type->getController(); $cnt->setRequestArray($req); $cnt->setAttributeKey($fak); $cnt->searchForm($this->pageList); break; } } } } $ilr = new PageSearchResult($columns, $this->pageList, URL::to('/ccm/system/search/pages/submit'), $this->fields); $this->result = $ilr; }
/** * @param $queryRow * * @return \Stack */ public function getResult($queryRow) { $stack = Stack::getByID($queryRow['cID'], 'ACTIVE'); return $stack ?: parent::getResult($queryRow); }
/** * @return bool|PageList */ public function getRequestedSearchResults() { $dh = $this->app->make('helper/concrete/dashboard/sitemap'); if (!$dh->canRead()) { return false; } $pageList = new PageList(); if ($this->request('submit_search')) { $pageList->resetSearchRequest(); } $pageList->displayUnapprovedPages(); $pageList->sortBy('cDateModified', 'desc'); $cvName = $this->request('cvName'); if ($cvName) { $pageList->filterByName($cvName); } $cParentIDSearchField = $this->request('cParentIDSearchField'); if ($cParentIDSearchField > 0) { if ($this->request('cParentAll') == 1) { $pc = Page::getByID($cParentIDSearchField); if ($pc && !$pc->isError()) { $cPath = $pc->getCollectionPath(); $pageList->filterByPath($cPath); } } else { $pageList->filterByParentID($cParentIDSearchField); } $parentDialogOpen = 1; } $keywords = $this->request('keywords'); $pageList->filterByKeywords($keywords, true); $numResults = $this->request('numResults'); if ($numResults) { $pageList->setItemsPerPage($numResults); } $ptID = $this->request('ptID'); if ($ptID) { $pageList->filterByPageTypeID($ptID); } if ($this->request('noDescription') == 1) { $pageList->filter(false, "csi.ak_meta_description is null or csi.ak_meta_description = ''"); $this->set('descCheck', true); $parentDialogOpen = 1; } else { $parentDialogOpen = null; } $this->set('searchRequest', $_REQUEST); $this->set('parentDialogOpen', $parentDialogOpen); return $pageList; }
public function swapContent($options) { // Custom method to allow us to offer multiple starting points if ($this->validateClearSiteContents($options)) { \Core::make('cache/request')->disable(); $pl = new PageList(); $pages = $pl->getResults(); foreach ($pages as $c) { $c->delete(); } $fl = new FileList(); $files = $fl->getResults(); foreach ($files as $f) { $f->delete(); } // clear stacks $sl = new StackList(); foreach ($sl->get() as $c) { $c->delete(); } $home = Page::getByID(HOME_CID); $blocks = $home->getBlocks(); foreach ($blocks as $b) { $b->deleteBlock(); } $pageTypes = PageType::getList(); foreach ($pageTypes as $ct) { $ct->delete(); } // Overidden functionality to let us install selected starting point.... now we add in any files that this package has if (is_dir($this->getPackagePath() . '/starting_points/' . $this->startingPoint . '/content_files')) { $fh = new FileImporter(); $contents = Core::make('helper/file')->getDirectoryContents($this->getPackagePath() . '/starting_points/' . $this->startingPoint . '/content_files'); foreach ($contents as $filename) { $f = $fh->import($this->getPackagePath() . '/starting_points/' . $this->startingPoint . '/content_files/' . $filename, $filename); } } // Install selected starting point. $ci = new ContentImporter(); $ci->importContentFile($this->getPackagePath() . '/starting_points/' . $this->startingPoint . '/content.xml'); // Set the default preset $pt = PageTheme::getByHandle($this->pkgHandle); if (is_object($pt) && $pt->isThemeCustomizable()) { $presets = $pt->getThemeCustomizableStylePresets(); foreach ($presets as $preset) { if ($preset->getPresetHandle() == $this->startingPoint) { $styles = $pt->getThemeCustomizableStyleList(); $lessFile = $this->getPackagePath() . '/themes/' . $this->pkgHandle . '/css/presets/' . $this->startingPoint . '.less'; $vl = \Concrete\Core\StyleCustomizer\Style\ValueList::loadFromLessFile($lessFile); $vl->save(); $pt->setCustomStyleObject($vl, $preset, false); } } } \Core::make('cache/request')->enable(); } }
/** * @deprecated */ public function get() { return parent::get(); }
protected function loadblogSections() { $blogSectionList = new PageList(); $blogSectionList->setItemsPerPage($this->num); $blogSectionList->filterByBlogSection(1); $blogSectionList->sortBy('cvName', 'asc'); $tmpSections = $blogSectionList->get(); $sections = array(); foreach ($tmpSections as $_c) { $sections[$_c->getCollectionID()] = $_c->getCollectionName(); } $this->sections = $sections; }