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


PHP JMenu::getItems方法代码示例

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


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

示例1: getItemsFromPlatform

 /**
  * Get menu items from the platform.
  *
  * @param array $params
  * @return array    List of routes to the pages.
  */
 protected function getItemsFromPlatform($params)
 {
     $attributes = ['menutype'];
     $values = [$params['menu']];
     // Items are already filtered by access and language, in admin we need to work around that.
     if (\JFactory::getApplication()->isAdmin()) {
         $attributes[] = 'access';
         $values[] = null;
         $attributes[] = 'language';
         $values[] = null;
     }
     return $this->menu->getItems($attributes, $values);
 }
开发者ID:nmsde,项目名称:gantry5,代码行数:19,代码来源:Menu.php

示例2: makeLookup

 /**
  * Fills the lookup variable.
  *
  * @return null
  */
 private function makeLookup()
 {
     $this->lookup = array();
     $component = JComponentHelper::getComponent('com_monitor');
     $attributes = array('component_id');
     $values = array($component->id);
     $items = $this->menu->getItems($attributes, $values);
     foreach ($items as $item) {
         if (isset($item->query)) {
             switch ($item->query['view']) {
                 case 'projects':
                     $this->addLookup((int) $item->id, 'projects');
                     break;
                 case 'comments':
                     $this->addLookup((int) $item->id, 'comments');
                     break;
                 case 'project':
                     if (isset($item->query['id'])) {
                         $this->addLookup((int) $item->id, 'project', $item->query['id']);
                     }
                     break;
                 case 'issues':
                     $id = isset($item->query['project_id']) ? $item->query['project_id'] : '_';
                     $this->addLookup((int) $item->id, 'issues', $id);
                     break;
                 case 'issue':
                     $layout = isset($item->query['layout']) ? $item->query['layout'] : 'default';
                     if (isset($item->query['id'])) {
                         $this->addLookup((int) $item->id, 'issue', $item->query['id'], $layout);
                     } elseif ($layout === 'edit' && isset($item->query['project_id'])) {
                         $this->addLookup((int) $item->id, 'issue', $item->query['project_id'], 'new');
                     }
                     break;
                 case 'comment':
                     if (isset($item->query['id'])) {
                         $this->addLookup((int) $item->id, 'comment', $item->query['id'], 'edit');
                     } elseif (isset($item->query['issue_id'])) {
                         $this->addLookup((int) $item->id, 'comment', $item->query['id'], 'new');
                     }
                     break;
             }
         }
     }
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:49,代码来源:router.php

示例3: getItems

 /**
  * Gets menu items by attribute
  *
  * @param	string	$attributes	The field name
  * @param	string	$values		The value of the field
  * @param	boolean	$firstonly	If true, only returns the first item found
  *
  * @return	array
  */
 public function getItems($attributes, $values, $firstonly = false)
 {
     $attributes = (array) $attributes;
     $values = (array) $values;
     $app = JApplication::getInstance('site');
     if ($app->isSite()) {
         // Filter by language if not set
         if (($key = array_search('language', $attributes)) === false) {
             if ($app->getLanguageFilter()) {
                 $attributes[] = 'language';
                 $values[] = array(JFactory::getLanguage()->getTag(), '*');
             }
         } elseif ($values[$key] === null) {
             unset($attributes[$key]);
             unset($values[$key]);
         }
         // Filter by access level if not set
         if (($key = array_search('access', $attributes)) === false) {
             $attributes[] = 'access';
             $values[] = JFactory::getUser()->getAuthorisedViewLevels();
         } elseif ($values[$key] === null) {
             unset($attributes[$key]);
             unset($values[$key]);
         }
     }
     return parent::getItems($attributes, $values, $firstonly);
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:36,代码来源:menu.php

示例4: getItems

	/**
	 * Gets menu items by attribute
	 *
	 * @param	string	$attributes	The field name
	 * @param	string	$values		The value of the field
	 * @param	boolean	$firstonly	If true, only returns the first item found
	 *
	 * @return	array
	 */
	public function getItems($attributes, $values, $firstonly = false)
	{
		$attributes = (array) $attributes;
		$values = (array) $values;
		$app	= JFactory::getApplication();
		// Filter by language if not set
		if ($app->isSite() && $app->getLanguageFilter() && !array_key_exists('language',$attributes)) {
			$attributes[]='language';
			$values[]=array(JFactory::getLanguage()->getTag(), '*');
		}
		return parent::getItems($attributes, $values, $firstonly);
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:21,代码来源:menu.php

示例5: buildFromViewAndId

 /**
  * buildFromViewAndId
  *
  * @param string  $component
  * @param string  $view
  * @param array   $queries
  * @param boolean $replace
  * @param \JMenu  $menu
  */
 public static function buildFromViewAndId($component, $view, &$queries, &$replace, \JMenu $menu)
 {
     // Get all com_flower menus
     $menuItems = $menu->getItems('component', $component);
     // Find matched menu item.
     foreach ($menuItems as $menuItem) {
         if (isset($menuItem->query['view']) && $menuItem->query['view'] == $view && isset($menuItem->query['id']) && $menuItem->query['id'] == $queries['id']) {
             // Replace core route rule.
             $replace = true;
             // Only return menu Itemid then Joomla will convert to menu alias
             $queries = array('Itemid' => $menuItem->id);
         }
     }
     // No menu matched, follows default rule.
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:24,代码来源:RadRoutingHelper.php

示例6: getItemsFromPlatform

 /**
  * Get menu items from the platform.
  *
  * @param array $params
  * @return array    List of routes to the pages.
  */
 protected function getItemsFromPlatform($params)
 {
     // Items are already filtered by ViewLevels and user language.
     return $this->menu->getItems('menutype', $params['menu'] ?: $this->default->menutype);
 }
开发者ID:Acidburn0zzz,项目名称:gantry5,代码行数:11,代码来源:Menu.php

示例7: getItems

 /**
  * Gets menu items by attribute
  *
  * @param   string   $attributes  The field name
  * @param   string   $values      The value of the field
  * @param   boolean  $firstonly   If true, only returns the first item found
  *
  * @return  array
  *
  * @since   1.6
  */
 public function getItems($attributes, $values, $firstonly = false)
 {
     $attributes = (array) $attributes;
     $values = (array) $values;
     if ($this->app->isSite()) {
         // Filter by language if not set
         if (($key = array_search('language', $attributes)) === false) {
             if (JLanguageMultilang::isEnabled()) {
                 $attributes[] = 'language';
                 $values[] = array(JFactory::getLanguage()->getTag(), '*');
             }
         } elseif ($values[$key] === null) {
             unset($attributes[$key]);
             unset($values[$key]);
         }
         // Filter by access level if not set
         if (($key = array_search('access', $attributes)) === false) {
             $attributes[] = 'access';
             $values[] = $this->user->getAuthorisedViewLevels();
         } elseif ($values[$key] === null) {
             unset($attributes[$key]);
             unset($values[$key]);
         }
     }
     // Reset arrays or we get a notice if some values were unset
     $attributes = array_values($attributes);
     $values = array_values($values);
     return parent::getItems($attributes, $values, $firstonly);
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:40,代码来源:site.php


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