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; }
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 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('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 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 view() { $ct = Type::getByDefaultsPage($this->page); $template = Template::getByID($this->page->getPageTemplateID()); $pl = new PageList(); $pl->filterByPageTypeID($ct->getPageTypeID()); $pl->filterByPageTemplate($template); $pl->ignorePermissions(); $pages = $pl->getResults(); $this->set('cList', $pages); }
public function testIndexedSearch() { $c = Page::getByPath('/another-fun-page'); $c->update(array('cDescription' => 'A page of all pages.')); $c->reindex(); $this->list->filterByFulltextKeywords('Page'); $this->list->sortByRelevance(); $results = $this->list->getResults(); $this->assertEquals(5, count($results)); $this->assertEquals(8, $results[0]->getCollectionID()); $this->assertGreaterThan(0, $results[0]->getPageIndexScore()); $this->assertGreaterThan(0, $results[1]->getPageIndexScore()); $this->assertEquals($results[1]->getPageIndexScore(), $results[2]->getPageIndexScore()); }
/** * 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 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(); } }
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(); } }
public function getPackageItems(Package $package) { $list = new PageList(); $list->filterByPackage($package); return $list->getResults(); }
/** Returns a full array of results. */ public function getResults() { return parent::getResults(); }
public function exportPages($xml = null, PageList $pl = null) { if (!$xml) { $this->x = $this->getXMLRoot(); } $node = $this->x->addChild("pages"); if (!$pl) { $pl = new PageList(); } $pl->ignorePermissions(); $pl->getQueryObject()->andWhere("cFilename is null or cFilename = ''"); $pages = $pl->getResults(); foreach ($pages as $pc) { $pc->export($node); } }