public function LoadMenu($params = null) { if (PHP_MAJOR_VERSION <= 5 && PHP_MINOR_VERSION < 4) { $oMenuController = new MenuController(); $this->_components[self::NAVIGATION] = $oMenuController->LoadMenu($params); } else { $this->_components[self::NAVIGATION] = (new MenuController())->LoadMenu($params); } }
/** * Returms url location for IN "map". "map=0,0" - returns contemt of all menus + front page. * @param array $params * @return array - list of menus url */ public function GetMapLoc($params = null) { $arrSiteMap = array(); if (isset($params[self::MAP_PARAM])) { if ($params[self::MAP_PARAM] === "0,0") { /** * Get Home Page url */ $arrSiteMap[] = \RouterSettings::GetBaseUrl(); /** * Read all menu. */ $oMenuLoader = new MenuController(); $currentLocale = \Av\Localization\LocalizationController::GetCurrentLocale(); if ($currentLocale !== false) { $oAllMenus = $oMenuLoader->LoadMenu(array(\Av\Component\Menu\iMenuModelInterface::LOCALE => $currentLocale)); // $this->AddDebug(__METHOD__ . " #" . __LINE__ ." all menues" .print_r($oAllMenus,true)); foreach ($oAllMenus->GetCollection() as $x_y_arrMenu) { foreach ($x_y_arrMenu as $y_arrMenu) { foreach ($y_arrMenu as $oMenu) { if ($oMenu instanceof \Av\Component\Menu\MenuContainer) { // $this->AddDebug(__METHOD__ . " #" . __LINE__ ." oMenu" .print_r($oMenu,true)); $oResLink = $oMenu->GetMenuResLink(); // $this->AddDebug(__METHOD__ . " #" . __LINE__ ." ResLink" .print_r($oResLink,true)); if ($oResLink instanceof \Av\Res\ResContainer) { /** * check if it is absolute path - if not then add "base url" */ $this->AddDebug(__METHOD__ . " #" . __LINE__ . " Directory Separator:" . print_r(DIRECTORY_SEPARATOR, true)); $arrSiteMap[] = \Av\UrlControllerHelper::AsAbsoluteUrl($oResLink->GetMenuResValue()); } } } } } } } } return $arrSiteMap; }
public function GetMenuAction($params = null) { // $oMenuController = new \Av\Component\Menu\MenuController(); $arrMenu = \Av\Component\Menu\MenuController::Get(array(\Av\Component\Menu\MenuController::AS_ARRAY => true)); // $this->AddDebugAsObject($arrMenu, __METHOD__); $this->SetResponce($arrMenu); // $this->SetResponce(array( // array( // "label" =>"Home", // "url" => "/" // ), // array( // "label" =>"All Products", // "url" => "#/phones" // ) // )); }