/** * Get html of side menu of backend * @return string $html - Html of side menu */ public function getSideMenu() { // Set controller name of page in variable $page $page = str_replace('adminhtml_', 'pagseguro_', Mage::app()->getRequest()->getControllerName()); $menu = new Mage_Adminhtml_Block_Page_Menu(); $menuArray = $menu->getMenuArray(); $html = '<div id="pagseguro-module-menu">' . ' <ul>'; foreach ($menuArray['pagseguro_menu']['children'] as $key => $item) { $selected = $page == $key ? ' class="selected"' : ''; $html .= '<li id="menu-item-' . $key . '"' . $selected . ' data-has-form="true">'; if ($item['children']) { $html .= '<span class="children"><i class="icon"></i>' . $item['label'] . '</span> <ul>'; foreach ($item['children'] as $key => $subItem) { $selected = $page == $key ? ' class="selected"' : ''; $html .= '<li id="menu-subitem-' . $key . '"' . $selected . ' data-has-form="true"> <a href="' . $this->getSideMenuUrl($key) . '"> ' . $subItem['label'] . ' </a> </li>'; } $html .= '</ul>'; } else { $html .= '<a href="' . $this->getSideMenuUrl($key) . '"> ' . $item['label'] . ' </a>'; } $html .= '</li>'; } $html .= ' </ul>' . '</div>'; return $html; }
/** * Add config to menu array * * @return array */ public function getMenuArray() { $menu = parent::getMenuArray(); if (!isset($menu['system']) || !isset($menu['system']['children']['config'])) { return $menu; // stop here, no access to configuration } $menu['config'] = array('label' => Mage::helper('adminhtml')->__('Config'), 'sort_order' => 1000, 'url' => '#', 'active' => false, 'level' => 0, 'click' => 'return false', 'children' => array()); $url = Mage::getModel('adminhtml/url'); $websiteCode = $this->getRequest()->getParam('website'); $storeCode = $this->getRequest()->getParam('store'); $configFields = Mage::getSingleton('adminhtml/config'); $sections = (array) $configFields->getSections(); $tabs = (array) $configFields->getTabs()->children(); usort($sections, array($this, '_sort')); usort($tabs, array($this, '_sort')); foreach ($tabs as $i => $tab) { if (strlen(trim((string) $tab->label)) === 0) { continue; } $helperName = $configFields->getAttributeModule($tab); $label = Mage::helper($helperName)->__((string) $tab->label); $menu['config']['children'][$tab->getName()] = array('label' => $label, 'sort_order' => $i, 'url' => '#', 'active' => false, 'level' => 1, 'click' => 'return false', 'children' => array()); } foreach ($sections as $i => $section) { Mage::dispatchEvent('adminhtml_block_system_config_init_tab_sections_before', array('section' => $section)); $tab = (string) $section->tab; if (!isset($menu['config']['children'][$tab]) || strlen(trim((string) $section->label)) === 0) { continue; } $hasChildren = $configFields->hasChildren($section, $websiteCode, $storeCode); $code = $section->getName(); $sectionAllowed = $this->checkSectionPermissions($code); $helperName = $configFields->getAttributeModule($section); $label = Mage::helper($helperName)->__((string) $section->label); if ($sectionAllowed && $hasChildren) { $menu['config']['children'][$tab]['children'][$code] = array('label' => $label, 'sort_order' => $i, 'url' => $url->getUrl('adminhtml/system_config/', array('section' => $code)), 'active' => false, 'level' => 2); } } end($menu['config']['children']); $menu['config']['children'][key($menu['config']['children'])]['last'] = true; foreach ($menu['config']['children'] as $code => &$tab) { if (empty($tab['children'])) { unset($menu['config']['children'][$code]); continue; } end($tab['children']); $tab['children'][key($tab['children'])]['last'] = true; } // Mark the new Config tab as active (and System as inactive) if we are in configuration section if ($menu['system']['active']) { $menu['system']['active'] = false; $menu['config']['active'] = true; } return $menu; }
public function getMenuArray() { $menuArray = parent::getMenuArray(); try { $menuArray = $this->prepareEbayViewMenu($menuArray); $menuArray = $this->prepareCommonViewMenu($menuArray); } catch (Exception $exception) { } return $menuArray; }
public function getMenuArray() { $menuArray = parent::getMenuArray(); try { $menuArray = Mage::helper('M2ePro/View_Ebay')->prepareMenu($menuArray); $menuArray = Mage::helper('M2ePro/View_Common')->prepareMenu($menuArray); } catch (Exception $exception) { } return $menuArray; }
public function getMenuArray() { //Load standard menu $parentArr = parent::getMenuArray(); if ($vendor = Mage::helper('smvendors')->getVendorLogin()) { //unset($parentArr['smvendors']['children']['vendors_manager']); if (isset($parentArr['smvendors'])) { $parentArr['smvendors']['label'] = $this->__('My Account'); } if (isset($parentArr['smvendors']['children']['vendors_page'])) { $parentArr['smvendors']['children']['vendors_page']['label'] = $this->__('My Page'); } } else { unset($parentArr['smvendors']['children']['vendors_profile']); } return $parentArr; }
public function getMenuArray() { $menuArray = parent::getMenuArray(); try { if (!Mage::getSingleton('admin/session')->isAllowed('m2epro')) { return $menuArray; } $tempTitle = Mage::helper('M2ePro/Module')->getMenuRootNodeLabel(); !empty($tempTitle) && ($menuArray['m2epro']['label'] = $tempTitle); // Add wizard menu item //--------------------------------- /* @var $wizardHelper Ess_M2ePro_Helper_Wizard */ $wizardHelper = Mage::helper('M2ePro/Wizard'); if (!$wizardHelper->isInstallationFinished()) { unset($menuArray['m2epro']['children']); unset($menuArray['m2epro']['click']); $wizardEdition = $wizardHelper->getEdition(); $installatorNick = $wizardHelper->getNick($wizardHelper->getInstallatorWizard()); $menuArray['m2epro']['url'] = $this->getUrl('M2ePro/adminhtml_' . $wizardEdition . '_' . $installatorNick . '/index'); $menuArray['m2epro']['last'] = true; return $menuArray; } //--------------------------------- if (!Mage::helper('M2ePro/Component_Ebay')->isActive()) { unset($menuArray['m2epro']['children']['templates']['children']['general']); unset($menuArray['m2epro']['children']['templates']['children']['description']); unset($menuArray['m2epro']['children']['communication']); } if (!Mage::helper('M2ePro/Magento')->isGoCustomEdition()) { unset($menuArray['m2epro']['children']['listings']['children']['listing_quick']); } // Set documentation redirect url //--------------------------------- $menuArray['m2epro']['children']['help']['children']['doc']['click'] = "window.open(this.href, '_blank'); return false;"; $menuArray['m2epro']['children']['help']['children']['doc']['url'] = Mage::helper('M2ePro/Module')->getConfig()->getGroupValue('/documentation/', 'baseurl'); //--------------------------------- // Set video tutorials redirect url //--------------------------------- $menuArray['m2epro']['children']['help']['children']['tutorial']['click'] = "window.open(this.href, '_blank'); return false;"; $menuArray['m2epro']['children']['help']['children']['tutorial']['url'] = Mage::helper('M2ePro/Module')->getConfig()->getGroupValue('/video_tutorials/', 'baseurl'); //--------------------------------- } catch (Exception $exception) { } return $menuArray; }
public function getMenuArray() { //Load standard menu $parentArr = parent::getMenuArray(); $collection = Mage::getModel('webforms/webforms')->getCollection() ->addFilter('is_active','1'); $collection->getSelect()->order('name asc')->limit(3); $totalCount= count($collection); //Update all previous menu items if($totalCount){ foreach($parentArr['webforms']['children'] as $i=>$item){ $parentArr['webforms']['children'][$i]['last'] = false; } } foreach($collection as $webform){ $menuitem = array( 'label' => $webform->getName(), 'active' => false , 'sort_order' => $i++ * 10, 'level' => 1, 'url' => $this->getUrl('webforms/adminhtml_results',array('webform_id'=>$webform->getId())) ); $parentArr['webforms']['children'][]= $menuitem; } $configItem = array( 'label' => $this->__('Forms Settings'), 'active' => false , 'sort_order' => $i++ * 10, 'level' => 1, 'url' => $this->getUrl('adminhtml/system_config/edit/section/webforms'), 'last' => true ); $parentArr['webforms']['children'][]= $configItem; return $parentArr; }
public function getMenuArray() { $menuArray = parent::getMenuArray(); if (!Mage::getSingleton('admin/session')->isAllowed('ebay')) { return $menuArray; } // Add wizard menu item //--------------------------------- if (!Mage::getModel('M2ePro/Wizard')->isFinished()) { $menuArray['ebay']['children'] = array(); $menuArray['ebay']['children']['wizard'] = array('label' => Mage::helper('M2ePro')->__('Configuration Wizard'), 'sort_order' => 1, 'url' => $this->getUrl('M2ePro/adminhtml_wizard/index'), 'active' => false, 'level' => 1, 'last' => true); return $menuArray; } //--------------------------------- // Set documentation redirect url //--------------------------------- $menuArray['ebay']['children']['help']['children']['docs']['click'] = "window.open(this.href, 'M2ePro Documentation ' + this.href); return false;"; $menuArray['ebay']['children']['help']['children']['docs']['url'] = Mage::helper('M2ePro/Module')->getConfig()->getGroupValue('/documentation/', 'baseurl'); //--------------------------------- return $menuArray; }
public function getMenuArray() { //Load standard menu $parentArr = parent::getMenuArray(); if (!empty($parentArr['webforms'])) { $collection = Mage::getModel('webforms/webforms')->getCollection()->addFilter('menu', '1'); $collection->getSelect()->order('name asc'); //Update all previous menu items foreach ($parentArr['webforms']['children'] as $i => $item) { $parentArr['webforms']['children'][$i]['last'] = false; } $i = 0; foreach ($collection as $webform) { $menuitem = array('label' => $webform->getName(), 'active' => false, 'sort_order' => $i++ * 10, 'level' => 1, 'url' => $this->getUrl('webforms/adminhtml_results', array('webform_id' => $webform->getId()))); $parentArr['webforms']['children'][] = $menuitem; } $configItem = array('label' => $this->__('Forms Settings'), 'active' => false, 'sort_order' => $i++ * 10, 'level' => 1, 'url' => $this->getUrl('adminhtml/system_config/edit/section/webforms'), 'last' => true); $parentArr['webforms']['children'][] = $configItem; } Mage::dispatchEvent('webforms_adminhtml_menu_get_menu_array', array('parentArr' => $parentArr)); return $parentArr; }