/** * Helper-method to add all the submenu-items for this component * * @param null * @return null */ protected static function addMenuItems() { $menu = JToolBar::getInstance('submenu'); if (method_exists($menu, 'getItems')) { $currentItems = $menu->getItems(); } else { $currentItems = array(); } $items = array('home', 'config', 'stores', 'products', 'usergroups', 'connectors', 'urls', 'users', 'check', 'logs', 'update'); foreach ($items as $view) { // @todo: Integrate this with the abstract-helper // Skip this view, if it does not exist on the filesystem if (!is_dir(JPATH_COMPONENT . '/views/' . $view)) { continue; } // Skip this view, if ACLs prevent access to it if (MageBridgeAclHelper::isAuthorized($view, false) == false) { continue; } // Add the view $active = JFactory::getApplication()->input->getCmd('view') == $view ? true : false; $url = 'index.php?option=com_magebridge&view=' . $view; $title = JText::_('COM_MAGEBRIDGE_VIEW_' . $view); $alreadySet = false; foreach ($currentItems as $currentItem) { if ($currentItem[1] == $url) { $alreadySet = true; break; } } if ($alreadySet == false) { $menu->appendButton($title, $url, $active); } } return; }
*/ // No direct access defined('_JEXEC') or die('Restricted access'); // Load the libraries require_once JPATH_SITE . '/components/com_magebridge/helpers/loader.php'; require_once JPATH_COMPONENT . '/helpers/acl.php'; // If no view has been set, try the default if (JRequest::getCmd('view') == '') { JRequest::setVar('view', 'home'); } // Handle the SSO redirect if (JRequest::getInt('sso') == 1) { JRequest::setVar('task', 'ssoCheck'); } // Make sure the user is authorised to view this page if (MageBridgeAclHelper::isAuthorized() == false) { return false; } // Initialize debugging MagebridgeModelDebug::init(); // Require the current controller $view = JRequest::getCmd('view'); $controller_file = JPATH_COMPONENT . '/controllers/' . $view . '.php'; if (is_file($controller_file)) { require_once $controller_file; $controller_name = 'MageBridgeController' . ucfirst($view); $controller = new $controller_name(); } else { $controller = new MageBridgeController(); } // Perform the requested task
protected function addMenuItems() { $menu = JToolBar::getInstance('submenu'); $items = array('Home' => 'home', 'Configuration' => 'config', 'Store Relations' => 'stores', 'Product Relations' => 'products', 'Usergroup Relations' => 'usergroups', 'Connectors' => 'connectors', 'URL Replacements' => 'urls', 'Users' => 'users', 'System Check' => 'check', 'Logs' => 'logs', 'Update' => 'update'); foreach ($items as $title => $view) { // Skip this view, if it does not exist on the filesystem if (!is_dir(JPATH_COMPONENT . '/views/' . $view)) { continue; } // Skip this view, if ACLs prevent access to it if (MageBridgeAclHelper::isAuthorized($view, false) == false) { continue; } // Add the view $active = JRequest::getCmd('view') == $view ? true : false; $url = 'index.php?option=com_magebridge&view=' . $view; $menu->appendButton(JText::_($title), $url, $active); } return; }