当前位置: 首页>>代码示例>>PHP>>正文


PHP PageModel::findPublishedSubpagesWithoutGuestsByPid方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:iCodr8,项目名称:core,代码行数:101,代码来源:Module.php

示例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);
                 }
             }
         }
     }
 }
开发者ID:Jobu,项目名称:core,代码行数:23,代码来源:ModuleBooknav.php


注:本文中的PageModel::findPublishedSubpagesWithoutGuestsByPid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。