Beispiel #1
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         $ssaml = new SimpleSAML_Auth_Simple('default-sp');
         $attributes = $ssaml->getAttributes();
         if ($this->getUser()->isFirstRequest()) {
             if (array_key_exists('preferredLanguage', $attributes)) {
                 $culture = $attributes['preferredLanguage'];
                 if ($culture != 'hu' && $culture != 'en') {
                     $culture = $request->getPreferredCulture(array('en', 'hu'));
                 }
             } else {
                 $culture = $request->getPreferredCulture(array('en', 'hu'));
             }
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
         $this->redirect('localized_homepage');
     }
     $p = Doctrine::getTable('Principal')->findOneByFedid($this->getUser()->getUsername());
     if ($p) {
         $oos = $p->getOrganization();
         $ros = $p->getRelatedOrganizations(TRUE);
     } else {
         $p = new Principal();
         $p->setFedid($this->getUser()->getUsername());
         $p->save();
     }
     $this->oos = $oos;
     $this->ros = $ros;
 }
Beispiel #2
0
 public function executeSwitch(sfWebRequest $request)
 {
     $referer = $request->getReferer();
     if ($request->hasParameter("lang")) {
         $lang = $request->getParameter('lang');
     } else {
         $lang = $request->getPreferredCulture(array('en', 'hu'));
     }
     if ($lang != 'en' && $lang != 'hu') {
         $lang = $request->getPreferredCulture(array('en', 'hu'));
     }
     $this->getUser()->setCulture($lang);
     $pos = strpos($referer, '/hu/');
     if ($pos === false) {
         $pos = strpos($referer, '/en/');
         if ($pos === false) {
             $whereto = false;
         } else {
             $eleje = substr($referer, 0, $pos);
             $whereto = substr($referer, $pos + 4);
         }
     } else {
         $eleje = substr($referer, 0, $pos);
         $whereto = substr($referer, $pos + 4);
     }
     if (!$whereto) {
         $this->redirect('localized_homepage');
     } else {
         $this->redirect($eleje . "/" . $lang . "/" . $whereto);
     }
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         if ($this->getUser()->isFirstRequest()) {
             $culture = $request->getPreferredCulture(array('pt', 'en'));
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
     }
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         if ($this->getUser()->isFirstRequest()) {
             $culture = $request->getPreferredCulture(array('en', 'es'));
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
         $this->redirect('localized_homepage');
     }
 }
Beispiel #5
0
 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         if ($this->getUser()->isFirstRequest()) {
             $culture = $request->getPreferredCulture(array('en', 'fr'));
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
         $this->redirect('localized_homepage');
     }
     $this->categories = Doctrine_Core::getTable('JobeetCategory')->getWithJobs();
 }
Beispiel #6
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         $ssaml = new SimpleSAML_Auth_Simple('default-sp');
         $attributes = $ssaml->getAttributes();
         //die(var_dump($attributes['preferredLanguage']));
         if ($this->getUser()->isFirstRequest()) {
             if (array_key_exists('preferredLanguage', $attributes)) {
                 $culture = $attributes['preferredLanguage'];
                 if ($culture != 'hu' && $culture != 'en') {
                     $culture = $request->getPreferredCulture(array('hu', 'en'));
                 }
             } else {
                 $culture = $request->getPreferredCulture(array('hu', 'en'));
             }
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
         $this->redirect('localized_homepage');
     }
 }
 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         if ($this->getUser()->isFirstRequest()) {
             $culture = $request->getPreferredCulture(array('en', 'hr'));
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
         $this->redirect('homepage');
     }
     $this->cities = Doctrine_Core::getTable('city')->TopCities(8);
     $this->apartments = Doctrine_Core::getTable('apartment')->LastAdded(9);
 }
 /**
  * Gets the preferred country of the user based on the browser request.
  *
  * @return string country
  **/
 public static function getPreferredCountry(sfWebRequest $request)
 {
     $culture = explode('_', $request->getPreferredCulture());
     return count($culture) > 1 ? $culture[1] : $culture[0];
 }