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


PHP PageRepository::getMenu方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Frontend\Page\PageRepository::getMenu方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRepository::getMenu方法的具体用法?PHP PageRepository::getMenu怎么用?PHP PageRepository::getMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Frontend\Page\PageRepository的用法示例。


在下文中一共展示了PageRepository::getMenu方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMenuPageOverlay

 /**
  * @test
  */
 public function getMenuPageOverlay()
 {
     $this->pageRepo->sys_language_uid = 1;
     $rows = $this->pageRepo->getMenu(array(2, 3), 'uid, title');
     $this->assertEquals('Attrappe 1-2-5', $rows[5]['title']);
     $this->assertEquals('Attrappe 1-2-6', $rows[6]['title']);
     $this->assertEquals('Dummy 1-2-7', $rows[7]['title']);
     $this->assertEquals('Dummy 1-3-8', $rows[8]['title']);
     $this->assertEquals('Attrappe 1-3-9', $rows[9]['title']);
     $this->assertCount(5, $rows);
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:14,代码来源:PageRepositoryTest.php

示例2: getPageTree

 /**
  * recursive function for building a page array
  *
  * @param array $page the current page
  * @param int $depth the current depth
  * @param array $pages contains all pages so far
  * @param int $level the tree level required for the UI grid
  * @return array
  */
 protected function getPageTree($page, $depth, $pages = [], $level = 0)
 {
     // default query settings
     $fields = '*';
     $sortField = 'sorting';
     // decrease the depth
     $depth--;
     // add the current language value
     if ($this->modParams['lang'] > 0) {
         $page['sys_language_uid'] = $this->languages[$page['_PAGES_OVERLAY_LANGUAGE'] ?: 0];
     }
     if ($this->showResults) {
         $results = $this->getResults($page);
         $page['results'] = $results['Percentage']['count'];
     }
     $page['level'] = $level;
     // add the page to the pages array
     $pages[] =& $page;
     // fetch subpages and set the treelevel
     if ($depth > 0) {
         $subPages = $this->pageRepository->getMenu($page['uid'], $fields, $sortField);
         if (count($subPages) > 0) {
             $page['$$treeLevel'] = $level;
             $level++;
             foreach ($subPages as &$subPage) {
                 $pages = $this->getPageTree($subPage, $depth, $pages, $level);
             }
         }
     }
     return $pages;
 }
开发者ID:clickstorm,项目名称:cs_seo,代码行数:40,代码来源:ModuleController.php

示例3: getMenu

 /**
  * Wrapper for \TYPO3\CMS\Frontend\Page\PageRepository::getMenu()
  * Caution: different signature
  *
  * @param integer $pageUid
  * @param array $excludePages
  * @param string $where
  * @param boolean $showHiddenInMenu
  * @param boolean $checkShortcuts
  * @param array $allowedDoktypeList
  * @return array
  */
 public function getMenu($pageUid = NULL, $excludePages = array(), $where = '', $showHiddenInMenu = FALSE, $checkShortcuts = FALSE, $allowedDoktypeList = array())
 {
     if (NULL === $pageUid) {
         $pageUid = $GLOBALS['TSFE']->id;
     }
     $addWhere = self::$pageSelect->enableFields('pages', 0);
     if (0 < count($allowedDoktypeList)) {
         $addWhere .= ' AND doktype IN (' . implode(',', $allowedDoktypeList) . ')';
     } else {
         $addWhere .= ' AND doktype != ' . PageRepository::DOKTYPE_SYSFOLDER;
     }
     if (0 < count($excludePages)) {
         $addWhere .= ' AND uid NOT IN (' . implode(',', $excludePages) . ')';
     }
     if (FALSE === (bool) $showHiddenInMenu) {
         $addWhere .= ' AND nav_hide=0';
     }
     if ('' !== $where) {
         $addWhere = $where . ' ' . $addWhere;
     }
     $key = md5(intval($showHiddenInMenu) . $pageUid . $addWhere . intval($checkShortcuts));
     if (FALSE === isset(self::$cachedMenus[$key])) {
         self::$cachedMenus[$key] = self::$pageSelect->getMenu($pageUid, '*', 'sorting', $addWhere, $checkShortcuts);
     }
     return self::$cachedMenus[$key];
 }
开发者ID:smichaelsen,项目名称:vhs,代码行数:38,代码来源:PageSelectService.php

示例4: resolveShortcutFirstSubpage

 /**
  * Resolves shortcuts for the shortcur of type PageRepository::SHORTCUT_MODE_FIRST_SUBPAGE.
  *
  * @param array $page
  * @param array $processedPages
  * @return array
  */
 private function resolveShortcutFirstSubpage(array $page, array &$processedPages)
 {
     $rows = $this->pageRepository->getMenu($page['uid']);
     if (count($rows) > 0) {
         reset($rows);
         $page = current($rows);
         if ($page['doktype'] == PageRepository::DOKTYPE_SHORTCUT) {
             $page = $this->resolveShortcutProcess($page, $processedPages);
         }
     }
     return $page;
 }
开发者ID:MaxServ,项目名称:typo3-realurl,代码行数:19,代码来源:EncodeDecoderBase.php

示例5: getArticlePagesList

 /**
  * @return array
  * @throws Exception
  */
 protected function getArticlePagesList()
 {
     $pageList = array();
     if ($this->settings['pidOrganizationFolder'] > 0) {
         $organizations = $this->organizationRepository->findAll();
         $usedLeisureFolderPids = array();
         /** @var  $organization \MUM\BjrFreizeit\Domain\Model\Organization $organization */
         foreach ($organizations as $organization) {
             $usedLeisureFolderPids[] = $organization->getLeisureFolderPid();
         }
         $ret = $this->pageRepository->getMenu($this->settings['pidOrganizationFolder'], '*', 'sorting', 'AND deleted =0 AND hidden = 0');
         foreach ($ret as $pageUid => $row) {
             if (!in_array($pageUid, $usedLeisureFolderPids)) {
                 $pageList[$pageUid] = $row['title'];
             }
         }
     } else {
         throw new Exception('PID für Seite mit Anbieter ist nicht gesetzt.');
     }
     return $pageList;
 }
开发者ID:manfred-ursprung,项目名称:bjrfreizeit,代码行数:25,代码来源:OrganizationController.php

示例6: isSubMenu

 /**
  * Returns TRUE if there is a submenu with items for the page id, $uid
  * Used by the item states "IFSUB", "ACTIFSUB" and "CURIFSUB" to check if there is a submenu
  *
  * @param integer $uid Page uid for which to search for a submenu
  * @return boolean Returns TRUE if there was a submenu with items found
  * @access private
  * @todo Define visibility
  */
 public function isSubMenu($uid)
 {
     // Looking for a mount-pid for this UID since if that
     // exists we should look for a subpages THERE and not in the input $uid;
     $mount_info = $this->sys_page->getMountPointInfo($uid);
     if (is_array($mount_info)) {
         $uid = $mount_info['mount_pid'];
     }
     $recs = $this->sys_page->getMenu($uid, 'uid,pid,doktype,mount_pid,mount_pid_ol,nav_hide,shortcut,shortcut_mode,l18n_cfg');
     $hasSubPages = FALSE;
     $bannedUids = $this->getBannedUids();
     foreach ($recs as $theRec) {
         // no valid subpage if the document type is excluded from the menu
         if (GeneralUtility::inList($this->doktypeExcludeList, $theRec['doktype'])) {
             continue;
         }
         // No valid subpage if the page is hidden inside menus and
         // it wasn't forced to show such entries
         if ($theRec['nav_hide'] && !$this->conf['includeNotInMenu']) {
             continue;
         }
         // No valid subpage if the default language should be shown and the page settings
         // are excluding the visibility of the default language
         if (!$GLOBALS['TSFE']->sys_language_uid && GeneralUtility::hideIfDefaultLanguage($theRec['l18n_cfg'])) {
             continue;
         }
         // No valid subpage if the alternative language should be shown and the page settings
         // are requiring a valid overlay but it doesn't exists
         $hideIfNotTranslated = GeneralUtility::hideIfNotTranslated($theRec['l18n_cfg']);
         if ($GLOBALS['TSFE']->sys_language_uid && $hideIfNotTranslated && !$theRec['_PAGES_OVERLAY']) {
             continue;
         }
         // No valid subpage if the subpage is banned by excludeUidList
         if (in_array($theRec['uid'], $bannedUids)) {
             continue;
         }
         $hasSubPages = TRUE;
         break;
     }
     return $hasSubPages;
 }
开发者ID:rob-ot-dot-be,项目名称:ggallkeysecurity,代码行数:50,代码来源:AbstractMenuContentObject.php

示例7: getPageShortcut

 /**
  * Get page shortcut; Finds the records pointed to by input value $SC (the shortcut value)
  *
  * @param integer $SC The value of the "shortcut" field from the pages record
  * @param integer $mode The shortcut mode: 1 will select first subpage, 2 a random subpage, 3 the parent page; default is the page pointed to by $SC
  * @param integer $thisUid The current page UID of the page which is a shortcut
  * @param integer $itera Safety feature which makes sure that the function is calling itself recursively max 20 times (since this function can find shortcuts to other shortcuts to other shortcuts...)
  * @param array $pageLog An array filled with previous page uids tested by the function - new page uids are evaluated against this to avoid going in circles.
  * @return mixed Returns the page record of the page that the shortcut pointed to.
  * @access private
  * @see getPageAndRootline()
  * @todo Define visibility
  */
 public function getPageShortcut($SC, $mode, $thisUid, $itera = 20, $pageLog = array())
 {
     $idArray = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $SC);
     // Find $page record depending on shortcut mode:
     switch ($mode) {
         case \TYPO3\CMS\Frontend\Page\PageRepository::SHORTCUT_MODE_FIRST_SUBPAGE:
         case \TYPO3\CMS\Frontend\Page\PageRepository::SHORTCUT_MODE_RANDOM_SUBPAGE:
             $pageArray = $this->sys_page->getMenu($idArray[0] ? $idArray[0] : $thisUid, '*', 'sorting', 'AND pages.doktype<199 AND pages.doktype!=' . \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_BE_USER_SECTION);
             $pO = 0;
             if ($mode == \TYPO3\CMS\Frontend\Page\PageRepository::SHORTCUT_MODE_RANDOM_SUBPAGE && count($pageArray)) {
                 $randval = intval(rand(0, count($pageArray) - 1));
                 $pO = $randval;
             }
             $c = 0;
             foreach ($pageArray as $pV) {
                 if ($c == $pO) {
                     $page = $pV;
                     break;
                 }
                 $c++;
             }
             if (count($page) == 0) {
                 $message = 'This page (ID ' . $thisUid . ') is of type "Shortcut" and configured to redirect to a subpage. ' . 'However, this page has no accessible subpages.';
                 throw new \TYPO3\CMS\Core\Error\Http\PageNotFoundException($message, 1301648328);
             }
             break;
         case \TYPO3\CMS\Frontend\Page\PageRepository::SHORTCUT_MODE_PARENT_PAGE:
             $parent = $this->sys_page->getPage($thisUid);
             $page = $this->sys_page->getPage($parent['pid']);
             if (count($page) == 0) {
                 $message = 'This page (ID ' . $thisUid . ') is of type "Shortcut" and configured to redirect to its parent page. ' . 'However, the parent page is not accessible.';
                 throw new \TYPO3\CMS\Core\Error\Http\PageNotFoundException($message, 1301648358);
             }
             break;
         default:
             $page = $this->sys_page->getPage($idArray[0]);
             if (count($page) == 0) {
                 $message = 'This page (ID ' . $thisUid . ') is of type "Shortcut" and configured to redirect to a page, which is not accessible (ID ' . $idArray[0] . ').';
                 throw new \TYPO3\CMS\Core\Error\Http\PageNotFoundException($message, 1301648404);
             }
             break;
     }
     // Check if short cut page was a shortcut itself, if so look up recursively:
     if ($page['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SHORTCUT) {
         if (!in_array($page['uid'], $pageLog) && $itera > 0) {
             $pageLog[] = $page['uid'];
             $page = $this->getPageShortcut($page['shortcut'], $page['shortcut_mode'], $page['uid'], $itera - 1, $pageLog);
         } else {
             $pageLog[] = $page['uid'];
             $message = 'Page shortcuts were looping in uids ' . implode(',', $pageLog) . '...!';
             \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'cms', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
             throw new \RuntimeException($message, 1294587212);
         }
     }
     // Return resulting page:
     return $page;
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:70,代码来源:TypoScriptFrontendController.php

示例8: getSubPages

 /**
  * @param int $startPageId
  * @return array
  */
 private function getSubPages($startPageId)
 {
     return $this->pageRepo->getMenu($startPageId, '*', 'sorting', $this->pageRepo->enableFields('pages') . 'AND ' . UrlEntry::EXCLUDE_FROM_SITEMAP . '!=1');
 }
开发者ID:IchHabRecht,项目名称:sitemap_generator,代码行数:8,代码来源:SitemapRepository.php

示例9: getPageMenu

 /**
  * @param int $id
  * @return array
  */
 protected function getPageMenu($id)
 {
     return $this->pageRepository->getMenu($id, '*', 'sorting');
 }
开发者ID:xnet74,项目名称:bk2k_collection,代码行数:8,代码来源:SitemapService.php


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