english/libraries/joomla/html/html/menu.php
/**
	 * Returns an array of menu items groups by menu.
	 *
	 * @param   array  An array of configuration options.
	 *
	 * @return  array
	 */
Returns an array of menu items groups by menu.
@param   array  An array of configuration options.

@return  array
Returns an array of menu items groups by menu . @param array An array of configuration options . @return array
public static function menuitems($config = array())
	{
		if (empty(self::$items))
		{
			$db = JFactory::getDbo();
			$db->setQuery(
				'SELECT menutype AS value, title AS text' .
				' FROM #__menu_types' .
				' ORDER BY title'
			);
			$menus = $db->loadObjectList();
			$query	= $db->getQuery(true);
			$query->select('a.id AS value, a.title AS text, a.level, a.menutype');
			$query->from('#__menu AS a');
			$query->where('a.parent_id > 0');
			$query->where('a.type <> '.$db->quote('url'));
			$query->where('a.client_id = 0');
			if (isset($config['published'])) {
				if (is_numeric($config['published'])) {
					$query->where('a.published = '.(int) $config['published']);
				} else if ($config['published'] === '') {
					$query->where('a.published IN (0,1)');
				}
			}
			$query->order('a.lft');
			$db->setQuery($query);
			$items = $db->loadObjectList();
			$lookup = array();
			foreach ($items as &$item) {
				if (!isset($lookup[$item->menutype])) {
					$lookup[$item->menutype] = array();
				}
				$lookup[$item->menutype][] = &$item;
				$item->text = str_repeat('- ',$item->level).$item->text;
			}
			self::$items = array();
			foreach ($menus as &$menu) {
				self::$items[] = JHtml::_('select.optgroup',	$menu->text);
				self::$items[] = JHtml::_('select.option', $menu->value.'.1', JText::_('JLIB_HTML_ADD_TO_THIS_MENU'));
				if (isset($lookup[$menu->value])) {
					foreach ($lookup[$menu->value] as &$item) {
						self::$items[] = JHtml::_('select.option', $menu->value.'.'.$item->value, $item->text);
					}
				}
				self::$items[] = JHtml::_('select.optgroup',	$menu->text);
			}
		}
		return self::$items;
	}
public static function menuitems ( $ config = array ( ) ) { if ( empty ( self :: $ items ) ) { $ db = JFactory :: getDbo ( ) ; $ db -> setQuery ( 'SELECT menutype AS value, title AS text' . ' FROM #__menu_types' . ' ORDER BY title' ) ; $ menus = $ db -> loadObjectList ( ) ; $ query = $ db -> getQuery ( true ) ; $ query -> select ( 'a.id AS value, a.title AS text, a.level, a.menutype' ) ; $ query -> from ( '#__menu AS a' ) ; $ query -> where ( 'a.parent_id > 0' ) ; $ query -> where ( 'a.type <> ' . $ db -> quote ( 'url' ) ) ; $ query -> where ( 'a.client_id = 0' ) ; if ( isset ( $ config [ 'published' ] ) ) { if ( is_numeric ( $ config [ 'published' ] ) ) { $ query -> where ( 'a.published = ' . ( int ) $ config [ 'published' ] ) ; } else if ( $ config [ 'published' ] === '' ) { $ query -> where ( 'a.published IN (0,1)' ) ; } } $ query -> order ( 'a.lft' ) ; $ db -> setQuery ( $ query ) ; $ items = $ db -> loadObjectList ( ) ; $ lookup = array ( ) ; foreach ( $ items as & $ item ) { if ( ! isset ( $ lookup [ $ item -> menutype ] ) ) { $ lookup [ $ item -> menutype ] = array ( ) ; } $ lookup [ $ item -> menutype ] [ ] = & $ item ; $ item -> text = str_repeat ( '- ' , $ item -> level ) . $ item -> text ; } self :: $ items = array ( ) ; foreach ( $ menus as & $ menu ) { self :: $ items [ ] = JHtml :: _ ( 'select.optgroup' , $ menu -> text ) ; self :: $ items [ ] = JHtml :: _ ( 'select.option' , $ menu -> value . '.1' , JText :: _ ( 'JLIB_HTML_ADD_TO_THIS_MENU' ) ) ; if ( isset ( $ lookup [ $ menu -> value ] ) ) { foreach ( $ lookup [ $ menu -> value ] as & $ item ) { self :: $ items [ ] = JHtml :: _ ( 'select.option' , $ menu -> value . '.' . $ item -> value , $ item -> text ) ; } } self :: $ items [ ] = JHtml :: _ ( 'select.optgroup' , $ menu -> text ) ; } } return self :: $ items ; }
Returns an array of menu items groups by menu.
Returns an array of menu items groups by menu .
// Filter on the published state // Collate menu items based on menutype // Start group: // Special "Add to this Menu" option: // Menu items: // Finish group: