示例#1
0
 /**
  * Initialize menu object
  *
  * @return void
  */
 protected function _initMenu()
 {
     if (!$this->_menu) {
         $this->_menu = $this->_menuFactory->getMenuInstance();
         if ($this->_cache->canUse('config')) {
             $cache = $this->_cache->load(self::CACHE_MENU_OBJECT);
             if ($cache) {
                 $this->_menu->unserialize($cache);
                 return;
             }
         }
         /* @var $director Mage_Backend_Model_Menu_Builder */
         $menuBuilder = $this->_appConfig->getModelInstance('Mage_Backend_Model_Menu_Builder', array('menu' => $this->_menu, 'itemFactory' => $this->_appConfig->getModelInstance('Mage_Backend_Model_Menu_Item_Factory')));
         /* @var $director Mage_Backend_Model_Menu_Director_Dom */
         $director = $this->_appConfig->getModelInstance('Mage_Backend_Model_Menu_Director_Dom', array('config' => $this->_getDom(), 'factory' => $this->_appConfig, 'logger' => $this->_logger));
         $director->buildMenu($menuBuilder);
         $this->_menu = $menuBuilder->getResult();
         $this->_eventManager->dispatch('backend_menu_load_after', array('menu' => $this->_menu));
         if ($this->_cache->canUse('config')) {
             $this->_cache->save($this->_menu->serialize(), self::CACHE_MENU_OBJECT, array(Mage_Core_Model_Config::CACHE_TAG));
         }
     }
 }
示例#2
0
 public function __wakeup()
 {
     if (Mage::getIsSerializable()) {
         $this->_moduleHelper = Mage::helper($this->_moduleHelperName);
         $this->_validator = Mage::getSingleton('Mage_Backend_Model_Menu_Item_Validator');
         $this->_acl = Mage::getSingleton('Mage_Core_Model_Authorization');
         $this->_appConfig = Mage::getConfig();
         $this->_storeConfig = Mage::getSingleton('Mage_Core_Model_Store_Config');
         $this->_menuFactory = Mage::getSingleton('Mage_Backend_Model_Menu_Factory');
         $this->_urlModel = Mage::getSingleton('Mage_Backend_Model_Url');
         if ($this->_serializedSubmenu) {
             $this->_submenu = $this->_menuFactory->getMenuInstance();
             $this->_submenu->unserialize($this->_serializedSubmenu);
         }
     }
 }