本文整理汇总了PHP中PageList::get方法的典型用法代码示例。如果您正苦于以下问题:PHP PageList::get方法的具体用法?PHP PageList::get怎么用?PHP PageList::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageList
的用法示例。
在下文中一共展示了PageList::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form
public function form()
{
Loader::model('page_list');
$pl = new PageList();
$lastParent = '';
$selected = $_REQUEST['akID'][$this->getAttributeKey()->getAttributeKeyID()]['value'];
if (!$selected && $this->getAttributeValueID() > 0) {
$selected = $this->getValue()->cID;
}
$selectString = "<select id='{$this->field('value')}' name='{$this->field('value')}' ><option value=''>--</option>";
$pl->filterByCollectionTypeHandle('city');
$pages = $pl->get();
uasort($pages, function ($a, $b) {
$ap = $a->getCollectionParentID();
$bp = $b->getCollectionParentID();
return $ap === $bp ? 0 : strcmp(Page::getByID($ap)->getCollectionName(), Page::getByID($bp)->getCollectionName());
});
foreach ($pages as $page) {
$parent = Page::getByID($page->getCollectionParentID())->getCollectionName();
if ($lastParent != $parent) {
if ($lastParent !== '') {
$selectString .= '</optgroup>';
}
$selectString .= "<optgroup label='{$parent}'>";
$lastParent = $parent;
}
$selectedAttributeVal = '';
if ($selected === $page->cID) {
$selectedAttributeVal = ' selected="selected"';
}
$selectString .= "<option value=\"{$page->getCollectionID()}\"" . $selectedAttributeVal . ">{$page->getCollectionName()}</option>";
}
$selectString .= '</select>';
echo $selectString;
}
示例2: run
public function run()
{
$js = Loader::helper('json');
$pl = new PageList();
$pl->filterByCollectionTypeHandle('city');
$pages = $pl->get();
$updated = 0;
$not = 0;
echo "Loading city coordinates.. \n";
foreach ($pages as $page) {
if (!trim($page->getAttribute('latlng')) || trim($page->getAttribute('latlng')) === ',') {
$parent = Page::getByID($page->getCollectionParentID());
$city = "{$page->getCollectionName()}, {$parent->getCollectionName()}";
$cityLocation = file_get_contents("https://maps.google.com/maps/api/geocode/json?address=" . urlencode($city) . "&sensor=false&key=AIzaSyAvsH_wiFHJCuMPPuVifJ7QgaRCStKTdZM");
$responseObj = $js->decode($cityLocation);
if ($responseObj->status != 'ZERO_RESULTS') {
$page->setAttribute('latlng', $responseObj->results[0]->geometry->location->lat . "," . $responseObj->results[0]->geometry->location->lng);
$updated++;
} else {
$not++;
}
}
}
return t("{$updated} cities geocoded, {$not} cities failed lookup.");
}
示例3: 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;
}
示例4: loadNewsSections
protected function loadNewsSections()
{
$newsSectionList = new PageList();
$newsSectionList->filterByEasynewsSection(1);
$newsSectionList->sortBy('cvName', 'asc');
$tmpSections = $newsSectionList->get();
$sections = array();
foreach ($tmpSections as $_c) {
$sections[$_c->getCollectionID()] = $_c->getCollectionName();
}
$this->set('sections', $sections);
}
示例5: 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';
}
示例6: run
public function run()
{
$db = Loader::db();
Cache::disableLocalCache();
Loader::model('attribute/categories/collection');
$cak = CollectionAttributeKey::getByHandle('exclude_page_list');
if (!is_object($cak)) {
$boolt = AttributeType::getByHandle('boolean');
$cab4b = CollectionAttributeKey::add($boolt, array('akHandle' => 'exclude_page_list', 'akName' => t('Exclude From Page List'), 'akIsSearchable' => true));
Loader::model('page_list');
$pl = new PageList();
$pl->filterByExcludeNav(1);
$list = $pl->get();
foreach ($list as $c) {
$c->setAttribute('exclude_page_list', 1);
$c->reindex();
}
}
Cache::enableLocalCache();
}
示例7: createGatheringItems
public function createGatheringItems(GatheringDataSourceConfiguration $configuration)
{
$pl = new PageList();
$pl->ignoreAliases();
$pl->ignorePermissions();
$gathering = $configuration->getGatheringObject();
if ($gathering->getGatheringDateLastUpdated()) {
$pl->filterByPublicDate($gathering->getGatheringDateLastUpdated(), '>');
}
$ptID = $configuration->getPageTypeID();
if ($ptID > 0) {
$pl->filterByPageTypeID($ptID);
}
$pages = $pl->get();
$items = array();
foreach ($pages as $c) {
$item = PageGatheringItem::add($configuration, $c);
if (is_object($item)) {
$items[] = $item;
}
}
return $items;
}
示例8: 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;
}
示例9: reindexAll
/**
* Reindexes the search engine.
*/
public function reindexAll($fullReindex = false)
{
Cache::disableLocalCache();
$db = Loader::db();
Loader::model('collection_attributes');
if ($fullReindex) {
$db->Execute("truncate table PageSearchIndex");
}
$pl = new PageList();
$pl->ignoreAliases();
$pl->ignorePermissions();
$pl->sortByCollectionIDAscending();
$pl->filter(false, '(c.cDateModified > psi.cDateLastIndexed or UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(psi.cDateLastIndexed) > ' . $this->searchReindexTimeout . ' or psi.cID is null or psi.cDateLastIndexed is null)');
$pl->filter(false, '(ak_exclude_search_index is null or ak_exclude_search_index = 0)');
$pages = $pl->get($this->searchBatchSize);
$num = 0;
foreach ($pages as $c) {
// make sure something is approved
$cv = $c->getVersionObject();
if (!$cv->cvIsApproved) {
continue;
}
$c->reindex($this, true);
$num++;
unset($c);
}
$pnum = Collection::reindexPendingPages();
$num = $num + $pnum;
Cache::enableLocalCache();
$result = new stdClass();
$result->count = $num;
return $result;
}
示例10: PageList
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);
?>
">
<?php
示例11: die
<?
defined('C5_EXECUTE') or die("Access Denied.");
$dh = Loader::helper('concrete/dashboard/sitemap');
if (!$dh->canRead()) {
die(t("Access Denied."));
}
$trash = Page::getByPath(TRASH_PAGE_PATH);
$i = 0;
if (is_object($trash) && !$trash->isError()) {
Loader::model('page_list');
$pl = new PageList();
$pl->filterByParentID($trash->getCollectionID());
$pl->includeInactivePages();
$pages = $pl->get();
foreach($pages as $pc) {
$cp = new Permissions($pc);
if ($cp->canDeleteCollection()) {
$i++;
$pc->delete();
}
}
}
if ($i == 1) {
$message = t('1 page deleted.');
} else {
$message = t('%s pages deleted', $i);
}
示例12: PageList
<style>
html,body { height:100%; width:100%;background:#90c2ff }
#map_canvas { height:100%; width:100%; background:#90c2ff }
</style>
</head>
<body>
<div id="map_canvas"></div>
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAvsH_wiFHJCuMPPuVifJ7QgaRCStKTdZM&sensor=false"></script>
<script>
<?php
$cities = Cache::get('map', 'world') ?: [];
if (empty($cities)) {
$nh = Loader::helper('navigation');
$pl = new PageList();
$pl->filterByCollectionTypeHandle('City');
foreach ($pl->get() as $page) {
$parent = Page::getByID($page->getCollectionParentID());
$pageOwnerID = $page->getCollectionUserID();
$pageOwner = UserInfo::getByID($pageOwnerID);
$cityName = t($page->getCollectionName());
$countryName = t($parent->getCollectionName());
$latlng = array_map(function ($e) {
return (double) trim($e);
}, explode(',', $page->getAttribute('latlng')));
$info = '<a href="' . $nh->getCollectionURL($page) . '" target="_blank">' . $cityName . ' Walks' . '</a>';
// If the owner is set
if ($pageOwnerID > 1) {
$coName = [$pageOwner->getAttribute('first_name'), $pageOwner->getAttribute('last_name')];
$info .= '<br />' . $coName[0] . ', City Organizer';
} else {
$coName = [];
示例13: exportPages
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->ignoreAliases();
$pl->filter(false, 'cFilename is null or cFilename = \'\'');
$pages = $pl->get();
foreach ($pages as $pc) {
$pc->export($node);
}
}
示例14: PageList
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) {
$newUser['oauth_auths'][$social->nodeName] = $social->nodeValue;
示例15: 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;
}