Пример #1
0
 /**
  * @return array
  */
 private function getAttributes()
 {
     $attributes = Gpf_Db_UserAttribute::getSettingsForGroupOfUsers(array(self::SHOW_QUICK_LAUNCH), array($this->getAccountUserId()));
     if (isset($attributes[$this->getAccountUserId()])) {
         return $attributes[$this->getAccountUserId()];
     }
     throw new Gpf_Exception($this->_('Settings not exists, load default settings.'));
 }
Пример #2
0
 /**
  * Save Wallpaper settings from form
  *
  * @service wallpaper write
  * @param Gpf_Rpc_Params $params
  */
 public function save(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     try {
         $type = $form->getFieldValue(self::WALLPAPER_TYPE);
         $wallpaper = $form->getFieldValue(self::WALLPAPER);
         if ($type == self::TYPE_THEME) {
             $wallpaper = ltrim($wallpaper, self::TYPE_THEME);
         } else {
             if ($type == self::TYPE_CUSTOM) {
                 $wallpaper = ltrim($wallpaper, self::TYPE_CUSTOM);
             }
         }
         Gpf_Db_UserAttribute::saveAttribute(self::WALLPAPER_TYPE, $type);
         Gpf_Db_UserAttribute::saveAttribute(self::WALLPAPER, $wallpaper);
         Gpf_Db_UserAttribute::saveAttribute(self::WALLPAPER_POSITION, $form->getFieldValue(self::WALLPAPER_POSITION));
         Gpf_Db_UserAttribute::saveAttribute(self::BACKGROUND_COLOR, $form->getFieldValue(self::BACKGROUND_COLOR));
     } catch (Gpf_Exception $e) {
         $form->setErrorMessage($this->_('Failed to save wallpaper with error %s', $e->getMessage()));
         return $form;
     }
     $form->setInfoMessage($this->_('Wallpaper saved.'));
     return $form;
 }
Пример #3
0
    private function deleteContact(Pap_common_user $user, $oldEmail) {
        if(!$this->isSubscribed) {
            return;
        }
        Gpf_Log::info('GetResponse - deleteContact');
        $this->callFunction('delete_contact', array('contact' => $this->getContactId($oldEmail)));

        $userAttr = new Gpf_Db_UserAttribute();
        $userAttr->setName(self::GET_RESPONSE_CONTACT_EMAIL);
        $userAttr->setAccountUserId($user->getAccountUserId());
        $userAttr->loadFromData();
        $userAttr->delete();
    }
Пример #4
0
 protected function setAuthenticationSucesful(Gpf_Rpc_Form $loginForm, Gpf_Auth_User $authUser)
 {
     try {
         if ($loginForm->getFieldValue(self::REMEMBER_ME) == Gpf::YES) {
             $authUser->saveRememberMeCookie();
         }
     } catch (Gpf_Exception $e) {
     }
     $authUser->setLanguage($loginForm->getFieldValue(self::LANGUAGE));
     Gpf_Db_UserAttribute::saveAttribute(self::LANGUAGE, $loginForm->getFieldValue(self::LANGUAGE), $authUser->getAccountUserId());
     Gpf_Db_UserAttribute::saveAttribute(self::TIME_OFFSET, Gpf_Session::getInstance()->getTimeOffset(), $authUser->getAccountUserId());
     Gpf_Http::setCookie(self::COOKIE_LANGUAGE, $authUser->getLanguage(), time() + 20000000, '/');
     $loginForm->addField("S", Gpf_Session::getInstance()->getId());
     $loginForm->setInfoMessage($this->_("User authenticated. Logging in."));
     Gpf_Log::info($this->_sys("User %s authenticated. Logging in.", $authUser->getUsername()));
 }
Пример #5
0
 public static function saveAttribute($name, $value, $accountUserId = null)
 {
     $attribute = new Gpf_Db_UserAttribute();
     $attribute->setName($name);
     $attribute->setValue($value);
     if ($accountUserId == null) {
         $attribute->setAccountUserId(Gpf_Session::getInstance()->getAuthUser()->getAccountUserId());
     } else {
         $attribute->setAccountUserId($accountUserId);
     }
     return $attribute->save();
 }
 private function setQuickLaunchSettings($accountUserId, $value) {
     $attribute = new Gpf_Db_UserAttribute();
     $attribute->setName('quickLaunchSetting');
     $attribute->set(Gpf_Db_Table_UserAttributes::VALUE, $value);
     $attribute->setAccountUserId($accountUserId);
     $attribute->save();
 }
 protected function getInstanceSetting($name, $accounUsertId = null)
 {
     $attribute = new Gpf_Db_UserAttribute();
     return $attribute->getSetting($name, $accounUsertId);
 }
Пример #8
0
 private function getUserAttribute($attribute, Gpf_Db_User $user)
 {
     $setting = new Gpf_Db_UserAttribute();
     try {
         return $setting->getSetting($attribute, $user->getId());
     } catch (Gpf_Exception $e) {
     }
     return $attribute == Gpf_Auth_Service::TIME_OFFSET ? 0 : '';
 }
    private function saveRecipientsList($recipients){
        $data = new Gpf_Db_UserAttribute();
        $data->setAccountUserId(Gpf_Session::getAuthUser()->getUserId());
        $data->setName('RecipientsList');

        try {
            $data->loadFromData(array(Gpf_Db_Table_UserAttributes::ACCOUNT_USER_ID,Gpf_Db_Table_UserAttributes::NAME));
            $data->setValue($recipients);
            $data->save();

        } catch(Gpf_DbEngine_NoRowException $e) {
            $data->setValue($recipients);
            $data->insert();
        }
    }
Пример #10
0
 private static function setDefaultLanguageToAffiliate($accountUserId) {
     $attribute = new Gpf_Db_UserAttribute();
     $attribute->setName(Gpf_Auth_User::LANGUAGE_ATTRIBUTE_NAME);
     $attribute->setAccountUserId($accountUserId);
     try {
         $attribute->loadFromData(array(Gpf_Db_Table_UserAttributes::NAME, Gpf_Db_Table_UserAttributes::ACCOUNT_USER_ID));
         return;
     } catch (Gpf_DbEngine_NoRowException $e) {
         $attribute->set(Gpf_Db_Table_UserAttributes::VALUE, Gpf_Lang_Dictionary::getDefaultLanguage());
         $attribute->save();
     }
 }