public function LoadMenu($params = null) { $current_url = \Av\DispatcherController::GetCurrentUrl()->GetCurrentUrlLocale(); $oMenuMapper = new MenuModel(); $this->_menu_collection = $oMenuMapper->LoadMenu($params); if ($this->_menu_collection instanceof \Av\Component\Menu\MenuCollectionContainer) { $this->_menu_collection_array = array(); foreach ($this->_menu_collection->GetCollection() as $tag => $menu_x_y) { foreach ($menu_x_y as $x => $menu_y) { foreach ($menu_y as $y => $oMenu) { if ($oMenu instanceof \Av\Component\Menu\MenuContainer) { /** * 1. check if selected */ $currentRes = $oMenu->GetMenuRes(array(\Av\Component\Menu\MenuContainer::TYPE => self::TYPE_LINK)); $bSelected = false; if ($currentRes instanceof \Av\Res\ResContainer) { $value = $currentRes->GetResValue(); $bSelected = $value == $current_url; } $oMenu->SetSelected(array(self::MENU_SELECTED => $bSelected)); /** * 2. build if dynamic */ if (($oMenuDynamic = $oMenu->GetMenuDynamic()) instanceof \Av\Component\Menu\MenuClassMapContainer) { $dynamic_class = $oMenuDynamic->GetMenuClassName(); $dynamic_method = $oMenuDynamic->GetMenuMethodName(); $dynamicparams = $oMenuDynamic->GetMenuMethodParams(); if ($dynamic_class !== false && $dynamic_method !== false) { if (PHP_MAJOR_VERSION <= 5 && PHP_MINOR_VERSION < 4) { $oClass = new $dynamic_class($oMenu); $oMenuDinamicCollection = $oClass->{$dynamic_method}($dynamicparams); } else { $oMenuDinamicCollection = (new $dynamic_class($oMenu))->{$dynamic_method}($dynamicparams); } if ($oMenuDinamicCollection !== false) { $this->_menu_collection->ReplaceInCollection($tag, $x, $y, $oMenuDinamicCollection); } } } /* * 3. fill menu data as array */ $this->_menu_collection_array[$tag][$x][$y] = self::ResourceAsArray($oMenu); } } } } } // $this->AddDebugAsObject($this->_menu_collection_array, __METHOD__ . " # " . __LINE__ . "Menu Array: "); }