Files
@ f43d1a4680a9
Branch filter:
Location: hot67beta/administrator/modules/mod_submenu/mod_submenu.php
f43d1a4680a9
3.4 KiB
text/x-php
menubar 0 to 10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | <?php
/**
* @version $Id:mod_menu.php 2463 2006-02-18 06:05:38Z webImagery $
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 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.
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// Lets get some variables we will need to render the menu
$lang =& JFactory::getLanguage();
$doc =& JFactory::getDocument();
$user =& JFactory::getUser();
// If hidemainmenu is true, we don't want to render this module at all
echo JAdminSubMenu::get();
/**
* Admin Submenu
*
* @package Joomla
* @since 1.5
*/
class JAdminSubMenu
{
function get()
{
global $mainframe;
// Lets get some variables we are going to need
$menu = JToolBar::getInstance('submenu');
$list = $menu->_bar;
if(!is_array($list) || !count($list))
{
$option = JRequest::getCmd('option');
if($option == 'com_categories')
{
$section = JRequest::getCmd('section');
if ($section) {
if ($section != 'content') {
// special handling for specific core components
$map['com_contact_details'] = 'com_contact';
$map['com_banner'] = 'com_banners';
$option = isset( $map[$section] ) ? $map[$section] : $section;
}
}
}
$list = JAdminSubMenu::_loadDBList($option);
}
if (!is_array($list) || !count($list)) {
return null;
}
$hide = JRequest::getInt('hidemainmenu');
$txt = "<ul id=\"submenu\">\n";
/*
* Iterate through the link items for building the menu items
*/
foreach ($list as $item)
{
$txt .= "<li>\n";
if ($hide)
{
if (isset ($item[2]) && $item[2] == 1) {
$txt .= "<span class=\"nolink active\">".$item[0]."</span>\n";
}
else {
$txt .= "<span class=\"nolink\">".$item[0]."</span>\n";
}
}
else
{
if (isset ($item[2]) && $item[2] == 1) {
$txt .= "<a class=\"active\" href=\"".JFilterOutput::ampReplace($item[1])."\">".$item[0]."</a>\n";
}
else {
$txt .= "<a href=\"".JFilterOutput::ampReplace($item[1])."\">".$item[0]."</a>\n";
}
}
$txt .= "</li>\n";
}
$txt .= "</ul>\n";
return $txt;
}
function _loadDBList( $componentOption )
{
$db =& JFactory::getDBO();
$lang =& JFactory::getLanguage();
$lang->load($componentOption.'.menu');
$query = 'SELECT a.name, a.admin_menu_link, a.admin_menu_img' .
' FROM #__components AS a' .
' INNER JOIN #__components AS b ON b.id = a.parent' .
' WHERE b.option = ' . $db->Quote( $componentOption ) .
' AND b.parent = 0'.
' ORDER BY a.ordering ASC';
$db->setQuery($query);
$items = $db->loadObjectList();
// Process the items
$subMenuList = array();
foreach ($items as $item)
{
if (trim($item->admin_menu_link))
{
// handling for active sub menu item
$active = 0;
if (strpos( @$_SERVER['QUERY_STRING'], $item->admin_menu_link ) !== false ) {
$active = 1;
}
$key = $componentOption.'.'.$item->name;
$subMenuItem[0] = $lang->hasKey($key) ? JText::_($key) : $item->name;
$subMenuItem[1] = 'index.php?'. $item->admin_menu_link;
$subMenuItem[2] = $active;
$subMenuList[] = $subMenuItem;
}
}
return $subMenuList;
}
}
|