本文整理汇总了PHP中PageList::filterByParentID方法的典型用法代码示例。如果您正苦于以下问题:PHP PageList::filterByParentID方法的具体用法?PHP PageList::filterByParentID怎么用?PHP PageList::filterByParentID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageList
的用法示例。
在下文中一共展示了PageList::filterByParentID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view()
{
$this->loadNewsSections();
$newsList = new PageList();
$newsList->sortBy('cDateAdded', 'desc');
if (isset($_GET['cParentID']) && $_GET['cParentID'] > 0) {
$newsList->filterByParentID($_GET['cParentID']);
} else {
$sections = $this->get('sections');
$keys = array_keys($sections);
$keys[] = -1;
$newsList->filterByParentID($keys);
}
$this->set('newsList', $newsList);
$this->set('newsResults', $newsList->getPage());
}
示例2: getPages
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;
}
示例3: getRequestedSearchResults
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;
}
示例4: die
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$pk = PermissionKey::getByHandle('empty_trash');
if (!$pk->validate()) {
die(t("Access Denied."));
}
$trash = Page::getByPath(Config::get('concrete.paths.trash'));
$i = 0;
if (is_object($trash) && !$trash->isError()) {
$pl = new PageList();
$pl->filterByParentID($trash->getCollectionID());
$pl->includeInactivePages();
$pl->setPageVersionToRetrieve(\Concrete\Core\Page\PageList::PAGE_VERSION_RECENT);
$pages = $pl->getResults();
foreach ($pages as $pc) {
$cp = new Permissions($pc);
if ($cp->canDeletePage()) {
++$i;
$pc->delete();
}
}
}
$message = t2('%d page deleted.', '%d pages deleted.', $i, $i);
$obj = new stdClass();
$obj->message = $message;
echo Loader::helper('json')->encode($obj);
示例5: die
<?php
defined('C5_EXECUTE') || die('Access Denied.');
$th = Loader::helper('text');
$av = Loader::helper('concrete/avatar');
$ih = Loader::helper('image');
$doc = new DOMDocument();
$pagesEl = $doc->appendChild($doc->createElement('pages'));
foreach ($pages as $page) {
$pageEl = $pagesEl->appendChild($doc->createElement('page', $page->getCollectionName()));
$cities = new PageList();
$cities->filterByCollectionTypeHandle('city');
$cities->filterByParentID($page->getCollectionID());
foreach ($cities->get(1000) as $city) {
$uid = (int) $city->getCollectionUserID();
// We don't need to see the admin for every city she default-owns
if ($uid === 175 || $uid === 1) {
continue;
}
$page_owner = UserInfo::getByID($uid);
$cityEl = $pageEl->appendChild($doc->createElement('city', $city->getCollectionName()));
$cityEl->setAttribute('href', $nh->getLinkToCollection($city));
$cityEl->setAttribute('placeholder', 'placeholder' . ord($page_owner->getUserID()) % 3);
$avatar = $av->getImagePath($page_owner);
if ($avatar) {
$cityEl->setAttribute('background', $avatar);
}
$cityEl->setAttribute('fullname', trim($page_owner->getAttribute('first_name') . ' ' . $page_owner->getAttribute('last_name')));
$cityEl->setAttribute('email', $page_owner->getUserEmail());
// TODO: See if there's a nice XSLT templates way to shorten this,
// or at least define the icons in the template
示例6: getRequestedSearchResults
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, '>=');
//.........这里部分代码省略.........
示例7: die
defined('C5_EXECUTE') or die(_("Access Denied."));
$pkgHandle = 'easy_news';
Loader::library('controller', $pkgHandle);
//Get info about category
$cat = (int) $_GET['c'];
Loader::model('page_list');
Loader::model("collection_types");
$ct = Collection::getByID($cat);
//$a=$ct->getAttribute('easynews_section');
//if(empty($a)||(!$a)){
// die();
//}
$cvID = CollectionVersion::getNumericalVersionID($ct->getCollectionID(), 'ACTIVE');
$vObj = CollectionVersion::get($ct, $cvID);
$newsList = new PageList();
$newsList->filterByParentID($cat);
$newsList->sortBy('cvDatePublic', 'desc');
$newsPage = $newsList->getPage();
//Start creation
Loader::library('3rdparty/feedcreator/include/feedcreator.class', $pkgHandle);
//define channel
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = SITE . ' - ' . $vObj->cvName;
$rss->description = $vObj->cvName . ' updates';
$rss->link = SITE_URL;
$rss->syndicationURL = EasyNewsController::getRssPagePath() . '?c=' . $cat;
//channel items/entries
foreach ($newsPage as $page) {
$item = new FeedItem();
$item->title = $page->getCollectionName();
示例8: loadOtherCollections
protected function loadOtherCollections()
{
global $c;
$pl = new PageList();
if ($this->orderBy == 'chrono_desc') {
$pl->sortByPublicDateDescending();
} else {
$pl->sortByDisplayOrder();
}
$pl->filterByParentID($c->cParentID);
if ($this->excludeSystemPages) {
$this->excludeSystemPages($pl);
}
$this->otherCollections = $pl->get();
$this->otherCollectionsLoaded = 1;
}
示例9: PageList
<?php
if ($i % 6 == 0) {
?>
<div class="clearfix">
<p> </p>
</div>
<?php
}
?>
<?php
$url = '';
$page = Page::getCurrentPage();
$pageList = new PageList();
$pageList->filterByParentID($page->getCollectionId());
$pageList->filterByAttribute('worldskills_member_id', $member['id']);
$pages = $pageList->get(1);
if (is_array($pages) && isset($pages[0])) {
$url = $nh->getLinkToCollection($pages[0]);
}
?>
<div class="col-sm-2">
<p>
<?php
if ($url) {
?>
<a href="<?php
echo h($url);
?>
示例10: getSubNodes
function getSubNodes($cID, $level = 0, $keywords = '', $autoOpenNodes = true)
{
$db = Loader::db();
$obj = new stdClass();
if (isset($cID) && (Loader::helper('validation/numbers')->integer($cID) || $cID == 0)) {
if ($keywords != '' && $keywords != false) {
$nc = Page::getByID($cID, 'RECENT');
$pl = new PageList();
if (PERMISSIONS_MODEL != 'simple') {
$pl->setViewPagePermissionKeyHandle('view_page_in_sitemap');
}
$obj->keywords = $keywords;
$pl->filterByName($keywords);
$pl->ignoreAliases();
$pl->filterByPath($nc->getCollectionPath());
$pl->displayUnapprovedPages();
$pl->sortByDisplayOrder();
$results = $pl->get(SITEMAP_PAGES_LIMIT);
$total = $pl->getTotal();
} else {
$pl = new PageList();
if (PERMISSIONS_MODEL != 'simple') {
$pl->setViewPagePermissionKeyHandle('view_page_in_sitemap');
}
$pl->sortByDisplayOrder();
if (ConcreteDashboardSitemapHelper::showSystemPages()) {
$pl->includeSystemPages();
$pl->includeInactivePages();
}
$pl->filterByParentID($cID);
$pl->displayUnapprovedPages();
$total = $pl->getTotal();
if ($cID == 1) {
$results = $pl->get();
} else {
$pl->setItemsPerPage(SITEMAP_PAGES_LIMIT);
$results = $pl->getPage();
}
}
$nodes = array();
foreach ($results as $c) {
$n = ConcreteDashboardSitemapHelper::getNode($c, $level + 1, $autoOpenNodes);
if ($n != false) {
$nodes[] = $n;
}
}
$obj->total = $total;
$obj->nodeID = $cID;
$obj->pageList = $pl;
$obj->results = $nodes;
} else {
$obj->total = 0;
$obj->nodeID = 0;
$obj->pageList = null;
$obj->results = null;
}
return $obj;
}
示例11: getPages
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;
}
示例12: view
public function view()
{
parent::view();
$bg = $this->city->fullbg;
if ($bg) {
$this->bodyData['bg'] = $bg->getURL();
}
$this->bodyData['classes'][] = 'city-page';
$this->bodyData['pageViewName'] = 'CityPageView';
$this->set('bodyData', $this->bodyData);
$this->set('pageType', 'city-page');
$this->set('isCityOrganizer', (new User())->getUserID() === $this->city->cityOrganizer->getUserID());
$this->set('isLoggedIn', (bool) Loader::helper('concrete/dashboard')->canRead());
$this->set('isCampaignActive', false);
// Is the donations campaign running?
$this->set('canEdit', is_object(ComposerPage::getByID($this->c->getCollectionID())));
$this->set('city', $this->city);
// Make JSON available
$this->addToJanesWalk(['city' => $this->city]);
// Are there blog entries for this city?
$blog = new PageList();
$blog->filterByCollectionTypeHandle('city_blog');
$blog->filterByParentID($this->c->getCollectionID());
$this->set('blog', $blog->get(1)[0]);
}
示例13: getSubNodes
function getSubNodes($cID, $level = 0, $keywords = '', $autoOpenNodes = true) {
$db = Loader::db();
$obj = new stdClass;
if ($keywords != '' && $keywords != false) {
$nc = Page::getByID($cID, 'RECENT');
$pl = new PageList();
$obj->keywords = $keywords;
$pl->filterByName($keywords);
$pl->filterByPath($nc->getCollectionPath());
$pl->displayUnapprovedPages();
$pl->sortByDisplayOrder();
$results = $pl->get(SITEMAP_PAGES_LIMIT);
$total = $pl->getTotal();
} else {
$pl = new PageList();
$pl->sortByDisplayOrder();
if (ConcreteDashboardSitemapHelper::showSystemPages()) {
$pl->includeSystemPages();
}
$pl->filterByParentID($cID);
$pl->displayUnapprovedPages();
$total = $pl->getTotal();
if ($cID == 1) {
$results = $pl->get();
} else {
$pl->setItemsPerPage(SITEMAP_PAGES_LIMIT);
$results = $pl->getPage();
}
}
$nodes = array();
foreach($results as $c) {
$n = ConcreteDashboardSitemapHelper::getNode($c, $level+1, $autoOpenNodes);
if ($n != false) {
$nodes[] = $n;
}
}
$obj->total = $total;
$obj->nodeID = $cID;
$obj->pageList = $pl;
$obj->results = $nodes;
return $obj;
}
示例14: view
/**
* Call model data needed by view
*
* @param int $userID The user ID of who we're viewing
* @return null
*/
public function view($userID = 0)
{
// Load helpers
Loader::model('page_list');
$nh = Loader::helper('navigation');
$ah = Loader::helper('concrete/avatar');
$th = Loader::helper('text');
$ih = Loader::helper('image');
// Set helpers for view
// Set the page view first
$this->set('bodyData', ['pageViewName' => 'ProfilePageView']);
parent::view($userID);
// Load the current user
$u = new User();
$ui = UserInfo::getByID($u->getUserID());
$profile = $this->get('profile');
// Basic flags identifying the type of user
// Whether or not the logged in user is viewing their own "profile"
$userIsViewingSelf = $u->getUserID() === $profile->getUserID();
// User is a CO
$userIsCityOrganizer = in_array('City Organizers', $profile->getUserObject()->getUserGroups());
/**
* New dashboard variables
*
*/
// Remaining variables/logic only needed for "self viewing"
if ($userIsViewingSelf) {
/**
* Helper
*
*/
$html = Loader::helper('html');
$this->addHeaderItem($html->javascript('swfobject.js'));
/**
* User data
*
*/
// Whether the logged in user has set their first and last name
$this->set('userHasSetName', (bool) trim($ui->getAttribute('first_name') . ' ' . $ui->getAttribute('last_name')));
// The home city for the logged in user (false otherwise)
$userHomeCity = $ui->getAttribute('home_city');
$this->set('userHomeCity', $userHomeCity);
// Whether the logged in user has chosen an avatar/display picture
$this->set('userPicture', $ah->getImagePath($ui));
// Walks owned by user
$pl = new PageList();
$pl->filterByCollectionTypeHandle('walk');
$pl->filterByUserID($u->getUserID());
// Include the names of draft walks, not last published
$pl->displayUnapprovedPages();
$this->set('userWalks', $pl->get());
// Whether the logged in user has created any blog posts
$pl = new PageList();
$pl->filterByCollectionTypeHandle(['walk_blog_entry', 'city_blog_entry']);
$pl->filterByUserID($u->getUserID());
$this->set('userBlogPosts', $pl->get());
/**
* User city data
*
*/
if ($userHomeCity) {
// Set the city
$city = $ui->getAttribute('home_city');
// Load organizer user for this city
$cityOrganizer = UserInfo::getByID($userHomeCity->getCollectionUserID());
if ($cityOrganizer) {
// The email address of the city organizer for the logged in user's
// home city
$cityOrganizerEmailAddress = $cityOrganizer->getUserEmail();
$this->set('cityOrganizerEmailAddress', $cityOrganizerEmailAddress);
}
// Whether the city has a blog page set up for it
$pl = new PageList();
$pl->filterByCollectionTypeHandle('blog');
$pl->filterByParentID($userHomeCity->getCollectionID());
$cityHasBlogSetup = (bool) $pl->getTotal();
$this->set('cityHasBlogSetup', $cityHasBlogSetup);
// List of basic data for three walks we want to highlight to city
// organizers/walk leaders that showcase creative/unique walks
$pl = new PageList();
$pl->filterByCollectionTypeHandle('walk');
$pl->filter(false, 'p1.uID !=' . $u->getUserID());
$pl->filterByAttribute('exclude_page_list', false);
$pl->sortBy('RAND()');
// Load this list of featured walks
$featuredWalkData = array_map(function ($page) use($nh, $ih) {
$_city = Page::getByID($page->getCollectionParentID());
$_country = Page::getByID($_city->getCollectionParentID());
$_thumb = $page->getAttribute('thumbnail');
$countryName = $_country->getCollectionName();
if ($countryName === 'United States') {
$countryName = 'United States of America';
}
$countryName = str_replace(' ', '_', $countryName);
//.........这里部分代码省略.........
示例15: PageList
<?php
}
?>
</div>
<?php
}
?>
<div>
<?php
if ($u->getUserID() == $profile->getUserID()) {
$nc = Page::getByPath('/profile');
$pl = new PageList();
$pl->filterByParentID($nc->getCollectionID());
$pages = $pl->get(0);
if (is_array($pages) && !empty($pages)) {
$nh = Loader::helper('navigation');
?>
<ul class="nav">
<?php
foreach ($pages as $page) {
?>
<li><a href="<?php
echo $nh->getLinkToCollection($page);
?>
"><?php
echo t($page->getCollectionName());
?>
</a></li>