/** * Render the menubar * * @param array An optional array with configuration options * @return string Html */ public function render($config = array()) { $config = new KConfig($config); $config->append(array('menubar' => null)); if (version_compare(JVERSION, '3.0', 'ge') && class_exists('JSubmenuHelper')) { foreach ($config->menubar->getCommands() as $command) { JSubmenuHelper::addEntry($this->translate($command->label), $command->href, $command->active); } return; } $html = ''; if (version_compare(JVERSION, '1.7', 'ge')) { $html .= '<div id="submenu-box"><div class="m">'; } $html .= '<ul id="submenu">'; foreach ($config->menubar->getCommands() as $command) { $html .= '<li>'; $html .= $this->command(array('command' => $command)); $html .= '</li>'; } $html .= '</ul>'; if (version_compare(JVERSION, '1.7', 'ge')) { $html .= '<div class="clr"></div></div></div>'; } return $html; }
/** * Render the menu bar * * @param array $config An optional array with configuration options * @return string Html */ public function render($config = array()) { $config = new KObjectConfigJson($config); $config->append(array('toolbar' => null)); foreach ($config->toolbar->getCommands() as $command) { if (!empty($command->href)) { $command->href = $this->getTemplate()->route($command->href); } JSubmenuHelper::addEntry($this->getObject('translator')->translate($command->label), $command->href, $command->active); } return ''; }
<?php // No direct access to this file defined('_JEXEC') or die('Restricted access'); /* jimport('joomla.application.component.controller'); jimport('joomla.version'); */ if (!JFactory::getUser()->authorise('core.manage', 'com_braftonarticles')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $jinput = JFactory::getApplication()->input; $view = strtolower($jinput->get('view', 'options')); $task = $jinput->get('task'); JSubMenuHelper::addEntry('General Settings', 'index.php?option=com_braftonarticles', $view == 'options'); JSubmenuHelper::addEntry('Video Settings', 'index.php?option=com_braftonarticles&view=options_video', $view == 'options_video'); JSubMenuHelper::addEntry('Import Log', 'index.php?option=com_braftonarticles&view=log', $view == 'log'); $controller = JControllerLegacy::getInstance('BraftonArticles'); $controller->execute(JRequest::getCmd('task')); // Redirect if set by the controller $controller->redirect();