function renderMenuItem($menuItem, $currentMenu) { $menuSelected = null; static $user = null; if ($user == null) { $user =& JFactory::getUser(); } // access: 0 - Public, 1 - Registered, 2 - Special // gid: 23 - Manager, 24 - Administrator, 25 - Super Administrator if ($menuItem['access'] == 1 && $user->gid < 24 || $menuItem['access'] == 2 && $user->gid < 25) { return; } if ($menuItem['type'] == 'separator') { print "<li class=\"separator\"><span></span></li>\n"; } else { if (strpos($menuItem['link'], 'modules/mod_apmenu/dynamic/') === 0) { require_once $menuItem['link']; } else { $menuItemParams = new JParameter($menuItem['params']); $menuImage = $menuItemParams->get('menu_image'); $anchorExtra = ""; // Use onclick for any javascript if (strpos($menuItem['link'], "javascript:") === 0) { $href = "#"; $anchorExtra = "onclick=\"" . $menuItem['link'] . "\""; } else { $href = $menuItem['link']; } if (strpos($menuItem['link'], $currentMenu)) { $menuSelected = 'selected="selected"'; } else { $menuSelected = ""; } // if($currentMenu) { // print "<option value=\"".$href."\" " . $menuSelected . ">"; // } else { print "<li class=\"node\">\n"; print "<a id=\"" . str_replace(' ', '', $menuItem['name']) . "\" " . $anchorExtra . " href=\"" . $href . "\">"; // } if ($menuImage == -1) { print $menuItem['name']; } else { print "<img src=\"" . $menuImage . "\" />"; } // if($currentMenu) { // print "</option>"; // } else { print "</a>\n"; // } $childCount = count($menuItem['children']); if ($childCount > 0) { print "<ul>\n"; for ($i = 0; $i < $childCount; $i++) { modAPMenuHelper::renderMenuItem($menuItem['children'][$i]); } print "</ul>\n"; } // if(!$currentMenu) // { print "</li>\n"; // } } } }
<?php // no direct access defined('_JEXEC') or die('Restricted access'); require_once dirname(__FILE__) . DS . 'helper.php'; $db =& JFactory::getDBO(); $sql = "SELECT menutype, " . "\ttitle " . "FROM #__menu_types " . "ORDER BY title"; $db->setQuery($sql); $menuTypes = $db->loadAssocList(); $menu = array(); for ($i = 0; $i < count($menuTypes); $i++) { $menuType = $menuTypes[$i]; $menu[] = array('id' => 'menus' . $i, 'name' => $menuType['title'], 'link' => 'index.php?option=com_menus&task=view&menutype=' . $menuType['menutype'], 'type' => 'url', 'parent' => 0, 'params' => 'menu_image=-1', 'access' => 0, 'children' => array()); } modAPMenuHelper::renderMenu($menu); ?>
<?php /** * @version 1.x * @package AdminPraise Lite * @copyright (C) 2008 - 2011 Pixel Praise LLC * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ /** * This file is part of AdminPraise Lite. * * AdminPraise Lite is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with AdminPraise Lite. If not, see <http://www.gnu.org/licenses/>. * **/ defined('_JEXEC') or die('Restricted access'); $menu = modAPMenuHelper::getMenu($params->get('menutype')); modAPMenuHelper::renderMenu($menu, true);