コード例 #1
0
 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];
     }
 }
コード例 #2
0
ファイル: Feed.php プロジェクト: ngreimel/kovent
 /**
  * @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;
 }
コード例 #3
0
ファイル: controller.php プロジェクト: katzueno/forums
 function get_forum_categories()
 {
     $pl = new PageList();
     $pl->sortByName();
     $pl->filterByAttribute('forum_category', true);
     return $pl->get();
 }
コード例 #4
0
 /**
  * Filters by a attribute.
  */
 public function filterByAttribute($handle, $value, $comparison = "=")
 {
     return parent::filterByAttribute($handle, $value, $comparison);
 }
コード例 #5
0
ファイル: controller.php プロジェクト: katzueno/forums
 function get_forum_pages()
 {
     $c = Page::getCurrentPage();
     if ($c->getPageTypeHandle() == 'forum_post') {
         $parentCID = $c->getCollectionParentID();
         $forumPages = array(Page::getByID($parentCID));
     } else {
         $parentCID = $c->getCollectionID();
         if ($parentCID < 1 || $parentCID == false) {
             $parentCID = 1;
         }
         $fpl = new PageList();
         $fpl->sortByDisplayOrder();
         $fpl->filterByParentID($parentCID);
         $fpl->filterByAttribute('forum_category', true);
         $forumPages = $fpl->get();
         if (count($forumPages) < 2) {
             if ($c->getAttribute('forum_category')) {
                 $forumPages = array($c);
             }
         }
     }
     return $forumPages;
 }