function create_menu($current_menu_id) { $items = menuItems(); $menus = new JMenuSite(); if (isset($items[$current_menu_id])) { $item = $items[$current_menu_id]; foreach ($item as $key => $item_id) { echo '<li>'; echo $menus->getItem($item_id)->title; echo '</li>'; } } }
/** * System Event: onAfterInitialise * * Load JF Core Overrides * * @return string */ public function onAfterInitialise() { if (JFactory::getApplication()->isSite() && !JoomfishExtensionHelper::isJoomFishActive()) { JError::raiseNotice('no_jf_extension', JText::_('JF_DATABASE_PLUGIN_NOT_PUBLISHED')); } $dbtype = JFactory::getConfig()->getValue('dbtype', 'mysqli'); if ($dbtype != 'mysqli') { JError::raiseNotice('no_jf_extension', JText::_('JF_DATABASE_DRIVER_NOT_SUPPORTED')); return; } if (!defined('JFOVERRIDES_PLUGIN_LOCATION')) { define('JFOVERRIDES_PLUGIN_LOCATION', dirname(__FILE__)); } if (JFactory::getApplication()->isAdmin()) { // remove * $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/language.php', 'JFormFieldLanguage'); $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/contentlanguage.php', 'JFormFieldContentLanguage'); // remove translated menus from root $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/adminmenuhelper.php', 'ModMenuHelper'); // added pre-post save events $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/menusmodelitem.php', 'MenusModelItem'); // home menu allow also default lang not just * $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/tablemenu.php', 'JTableMenu', true); } else { //JFactory::getApplication()->setLanguageFilter(false); jimport('joomla.application.menu'); //JLoader::import('joomla.application.menu', JFOVERRIDES_PLUGIN_LOCATION.'/classes' ); $this->_requireClassFile(JFOVERRIDES_PLUGIN_LOCATION . '/classes/menu.php', 'JMenuSite', true); JMenuSite::getInstance('site'); } }
/** * Simple checking type of current page * @return bool */ public function isFront() { $defId = $this->menu->getDefault()->id; $curId = 0; $active = $this->menu->getActive(); if ($active && $active->id) { $curId = $active->id; } return $defId == $curId; }
/** * buildFromView * * @param string $component * @param string $view * @param array $queries * @param boolean $replace * @param \JMenuSite $menu * */ protected static function buildFromView($component, $view, &$queries, &$replace, \JMenuSite $menu) { // Get all com_flower menus $menuItems = $menu->getItems('component', $component); // Find matched menu item. foreach ($menuItems as $menuItem) { if (isset($menuItem->query['view']) && $menuItem->query['view'] == $view) { // Replace core route rule. $replace = true; // Only return menu Itemid then Joomla will convert to menu alias $queries = array('Itemid' => $menuItem->id); } } // No menu matched, follows default rule. }
/** * Get default menu item to be shown up. * * @param JMenuSite $menu Joomla menu. * @param object $active Active menu item. * @param array $visited Already visited menu items. * * @return object|null */ protected function getDefaultMenuItem(JMenuSite $menu, $active, $visited = array()) { if (empty($active->query['defaultmenu']) || $active->id == $active->query['defaultmenu']) { // There is no highlighted menu item! return null; } $item = $menu->getItem($active->query['defaultmenu']); if (!$item) { // Menu item points to nowhere, abort! KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_EXISTS'), 'menu'); return null; } elseif (isset($visited[$item->id])) { // Menu loop detected, abort! KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_LOOP'), 'menu'); return null; } elseif (empty($item->component) || $item->component != 'com_kunena' || !isset($item->query['view'])) { // Menu item doesn't point to Kunena, abort! KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_KUNENA'), 'menu'); return null; } elseif ($item->query['view'] == 'home') { // Menu item is pointing to another Home Page, try to find default menu item from there. $visited[$item->id] = 1; $item = $this->getDefaultMenuItem($menu, $item->query['defaultmenu'], $visited); } return $item; }
/** * Constructor * * @param object $router The menu object to proxy * @return void */ public function __construct($menu) { parent::__construct($menu); }