本文整理汇总了PHP中PageList::filterByUserID方法的典型用法代码示例。如果您正苦于以下问题:PHP PageList::filterByUserID方法的具体用法?PHP PageList::filterByUserID怎么用?PHP PageList::filterByUserID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageList
的用法示例。
在下文中一共展示了PageList::filterByUserID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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, '>=');
//.........这里部分代码省略.........
示例2: 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);
//.........这里部分代码省略.........