Exemplo n.º 1
0
 /**
  * Init language attribute
  * If not set, load default value
  * If set url parameter l, overwite existing setting
  *
  */
 private function initLanguage()
 {
     if (!strlen($this->language)) {
         $this->language = Gpf_Lang_Dictionary::getDefaultLanguage();
     } else {
         if (isset($_REQUEST[Gpf_Lang_Dictionary::LANGUAGE_REQUEST_PARAMETER]) && Gpf_Lang_Dictionary::isLanguageSupported($_REQUEST[Gpf_Lang_Dictionary::LANGUAGE_REQUEST_PARAMETER])) {
             //overwrite existing language setting, because it is defined in URL parameter, which is stronger as other settings
             $this->language = $_REQUEST[Gpf_Lang_Dictionary::LANGUAGE_REQUEST_PARAMETER];
         }
     }
 }
Exemplo n.º 2
0
    public static function setAffiliateLanguage(Gpf_Rpc_Form $form, $accountUserId) {
        if (!$form->existsField('lang') || $form->getFieldValue('lang') == '') {
            self::setDefaultLanguageToAffiliate($accountUserId);
            return;
        }

        if (!Gpf_Lang_Dictionary::isLanguageSupported($form->getFieldValue('lang'))) {
            self::setDefaultLanguageToAffiliate($accountUserId);
            return;
        }

        $attribute = new Gpf_Db_UserAttribute();
        $attribute->setName(Gpf_Auth_User::LANGUAGE_ATTRIBUTE_NAME);
        $attribute->set(Gpf_Db_Table_UserAttributes::VALUE, $form->getFieldValue('lang'));
        $attribute->setAccountUserId($accountUserId);
        $attribute->save();
    }