本文整理汇总了PHP中PageModel::findPublishedSubpagesWithoutGuestsByPid方法的典型用法代码示例。如果您正苦于以下问题:PHP PageModel::findPublishedSubpagesWithoutGuestsByPid方法的具体用法?PHP PageModel::findPublishedSubpagesWithoutGuestsByPid怎么用?PHP PageModel::findPublishedSubpagesWithoutGuestsByPid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageModel
的用法示例。
在下文中一共展示了PageModel::findPublishedSubpagesWithoutGuestsByPid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderNavigation
/**
* Recursively compile the navigation menu and return it as HTML string
* @param integer
* @param integer
* @param string
* @param string
* @return string
*/
protected function renderNavigation($pid, $level = 1, $host = null, $language = null)
{
// Get all active subpages
$objSubpages = \PageModel::findPublishedSubpagesWithoutGuestsByPid($pid, $this->showHidden, $this instanceof \ModuleSitemap);
if ($objSubpages === null) {
return '';
}
$items = array();
$groups = array();
// Get all groups of the current front end user
if (FE_USER_LOGGED_IN) {
$this->import('FrontendUser', 'User');
$groups = $this->User->groups;
}
// Layout template fallback
if ($this->navigationTpl == '') {
$this->navigationTpl = 'nav_default';
}
$objTemplate = new \FrontendTemplate($this->navigationTpl);
$objTemplate->type = get_class($this);
$objTemplate->cssID = $this->cssID;
// see #4897
$objTemplate->level = 'level_' . $level++;
// Get page object
global $objPage;
// Browse subpages
while ($objSubpages->next()) {
// Skip hidden sitemap pages
if ($this instanceof \ModuleSitemap && $objSubpages->sitemap == 'map_never') {
continue;
}
$subitems = '';
$_groups = deserialize($objSubpages->groups);
// Override the domain (see #3765)
if ($host !== null) {
$objSubpages->domain = $host;
}
// Do not show protected pages unless a back end or front end user is logged in
if (!$objSubpages->protected || BE_USER_LOGGED_IN || is_array($_groups) && count(array_intersect($_groups, $groups)) || $this->showProtected || $this instanceof \ModuleSitemap && $objSubpages->sitemap == 'map_always') {
// Check whether there will be subpages
if ($objSubpages->subpages > 0 && (!$this->showLevel || $this->showLevel >= $level || !$this->hardLimit && ($objPage->id == $objSubpages->id || in_array($objPage->id, $this->Database->getChildRecords($objSubpages->id, 'tl_page'))))) {
$subitems = $this->renderNavigation($objSubpages->id, $level, $host, $language);
}
// Get href
switch ($objSubpages->type) {
case 'redirect':
$href = $objSubpages->url;
if (strncasecmp($href, 'mailto:', 7) === 0) {
$href = \String::encodeEmail($href);
}
break;
case 'forward':
if ($objSubpages->jumpTo) {
$objNext = $objSubpages->getRelated('jumpTo');
} else {
$objNext = \PageModel::findFirstPublishedRegularByPid($objSubpages->id);
}
if ($objNext !== null) {
// Hide the link if the target page is invisible
if (!$objNext->published || $objNext->start != '' && $objNext->start > time() || $objNext->stop != '' && $objNext->stop < time()) {
continue 2;
}
$strForceLang = null;
$objNext->loadDetails();
// Check the target page language (see #4706)
if (\Config::get('addLanguageToUrl')) {
$strForceLang = $objNext->language;
}
$href = $this->generateFrontendUrl($objNext->row(), null, $strForceLang, true);
break;
}
// DO NOT ADD A break; STATEMENT
// DO NOT ADD A break; STATEMENT
default:
$href = $this->generateFrontendUrl($objSubpages->row(), null, $language, true);
break;
}
$row = $objSubpages->row();
// Active page
if (($objPage->id == $objSubpages->id || $objSubpages->type == 'forward' && $objPage->id == $objSubpages->jumpTo) && !$this instanceof \ModuleSitemap && !\Input::get('articles')) {
// Mark active forward pages (see #4822)
$strClass = ($objSubpages->type == 'forward' && $objPage->id == $objSubpages->jumpTo ? 'forward' . (in_array($objSubpages->id, $objPage->trail) ? ' trail' : '') : 'active') . ($subitems != '' ? ' submenu' : '') . ($objSubpages->protected ? ' protected' : '') . ($objSubpages->cssClass != '' ? ' ' . $objSubpages->cssClass : '');
$row['isActive'] = true;
} else {
$strClass = ($subitems != '' ? 'submenu' : '') . ($objSubpages->protected ? ' protected' : '') . (in_array($objSubpages->id, $objPage->trail) ? ' trail' : '') . ($objSubpages->cssClass != '' ? ' ' . $objSubpages->cssClass : '');
// Mark pages on the same level (see #2419)
if ($objSubpages->pid == $objPage->pid) {
$strClass .= ' sibling';
}
$row['isActive'] = false;
}
$row['subitems'] = $subitems;
//.........这里部分代码省略.........
示例2: getBookPages
/**
* Recursively get all book pages
*
* @param integer $intParentId
* @param array $groups
* @param integer $time
*/
protected function getBookPages($intParentId, $groups, $time)
{
$objPages = \PageModel::findPublishedSubpagesWithoutGuestsByPid($intParentId, $this->showHidden);
if ($objPages !== null) {
while ($objPages->next()) {
$_groups = deserialize($objPages->groups);
// Do not show protected pages unless a back end or front end user is logged in
if (!$objPages->protected || BE_USER_LOGGED_IN || is_array($_groups) && count(array_intersect($groups, $_groups)) || $this->showProtected) {
$this->arrPages[$objPages->id] = $objPages->row();
if ($objPages->subpages > 0) {
$this->getBookPages($objPages->id, $groups, $time);
}
}
}
}
}