Source code for file /joomla/html/parameter/element/menuitem.php
Documentation is available at menuitem.php
* @version $Id: menuitem.php 6612 2007-02-13 00:47:52Z Jinx $
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
// Check to ensure this file is within the rest of the framework
* Renders a menu item element
* @package Joomla.Framework
$menuType =
$this->_parent->get('menu_type');
$where =
' WHERE menutype = "'.
$menuType.
"'";
// load the list of menu types
// TODO: move query to model
$query =
'SELECT menutype, title' .
$menuTypes =
$db->loadObjectList();
if ($state =
$node->attributes('state')) {
$where .=
' AND published = "'.
$state.
'"';
// load the list of menu items
// TODO: move query to model
$query =
'SELECT id, parent, name, menutype' .
' ORDER BY menutype, parent, ordering'
$menuItems =
$db->loadObjectList();
// establish the hierarchy of the menu
// first pass - collect children
foreach ($menuItems as $v) {
$list =
@$children[$pt] ?
$children[$pt] :
array();
// second pass - get an indent list of the items
// assemble into menutype groups
foreach ($list as $k =>
$v)
$groupedList[$v->menutype][] =
&$list[$k];
// assemble menu items to the array
foreach ($menuTypes as $type)
if (isset
( $groupedList[$type->menutype] ))
$n =
count( $groupedList[$type->menutype] );
for ($i =
0; $i <
$n; $i++
)
$item =
&$groupedList[$type->menutype][$i];
$options[] =
JHTMLSelect::option( $item->id, ' ' .
$item->treename );
return JHTMLSelect::genericList($options, ''.
$control_name.
'['.
$name.
']', 'class="inputbox"', 'value', 'text', $value, $control_name.
$name);