Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
 public function setUp()
 {
     $this->tables = array_merge($this->tables, array('PermissionAccessList', 'PageTypeComposerFormLayoutSets', 'AttributeSetKeys', 'AttributeSets', 'AttributeKeyCategories', 'PermissionAccessEntityTypes', 'Packages', 'AttributeKeys', 'AttributeTypes', 'PageFeeds'));
     parent::setUp();
     \Concrete\Core\Permission\Access\Entity\Type::add('page_owner', 'Page Owner');
     \Concrete\Core\Permission\Category::add('page');
     \Concrete\Core\Permission\Key\Key::add('page', 'view_page', 'View Page', '', 0, 0);
     PageTemplate::add('left_sidebar', 'Left Sidebar');
     PageTemplate::add('right_sidebar', 'Right Sidebar');
     PageType::add(array('handle' => 'alternate', 'name' => 'Alternate'));
     PageType::add(array('handle' => 'another', 'name' => 'Another'));
     foreach ($this->pageData as $data) {
         $c = call_user_func_array(array($this, 'createPage'), $data);
         $c->reindex();
     }
     $this->list = new \Concrete\Core\Page\PageList();
     $this->list->ignorePermissions();
 }
Ejemplo n.º 3
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();
     $this->set('total', $pl->getTotalResults());
 }
Ejemplo n.º 4
0
 /**
  * @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;
 }
Ejemplo n.º 5
0
 public function ignorePermissions()
 {
     return parent::ignorePermissions();
 }
Ejemplo n.º 6
0
 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);
     }
 }