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);
 }
Esempio n. 2
0
 /**
  * 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;
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 /**
  * 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 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;
 }
Esempio n. 6
0
 public static function &GetLocalization()
 {
     return \Av\Localization\LocalizationController::GetLocale();
 }