Exemplo n.º 1
0
 /**
  * Returns the instance of menu. Subsequent calls return the same object.
  *
  * @return OA_Admin_Menu
  */
 function &singleton()
 {
     $accountType = OA_Permission::getAccountType();
     if (isset($GLOBALS['_MAX']['MENU_OBJECT'][$accountType])) {
         $oMenu =& $GLOBALS['_MAX']['MENU_OBJECT'][$accountType];
     } elseif ($GLOBALS['_MAX']['CONF']['debug']['production'] != 0 && ($oMenu = OA_Admin_Menu::_loadFromCache($accountType))) {
         $GLOBALS['_MAX']['MENU_OBJECT'][$accountType] =& $oMenu;
     } else {
         $oMenu = new OA_Admin_Menu();
         if (empty($oMenu->aAllSections)) {
             include_once MAX_PATH . '/lib/OA/Admin/Menu/config.php';
             $oMenu = _buildNavigation(OA_Permission::getAccountType());
         }
         require_once LIB_PATH . '/Plugin/ComponentGroupManager.php';
         $oPluginManager = new OX_Plugin_ComponentGroupManager();
         $oPluginManager->mergeMenu($oMenu, $accountType);
         $GLOBALS['_MAX']['MENU_OBJECT'][$accountType] =& $oMenu;
         $oMenu->_saveToCache($accountType);
     }
     // Filter against user-account-preferences...
     return $oMenu;
 }