예제 #1
0
 public static function getFullCityAndCountry(User $user)
 {
     $countryLabel = "";
     if ($user->getCountry()) {
         $country = \Sb\Db\Dao\CountryDao::getInstance()->getCountryByCode($user->getCountry());
         $countryLabel = ArrayHelper::getSafeFromArray($_SESSION, "WPLANG", "fr_FR") != "en_US" ? $country->getLabel_french() : $country->getLabel_english();
         $countryLabel = ucfirst($countryLabel);
     }
     $res = "";
     if ($countryLabel != '' && $user->getCity() != '') {
         $res = sprintf(__("%s, %s", "s1b"), ucfirst($user->getCity()), $countryLabel);
     } elseif ($countryLabel != '') {
         $res = $countryLabel;
     } elseif ($user->getCity() != '') {
         $res = ucfirst($user->getCity());
     }
     return $res;
 }
예제 #2
0
 public function editAction()
 {
     $globalContext = new \Sb\Context\Model\Context();
     $user = $globalContext->getConnectedUser();
     $userSettings = $user->getSetting();
     $profile = new UserProfile($user, $userSettings, false, false, false);
     $userLang = ArrayHelper::getSafeFromArray($_SESSION, "WPLANG", "fr_FR");
     $countries = CountryDao::getInstance()->getAll();
     $userCountry = null;
     if ($user->getCountry()) {
         $userCountry = CountryDao::getInstance()->getCountryByCode($user->getCountry());
     }
     $submitUrl = HTTPHelper::Link(Urls::USER_PROFILE_SUBMIT);
     $this->view->profileView = $profile->get();
     $this->view->user = $user;
     $this->view->userSettings = $userSettings;
     $this->view->userLang = $userLang;
     $this->view->countries = $countries;
     $this->view->userCountry = $userCountry;
     $this->view->submitUrl = $submitUrl;
 }