/** * Admin UI Tabs * Gives A Tab Based Navigation Back And Loads The Templates With A Nice Design * @param $load_template = a key => value array. key = template name, value = Language File contraction * @params $cookieName = choose a cookiename or leave empty if you don't want cookie tabs in this place * @example 'shop' => 'COM_VIRTUEMART_ADMIN_CFG_SHOPTAB' */ public static function buildTabs($view, $load_template = array(), $cookieName = '') { $defaultTab = 'page-' . key($load_template); $defaultTab = JRequest::getcmd('lastTab', $defaultTab); $app = JFactory::getApplication(); if ($lastTab = $app->getUserState("com_virtuemart.lasttab")) { $defaultTab = $lastTab; $app->setUserState("com_virtuemart.lasttab", null); } $cookieName = JRequest::getWord('view', 'virtuemart') . $cookieName; $html = JHtml::_('bootstrap.startTabSet', $cookieName, array('active' => $defaultTab)); // $html = JHtml::_('bootstrap.startTabSet', $cookieName); foreach ($load_template as $tab_content => $tab_title) { $html .= JHtml::_('bootstrap.addTab', $cookieName, 'page-' . $tab_content, JText::_($tab_title, true)); // $html .= '<div class="tabs" title="' . JText::_ ( $tab_title ) . '">'; $html .= $view->loadTemplate($tab_content); $html .= JHtml::_('bootstrap.endTab'); } $html .= JHtml::_('bootstrap.endTabSet'); echo $html; echo '<input id="lastTab" type="hidden" name="lastTab" value="' . $defaultTab . '">'; $document = JFactory::getDocument(); $document->addScriptDeclaration(' jQuery( function($) { $( "#adminForm" ).delegate( "#' . $cookieName . 'Tabs a", "click", function(){ var href = this.href, from = href.lastIndexOf("#") + 1, last = href.substring(from); $("#lastTab").val(last); }); }); '); }
$extension = 'com_onepage'; $lang->load($extension, JPATH_ADMINISTRATOR, 'en-GB'); $tag = $lang->getTag(); if (file_exists(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR . $tag . DIRECTORY_SEPARATOR . $tag . '.com_onepage.ini')) { $lang->load('com_onepage', JPATH_ADMINISTRATOR, $tag, true, true); } //get base controller require_once JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'controllerBase.php'; //get query variables $cmd = JRequest::getCmd('task', 'display'); $task = JRequest::getCmd('task', 'display'); // will set default holder if (file_exists(JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR . 'config.php')) { $controller = JRequest::getCmd('view', 'config'); } else { $controller = JRequest::getcmd('view', 'orders'); } //echo $controller; die(); $controllerPath = JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR . $controller . '.php'; if (file_exists($controllerPath)) { require_once $controllerPath; } else { JError::raiseError(500, 'Invalid Controller'); } $controllerClass = 'JController' . ucfirst($controller); if (class_exists($controllerClass)) { $controller = new $controllerClass(); } else { JError::raiseError(500, 'Invalid Controller Class'); echo 'Invalid controller class'; $app = JFactory::getApplication();
public function getSideMenuHTML() { $menus = array(array('title' => JText::_('COM_COMMUNITY_DASHBOARD'), 'url' => 'index.php?option=com_community', 'class' => 'js-icon-dashboard', 'children' => array()), array('title' => JText::_('COM_COMMUNITY_TITLE_MONITOR'), 'url' => '#', 'class' => 'js-icon-desktop', 'children' => array(array('title' => JText::_('COM_COMMUNITY_ACTIVITIES'), 'url' => 'index.php?option=com_community&view=activities'), array('title' => JText::_('COM_COMMUNITY_MEMBERS'), 'url' => 'index.php?option=com_community&view=users'), array('title' => JText::_('COM_COMMUNITY_REPORTS'), 'url' => 'index.php?option=com_community&view=reports'), array('title' => JText::_('COM_COMMUNITY_MAIL_QUEUE'), 'url' => 'index.php?option=com_community&view=mailqueue'))), array('title' => JText::_('COM_COMMUNITY_TOOLBAR_APPEARANCE'), 'url' => '#', 'class' => 'js-icon-cogs', 'children' => array(array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_THEME_COLORS'), 'url' => 'index.php?option=com_community&view=themecolors'), array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_THEME_GENERAL'), 'url' => 'index.php?option=com_community&view=themegeneral'), array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_THEME_PROFILE'), 'url' => 'index.php?option=com_community&view=themeprofile'), array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_THEME_GROUPS'), 'url' => 'index.php?option=com_community&view=themegroups'), array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_THEME_EVENTS'), 'url' => 'index.php?option=com_community&view=themeevents'), array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_MOODS'), 'url' => 'index.php?option=com_community&view=moods'), array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_BADGES'), 'url' => 'index.php?option=com_community&view=badges'))), array('title' => JText::_('COM_COMMUNITY_TOOLBAR_CONFIGURATION'), 'url' => '#', 'class' => 'js-icon-cogs', 'children' => array(array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_SITE_TOOLBAR'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=site'), array('title' => JText::_('COM_COMMUNITY_TITLE_ANTISPAM'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=daily-limits'), array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_LAYOUT_TOOLBAR'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=layout'), array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_PRIVACY'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=privacy'), array('title' => JText::_('COM_COMMUNITY_USERPOINTS'), 'url' => 'index.php?option=com_community&view=userpoints'), array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_REMOTE_TOOLBAR'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=remote-storage'), array('title' => JText::_('COM_COMMUNITY_CONFIGURATION_INTEGRATIONS_TOOLBAR'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=integrations'), array('title' => JText::_('COM_COMMUNITY_TEMPLATES'), 'url' => 'index.php?option=com_community&view=templates'))), array('title' => JText::_('COM_COMMUNITY_TITLE_PROFILES'), 'url' => '#', 'class' => 'js-icon-edit', 'children' => array(array('title' => JText::_('COM_COMMUNITY_MULTIPLE_PROFILES'), 'url' => 'index.php?option=com_community&view=multiprofile'), array('title' => JText::_('COM_COMMUNITY_CUSTOM_PROFILES'), 'url' => 'index.php?option=com_community&view=profiles'))), array('title' => JText::_('COM_COMMUNITY_GROUPS'), 'url' => '#', 'class' => 'js-icon-group', 'children' => array(array('title' => JText::_('COM_COMMUNITY_TITLE_GROUP_VIEW'), 'url' => 'index.php?option=com_community&view=groups'), array('title' => JText::_('COM_COMMUNITY_GROUP_CATEGORIES'), 'url' => 'index.php?option=com_community&view=groupcategories'), array('title' => JText::_('COM_COMMUNITY_TITLE_GROUP_SETTING'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=group'))), array('title' => JText::_('COM_COMMUNITY_EVENTS'), 'url' => '#', 'class' => 'js-icon-calendar', 'children' => array(array('title' => JText::_('COM_COMMUNITY_TITLE_EVENT_VIEW'), 'url' => 'index.php?option=com_community&view=events'), array('title' => JText::_('COM_COMMUNITY_EVENT_CATEGORIES'), 'url' => 'index.php?option=com_community&view=eventcategories'), array('title' => JText::_('COM_COMMUNITY_TITLE_EVENT_SETTING'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=event'))), array('title' => JText::_('COM_COMMUNITY_PHOTOS'), 'url' => '#', 'class' => 'js-icon-camera', 'children' => array(array('title' => JText::_('COM_COMMUNITY_TITLE_PHOTO_VIEW'), 'url' => 'index.php?option=com_community&view=photos'), array('title' => JText::_('COM_COMMUNITY_TITLE_PHOTO_SETTING'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=photo'))), array('title' => JText::_('COM_COMMUNITY_VIDEOS'), 'url' => '#', 'class' => 'js-icon-film', 'children' => array(array('title' => JText::_('COM_COMMUNITY_TITLE_VIDEO_VIEW'), 'url' => 'index.php?option=com_community&view=videos'), array('title' => JText::_('COM_COMMUNITY_TOOLBAR_VIDEO_CATEGORIES'), 'url' => 'index.php?option=com_community&view=videoscategories'), array('title' => JText::_('COM_COMMUNITY_TITLE_VIDEO_SETTING'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=video'))), array('title' => JText::_('COM_COMMUNITY_APPLICATIONS'), 'url' => 'index.php?option=com_community&view=applications', 'class' => 'js-icon-briefcase', 'children' => array()), array('title' => JText::_('COM_COMMUNITY_TITLE_TOOL'), 'url' => '#', 'class' => 'js-icon-bolt', 'children' => array(array('title' => JText::_('COM_COMMUNITY_MESSAGING_MASS'), 'url' => 'index.php?option=com_community&view=messaging'), array('title' => JText::_('COM_COMMUNITY_TROUBLESHOOTING'), 'url' => 'index.php?option=com_community&view=troubleshoots'), array('title' => JText::_('COM_COMMUNITY_UPDATE'), 'url' => 'index.php?option=com_community&view=update'))), array('title' => JText::_('COM_COMMUNITY_HELP'), 'url' => '#', 'class' => 'js-icon-info-sign', 'children' => array(array('title' => JText::_('COM_COMMUNITY_DOC'), 'url' => 'http://documentation.jomsocial.com'), array('title' => JText::_('COM_COMMUNITY_TITLE_ADDONS'), 'url' => 'http://www.jomsocial.com/addons'), array('title' => JText::_('COM_COMMUNITY_ABOUT'), 'url' => 'index.php?option=com_community&view=about'), array('title' => JText::_('COM_COMMUNITY_TITLE_SUPPORT'), 'url' => 'http://www.jomsocial.com/support')))); $view = JRequest::getcmd('view'); $cfgSection = JRequest::getcmd('cfgSection', ''); $cfgSection = !empty($cfgSection) ? '&cfgSection=' . $cfgSection : ''; $html = '<ul class="nav nav-list">' . PHP_EOL; $helpArray = array(JText::_('COM_COMMUNITY_DOC') => 1, JText::_('COM_COMMUNITY_TITLE_ADDONS') => 1, JText::_('COM_COMMUNITY_TITLE_SUPPORT') => 1, JText::_('COM_COMMUNITY_ABOUT') => 0); foreach ($menus as $menu) { $hasChildren = !empty($menu['children']); $dropdownToggleClass = $hasChildren ? 'dropdown-toggle' : ''; $isOpen = false; $current = ''; if ($hasChildren) { foreach ($menu['children'] as $child) { if ($child['url'] == 'index.php?option=com_community&view=' . $view . $cfgSection) { $isOpen = true; $current = $child['url']; break; } } } else { if ($menu['url'] == 'index.php?option=com_community&view=' . $view) { $isOpen = true; } } $openClass = $isOpen ? 'open' : ''; $openSubStyle = $isOpen ? 'display: block;' : ''; $html .= '<li class="' . $openClass . '"><a href="' . JRoute::_($menu['url']) . '" class="' . $dropdownToggleClass . '">'; $html .= '<i class="' . $menu['class'] . '"></i> <span class="menu-text"> ' . $menu['title'] . ' </span>'; if ($hasChildren) { $html .= '<b class="arrow js-icon-angle-down"></b>'; } $html .= '</a>'; if ($hasChildren) { $html .= PHP_EOL . '<ul class="submenu" style="' . $openSubStyle . '">' . PHP_EOL; foreach ($menu['children'] as $child) { $target = ''; if ($menu['title'] == 'Help' && $helpArray[$child['title']]) { $target = 'target="_blank"'; } $submenuStyle = $current == $child['url'] ? 'class="active"' : ''; $html .= '<li ' . $submenuStyle . '><a ' . $target . ' href="' . JRoute::_($child['url']) . '">'; $html .= '<i class="js-icon-double-angle-right"></i> <span class="menu-text"> ' . $child['title'] . ' </span>'; $html .= '</a></li>'; } $html .= '</ul>' . PHP_EOL; } $html .= '</li>' . PHP_EOL; } $html .= '</ul>' . PHP_EOL; return $html; }