本文整理匯總了PHP中PageList::filterByName方法的典型用法代碼示例。如果您正苦於以下問題:PHP PageList::filterByName方法的具體用法?PHP PageList::filterByName怎麽用?PHP PageList::filterByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PageList
的用法示例。
在下文中一共展示了PageList::filterByName方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: view
public function view()
{
session_write_close();
$keywords = $_REQUEST['q'];
$pl = new \PageList();
$pl->filterByName($keywords);
$pl->sortBy('cID', 'asc');
$pl->setItemsPerPage(5);
$pl->setPermissionsChecker(function ($page) {
$pp = new \Permissions($page);
return $pp->canViewPageInSitemap();
});
$pagination = $pl->getPagination();
$pages = $pagination->getCurrentPageResults();
$results = array();
$nh = \Core::make('helper/navigation');
foreach ($pages as $c) {
$obj = new \stdClass();
$obj->href = $nh->getLinkToCollection($c);
$obj->cID = $c->getCollectionID();
$obj->name = $c->getCollectionName();
$results[] = $obj;
}
echo json_encode($results);
\Core::shutdown(array('jobs' => true));
}
示例2: 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;
}
示例3: run
public function run()
{
$pl = new PageList();
$pl->filterByCollectionTypeHandle('walk');
$pl->filterByName('', true);
$pages = $pl->get();
$pagecount = count($pages);
foreach ($pages as $page) {
$page->moveToTrash();
}
return $pagecount . ' ' . t2('page', 'pages', $pagecount) . ' moved to the trash';
}
示例4: show
/**
* Gets a list of all pages of the collection type
* specified by $ctID
*
* @param int $ctID ID of collection type
*/
public function show($ctID)
{
$hh = Loader::helper('html');
$th = Loader::helper('text');
$emptyList = false;
$this->view(false);
Loader::model('page_list');
$pl = new PageList();
$pl->filterByCollectionTypeID($ctID);
if (array_key_exists('cvName', $_REQUEST)) {
$cvName = $th->sanitize($_REQUEST['cvName']);
$this->set('cvName', $cvName);
$pl->filterByName($cvName);
if (count($pl->getPage()) <= 0) {
$pl = new PageList();
$emptyList = true;
}
}
if (!$emptyList) {
$pl->addtoQuery('left join Pages parent ON(p1.cParentID = parent.cID)');
$pl->sortByMultiple('parent.cDisplayOrder asc', 'p1.cDisplayOrder asc');
$pages = $pl->getPage();
} else {
$pages = '';
$this->set('emptyList', t('No entries found'));
}
$ct = CollectionType::getByID($ctID);
// add all necessary header items like JavaScript and CSS files
if (!array_key_exists('cvName', $_REQUEST) || $cvName == '') {
$this->addHeaderItem($hh->css('composer.sort.css', 'remo_composer_list'));
$this->addHeaderItem($hh->javascript('composer.sort.js', 'remo_composer_list'));
}
$this->addHeaderItem($hh->javascript('composer.overview.js', 'remo_composer_list'));
// add variables used by view
$this->set('customColumns', $this->loadCustomColumns($ctID));
$this->set('ctID', $ctID);
$this->set('ctPublishMethod', $ct->getCollectionTypeComposerPublishMethod());
$this->set('pages', $pages);
$this->set('displaySearchBox', $this->displaySearchBox());
$this->set('composerListTitel', $ct->getCollectionTypeName());
$this->set('pagesPagination', $pl->displayPaging(false, true));
}
示例5: 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, '>=');
//.........這裏部分代碼省略.........
示例6: 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;
}
示例7: die
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$valt = Loader::helper('validation/token');
if ($valt->validate('quick_page_select_' . $_REQUEST['key'], $_REQUEST['token'])) {
$u = new User();
Loader::model('page_list');
$db = Loader::db();
$pl = new PageList();
if ($_GET['term'] != '') {
$pl->filterByName($_GET['term']);
}
$pages = $pl->getPage();
$pageNames = array();
foreach ($pages as $c) {
$obj = new stdClass();
$obj->label = $c->getCollectionName();
$obj->value = $c->getCollectionID();
$pageNames[] = $obj;
}
$jh = Loader::helper('json');
echo $jh->encode($pageNames);
}
示例8: die
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$sh = Loader::helper('concrete/dashboard/sitemap');
if (!$sh->canRead()) {
die(t('Access Denied'));
}
session_write_close();
$keywords = $_REQUEST['q'];
Loader::model('page_list');
$pl = new PageList();
$pl->filterByName($keywords);
if (PERMISSIONS_MODEL != 'simple') {
$pl->setViewPagePermissionKeyHandle('view_page_in_sitemap');
}
$pl->ignoreAliases();
$pl->sortBy('cID', 'asc');
$pl->setItemsPerPage(5);
$pages = $pl->getPage();
$results = array();
$nh = Loader::helper('navigation');
foreach ($pages as $c) {
$obj = new stdClass();
$obj->href = $nh->getLinkToCollection($c);
$obj->cID = $c->getCollectionID();
$obj->name = $c->getCollectionName();
$results[] = $obj;
}
print Loader::helper("json")->encode($results);
示例9: 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;
}
示例10: PageList
<?php
$importArray = json_decode(file_get_contents(__DIR__ . '/walkexport.json'), true);
foreach ($importArray as $walk) {
$pl = new PageList();
$pl->filterByCollectionTypeHandle('country');
$pl->filterByName($walk['country']);
$country = $pl->get(1)[0];
if (!$country) {
$country = Page::getByID(1)->add(CollectionType::getByHandle('country'), ['cName' => $walk['country']]);
}
$pl = new PageList();
$pl->filterByCollectionTypeHandle('city');
$pl->filterByName($walk['city']);
$city = $pl->get(1)[0];
if (!$city) {
$city = $country->add(CollectionType::getByHandle('city'), ['cName' => $walk['city']]);
}
$ui = UserInfo::getByEmail($walk['owner']);
if (!$ui) {
$ui = UserInfo::add(['uName' => $walk['owner'], 'uEmail' => $walk['owner']]);
}
$walkPage = $city->add(CollectionType::getByHandle('walk'), ['cName' => $walk['title'], 'uID' => $ui->getUserID()]);
$walkController = Loader::controller($walkPage);
$walkController->setJson(json_encode($walk), true);
}
示例11: PageList
$doc->loadXML($xml);
foreach ($doc->getElementsByTagName('country') as $country) {
$countries = new PageList();
$countries->filterByCollectionTypeHandle('country');
$countries->filterByName($country->getAttribute('name'));
$countryPage = $countries->get(1)[0];
if ($countryPage) {
echo "exists: {$countryPage->getCollectionName()}<br/>";
} else {
echo "creating: {$country->getAttribute('name')}<br/>";
$countryPage = Page::getByID(1)->add(CollectionType::getByHandle('country'), ['cName' => $country->getAttribute('name')]);
}
foreach ($country->getElementsByTagName('city') as $city) {
$cities = new PageList();
$cities->filterByCollectionTypeHandle('city');
$cities->filterByName($city->getAttribute('name'));
$cityPage = $cities->get(1)[0];
if ($cityPage) {
$ui = UserInfo::getByEmail($city->getAttribute('owner_email'));
echo "exists: {$cityPage->getCollectionName()} new owner: " . ($ui ? $ui->getUserID() : "") . "<br/>";
} else {
echo "creating: {$city->getAttribute('name')}<br/>";
$ui = UserInfo::getByEmail($city->getAttribute('owner_email'));
$cityPage = $countryPage->add(CollectionType::getByHandle('city'), ['cName' => $city->getAttribute('name'), 'uID' => $ui ? $ui->getUserID() : 1]);
}
$ui && $cityPage->update(['uID' => $ui->getUserID()]);
}
}
/* foreach($user->childNodes as $attr) {
if($attr->nodeName == 'social_login') {
foreach($attr->childNodes as $social) {