3 * @version $Id: mainmenuHelper.php 5528 2013-01-08 12:00:41Z fishbone $
5 * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
6 * @license GNU/GPL, see LICENSE.php
7 * Joomla! is free software. This version may have been modified pursuant
8 * to the GNU General Public License, and as distributed it includes or
9 * is derivative of works licensed under the GNU General Public License or
10 * other free or open source software licenses.
11 * See COPYRIGHT.php for copyright notices and details.
15 defined('_JEXEC') or die('Restricted access');
18 * mod_mainmenu Helper class
25 class modMainMenuHelper
27 function &getXML($type, &$params, $decorator)
32 // Joomla用のメニューコンテンツを取得
33 $xmls[$type] = $gEnvManager->getJoomlaMenuContent();
36 $xml = JFactory::getXMLParser('Simple');
37 $xml->loadString($xmls[$type]);
38 $doc = &$xml->document;
40 //$menu = &JSite::getMenu();
41 // $menu = new JMenuTree($params);
42 // $active = $menu->getActive();
43 $start = $params->get('startLevel');
44 $end = $params->get('endLevel');
45 $sChild = $params->get('showAllChildren');
48 if ($doc && is_callable($decorator)) {
49 $doc->map($decorator, array('end'=>$end, 'children'=>$sChild));
54 function render(&$params, $callback)
56 // Include the new menu class
57 $xml = modMainMenuHelper::getXML($params->get('menutype'), $params, $callback);
59 $class = $params->get('class_sfx');
60 $xml->addAttribute('class', 'menu'.$class);
61 if ($tagId = $params->get('tag_id')) {
62 $xml->addAttribute('id', $tagId);
65 $result = JFilterOutput::ampReplace($xml->toString((bool)$params->get('show_whitespace')));
66 $result = str_replace(array('<ul/>', '<ul />'), '', $result);