public function Set($params) { $this->_current_url_no_lacate = \Av\UrlControllerHelper::BuildUrl($params); $params[self::COUNTRY_ID] = \Av\Localization\LocalizationController::GetLocale()->GetCountryId(); $params[self::LANGUAGE_ID] = \Av\Localization\LocalizationController::GetLocale()->GetLanguageId(); $this->_current_url = \Av\UrlControllerHelper::BuildUrl($params); }
/** * Slave function, called by BaseController from Dispatcher * @param arey $params * @return \Av\Component\ComponentsController */ public function LoadComponents($params = null) { /* * Get navigation */ $this->LoadMenu(array(\Av\Localization\iLocaleModelInterface::LOCALE => \Av\Localization\LocalizationController::GetLocale()->GetCurrentLocale())); return $this; }
public function AddMenuAction($params = null) { /* * Basic Model test. * Name is Menu item internal name */ // 1. create menu(s) if (!isset($params[self::POS_X]) || !isset($params[self::POS_Y]) || !isset($params[self::NAME])) { return false; } $locale = isset($params[ResContainer::LOCALE]) ? $params[ResContainer::LOCALE] : \Av\Localization\LocalizationController::GetLocale()->GetCurrentLocale(); $oMenuContainer = new MenuContainer(array(MenuContainer::TAG => empty($params[self::TAG]) ? '' : $params[self::TAG], MenuContainer::NAME => $params[self::NAME], MenuContainer::POS_X => $params[self::POS_X], MenuContainer::POS_Y => $params[self::POS_Y])); /* * add text resource (lable) to menu item. * PARAM_NAME is visiable menu lable, like "Home" */ if (isset($params[\Av\Res\iWebInterface::PARAM_NAME])) { $oMenuContainer->SetMenuRes(array(ResContainer::TYPE => \Av\Res\iResTypeInterface::SHORT_STR_NAME, ResContainer::VALUE => $params[\Av\Res\iWebInterface::PARAM_NAME], ResContainer::LOCALE => $locale)); } /* * add image resource ( inage id ) to menu item */ if (isset($params[\Av\Res\iWebInterface::PARAM_LINK])) { $oMenuContainer->SetMenuRes(array(ResContainer::TYPE => \Av\Res\iResTypeInterface::SHORT_STR_NAME, ResContainer::VALUE => $params[\Av\Res\iWebInterface::PARAM_LINK], ResContainer::LOCALE => $locale)); } /* * add video resource ( video id ) to menu item */ if (isset($params[\Av\Res\iWebInterface::PARAM_VIDEO_ID])) { $oMenuContainer->SetMenuRes(array(ResContainer::TYPE => \Av\Res\iResTypeInterface::SHORT_STR_NAME, ResContainer::VALUE => $params[\Av\Res\iWebInterface::PARAM_VIDEO_ID], ResContainer::LOCALE => $locale)); } /* * add link resource to menu item */ if (isset($params[\Av\Res\iWebInterface::PARAM_IMG_ID])) { $oMenuContainer->SetMenuRes(array(ResContainer::TYPE => \Av\Res\iResTypeInterface::LONG_STR_NAME, ResContainer::VALUE => $params[\Av\Res\iWebInterface::PARAM_LINK], ResContainer::LOCALE => $locale)); } $oMenu = new \Av\Component\Menu\MenuController(); $oMenu->AddMenu($oMenuContainer); }
public function GetMenu($param = null) { $arrLocale = \Av\Localization\LocalizationController::GetLocale()->GetMoreLanguages(); $base_url = \Av\DispatcherController::GetCurrentUrl()->GetCurrentUrlNoLocale(); $base_url_locale = \Av\DispatcherController::GetCurrentUrl()->GetCurrentUrlLocale(); $poz_x = $this->GetPozX(); $poz_y = $this->GetPozY(); $name = $this->GetPozName(); $name_space = $this->GetPozNamespace(); $oLanguageMenuCollaction = new \Av\Component\Menu\MenuCollectionContainer(); foreach ($arrLocale as $country_id => $languages) { foreach ($languages as $language_id => $language) { // $this->AddDebug(__METHOD__ . " #" .__LINE__ . " locale is :" . print_r($language,true)); /* * create base menu item */ $oLanguageMenu = new MenuContainer(array(MenuContainer::TAG => $name_space, MenuContainer::NAME => $name . "_" . $country_id . "_" . $language_id, MenuContainer::POS_X => $poz_x, MenuContainer::POS_Y => $poz_y)); /* * add text resource (lable) to menu item */ $oLanguageMenu->SetMenuRes(array(ResContainer::TYPE => 'text', ResContainer::VALUE => $language[LocalizationLocaleModel::COUNTRY_NAME] . " " . $language[LocalizationLocaleModel::LANGUAGE_NAME_SHORT], ResContainer::LOCALE => $language[LocalizationLocaleModel::LOCALE])); /* * add link resource to menu item */ $language_selection_url = DIRECTORY_SEPARATOR . $language[LocalizationLocaleModel::COUNTRY_ID] . DIRECTORY_SEPARATOR . $language[LocalizationLocaleModel::LANGUAGE_ID] . $base_url; $oLanguageMenu->SetMenuRes(array(ResContainer::TYPE => 'link', ResContainer::VALUE => $language_selection_url, ResContainer::LOCALE => $language[LocalizationLocaleModel::LOCALE])); $oLanguageMenu->SetSelected(array(MenuContainer::MENU_SELECTED => $language_selection_url == $base_url_locale)); /* * set "selected" is it is */ $oLanguageMenuCollaction->AddToCollection($name_space, $poz_x, $poz_y, $oLanguageMenu); $poz_y++; } } // $this->AddDebug(__METHOD__ . " #" .__LINE__ . " Base URL:" . print_r($base_url,true)); // $this->AddDebug(__METHOD__ . " #" .__LINE__ . " Base URL :" . print_r($base_url_locale,true)); // $this->AddDebug(__METHOD__ . " #" .__LINE__ . " Language Collection:" . print_r($oLanguageMenuCollaction,true)); return $oLanguageMenuCollaction; }
public static function &GetLocalization() { return \Av\Localization\LocalizationController::GetLocale(); }