|
iTx Technologies offre gratuitement
|
||
[Vue sommaire] [Imprimer] [Vue textuelle]
1 <?php 2 /** 3 * @version $Id: menu.php 8682 2007-08-31 18:36:45Z jinx $ 4 * @package Joomla.Framework 5 * @subpackage Application 6 * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant 9 * to the GNU General Public License, and as distributed it includes or 10 * is derivative of works licensed under the GNU General Public License or 11 * other free or open source software licenses. 12 * See COPYRIGHT.php for copyright notices and details. 13 */ 14 15 // Check to ensure this file is within the rest of the framework 16 defined('JPATH_BASE') or die(); 17 18 /** 19 * JMenu class 20 * 21 * @package Joomla.Framework 22 * @subpackage Application 23 * @since 1.5 24 */ 25 class JMenuSite extends JMenu 26 { 27 /** 28 * Loads the entire menu table into memory 29 * 30 * @access public 31 * @return array 32 */ 33 function load() 34 { 35 36 $cache = &JFactory::getCache('_system', 'output'); 37 38 if (!$data = $cache->get('menu_items')) { 39 // Initialize some variables 40 $db = & JFactory::getDBO(); 41 42 $sql = 'SELECT m.*, c.`option` as component' . 43 ' FROM #__menu AS m' . 44 ' LEFT JOIN #__components AS c ON m.componentid = c.id'. 45 ' WHERE m.published = 1'. 46 ' ORDER BY m.sublevel, m.parent, m.ordering'; 47 $db->setQuery($sql); 48 49 if (!($menus = $db->loadObjectList('id'))) { 50 JError::raiseWarning('SOME_ERROR_CODE', "Error loading Menus: ".$db->getErrorMsg()); 51 return false; 52 } 53 54 foreach($menus as $key => $menu) 55 { 56 //Get parent information 57 $parent_route = ''; 58 $parent_tree = array(); 59 if(($parent = $menus[$key]->parent) && (isset($menus[$parent])) && 60 (is_object($menus[$parent])) && (isset($menus[$parent]->route)) && isset($menus[$parent]->tree)) { 61 $parent_route = $menus[$parent]->route.'/'; 62 $parent_tree = $menus[$parent]->tree; 63 } 64 65 //Create tree 66 array_push($parent_tree, $menus[$key]->id); 67 $menus[$key]->tree = $parent_tree; 68 69 //Create route 70 $route = $parent_route.$menus[$key]->alias; 71 $menus[$key]->route = $route; 72 73 //Create the query array 74 $url = str_replace('index.php?', '', $menus[$key]->link); 75 if(strpos($url, '&') !== false) 76 { 77 $url = str_replace('&','&',$url); 78 } 79 80 parse_str($url, $menus[$key]->query); 81 } 82 83 $cache->store(serialize($menus), 'menu_items'); 84 $this->_items = $menus; 85 } else { 86 $this->_items = unserialize($data); 87 } 88 } 89 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
|
|
|
|