public function display() { $menu = JFactory::getApplication()->getMenu(); $this->module->params->menutype = $this->module->params->menu; $this->module->params->endLevel = 2; $this->module->params->showAllChildren = true; $this->assign('menu', ModMenuHelper::getList($this->module->params)); $this->assign('active', $menu->getActive()); $this->assign('lang', JFactory::getLanguage()); $this->assign('template', JFactory::getDocument()->template); $this->assign('params', $this->module->params); return parent::display(); }
protected function createDefaultSitemap() { $db = JFactory::getDbo(); // Check if we have any sitemap, otherwise lets create a default one $query = $db->getQuery(true)->select('COUNT(*)')->from('#__osmap_sitemap'); $db->setQuery($query); $noSitemaps = (int) $db->loadResult() === 0; if ($noSitemaps) { // Get all menus $menus = ModMenuHelper::getMenus(); if (!empty($menus)) { $selections = new stdClass(); $i = 0; foreach ($menus as $menu) { $selection = new stdClass(); $selection->priority = 0.5; $selection->changefreq = 'weekly'; $selection->ordering = $i++; $selections->{$menu->menutype} = $selection; } $attribs = new stdClass(); $attribs->showintro = "1"; $attribs->show_menutitle = "1"; $attribs->classname = ""; $attribs->columns = ""; $attribs->exlinks = "img_blue.gif"; $attribs->compress_xml = "1"; $attribs->beautify_xml = "1"; $attribs->include_link = "1"; $attribs->news_publication_name = ""; $config = JFactory::getConfig(); $data = array('title' => 'Sitemap', 'alias' => 'sitemap', 'attribs' => json_encode($attribs), 'selections' => json_encode($selections), 'is_default' => 1, 'state' => 1, 'access' => (int) $config->get('access', 1)); JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_osmap/tables'); $table = JTable::getInstance('Sitemap', 'OSMapTable'); $table->bind($data); $table->store(); } } }
if ($createContent) { $menu->addChild(new JMenuNode(JText::_('MOD_MENU_COM_CONTENT_NEW_CATEGORY'), 'index.php?option=com_categories&task=category.add&extension=com_content', 'class:newarticle')); $menu->getParent(); } $menu->addChild(new JMenuNode(JText::_('MOD_MENU_COM_CONTENT_FEATURED'), 'index.php?option=com_content&view=featured', 'class:featured')); if ($user->authorise('core.manage', 'com_media')) { $menu->addSeparator(); $menu->addChild(new JMenuNode(JText::_('MOD_MENU_MEDIA_MANAGER'), 'index.php?option=com_media', 'class:media')); } $menu->getParent(); } /* * Components Submenu */ // Get the authorised components and sub-menus. $components = ModMenuHelper::getComponents(true); // Check if there are any components, otherwise, don't render the menu if ($components) { $menu->addChild(new JMenuNode(JText::_('MOD_MENU_COMPONENTS'), '#'), true); foreach ($components as &$component) { if (!empty($component->submenu)) { // This component has a db driven submenu. $menu->addChild(new JMenuNode($component->text, $component->link, $component->img), true); foreach ($component->submenu as $sub) { $menu->addChild(new JMenuNode($sub->text, $sub->link, $sub->img)); } $menu->getParent(); } else { $menu->addChild(new JMenuNode($component->text, $component->link, $component->img)); } }
<?php /** * @package Joomla.Site * @subpackage mod_menu * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Include the syndicate functions only once require_once __DIR__ . '/helper.php'; $list = ModMenuHelper::getList($params); $base = ModMenuHelper::getBase($params); $active = ModMenuHelper::getActive($params); $active_id = $active->id; $path = $base->tree; $showAll = $params->get('showAllChildren'); $class_sfx = htmlspecialchars($params->get('class_sfx')); if (count($list)) { require JModuleHelper::getLayoutPath('mod_menu', $params->get('layout', 'default')); }
<?php /** * @package Joomla.Site * @subpackage mod_menu * * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Include the menu functions only once require_once __DIR__ . '/helper.php'; $list = ModMenuHelper::getList($params); $base = ModMenuHelper::getBase($params); $active = ModMenuHelper::getActive($params); $default = ModMenuHelper::getDefault(); $active_id = $active->id; $default_id = $default->id; $path = $base->tree; $showAll = $params->get('showAllChildren'); $class_sfx = htmlspecialchars($params->get('class_sfx'), ENT_COMPAT, 'UTF-8'); if (count($list)) { require JModuleHelper::getLayoutPath('mod_menu', $params->get('layout', 'default')); }
} } } $menu->getParent(); /* * Menus Submenu */ if ($user->authorise('core.manage', 'com_menus')) { $menu->addChild(new JMenuNode(JText::_('MOD_MENU_MENUS'), '#', $enabled ? '' : 'disabled'), true); $createMenu = $shownew && $user->authorise('core.create', 'com_menus'); if ($enabled) { $menu->addChild(new JMenuNode(JText::_('MOD_MENU_MENU_MANAGER'), 'index.php?option=com_menus&view=menus', 'class:menumgr'), $createMenu); $menu->getParent(); $menu->addSeparator(); // Menu Types foreach (ModMenuHelper::getMenus() as $menuType) { $alt = '*' . $menuType->sef . '*'; if ($menuType->home == 0) { $titleicon = ''; } elseif ($menuType->home == 1 && $menuType->language == '*') { $titleicon = ' <i class="icon-home"></i>'; } elseif ($menuType->home > 1) { $titleicon = ' <span>' . JHtml::_('image', 'mod_languages/icon-16-language.png', $menuType->home, array('title' => JText::_('MOD_MENU_HOME_MULTIPLE')), true) . '</span>'; } else { $image = JHtml::_('image', 'mod_languages/' . $menuType->image . '.gif', null, null, true, true); if (!$image) { $image = JHtml::_('image', 'mod_languages/icon-16-language.png', $alt, array('title' => $menuType->title_native), true); } else { $image = JHtml::_('image', 'mod_languages/' . $menuType->image . '.gif', $alt, array('title' => $menuType->title_native), true); } $titleicon = ' <span>' . $image . '</span>';
/** * doRender * * @param string $menutype * * @return void */ public static function doRender($menutype) { include_once JPATH_ROOT . '/modules/mod_menu/helper.php'; $params = new \JRegistry(); $params->set('menutype', $menutype); $params->set('showAllChildren', true); $items = \ModMenuHelper::getList($params); $active = \ModMenuHelper::getActive($params); $active_id = $active->id; $path = $active->tree; self::renBegin(1); foreach ($items as $i => &$item) { $class = 'item-' . $item->id; if ($item->id == $active_id) { $class .= ' current'; } if ($item->type == 'alias' && in_array($item->params->get('aliasoptions'), $path) || in_array($item->id, $path)) { $class .= ' active'; } if ($item->deeper) { $class .= $item->level < 2 ? ' dropdown' : ' dropdown-submenu'; } elseif ($item->deeper) { $class .= ' deeper'; } if ($item->parent) { $class .= ' parent'; } if (!empty($class)) { $class = ' class="' . trim($class) . '"'; } echo '<li' . $class . '>'; // Render the menu item. switch ($item->type) { case 'separator': $item->flink = '#'; require __DIR__ . '/Type/component.php'; break; case 'url': case 'component': require __DIR__ . '/Type/' . $item->type . '.php'; break; default: require __DIR__ . '/Type/url.php'; break; } // The next item is deeper. if ($item->deeper) { if ($item->level < 2) { echo '<ul class="dropdown-menu">'; } else { echo '<ul class="dropdown-menu">'; } } elseif ($item->deeper) { echo '<ul>'; } elseif ($item->shallower) { echo '</li>'; echo str_repeat('</ul></li>', $item->level_diff); } else { echo '</li>'; } } self::renEnd(); }