当前位置: 首页>>代码示例>>PHP>>正文


PHP Gpf_Rpc_Form::setFieldError方法代码示例

本文整理汇总了PHP中Gpf_Rpc_Form::setFieldError方法的典型用法代码示例。如果您正苦于以下问题:PHP Gpf_Rpc_Form::setFieldError方法的具体用法?PHP Gpf_Rpc_Form::setFieldError怎么用?PHP Gpf_Rpc_Form::setFieldError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gpf_Rpc_Form的用法示例。


在下文中一共展示了Gpf_Rpc_Form::setFieldError方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

 /**
  * @return boolean
  */
 public function validate()
 {
     $errorMsg = false;
     foreach ($this->validators as $fieldName => $fieldValidator) {
         if (!$fieldValidator->validate($this->form->getFieldValue($fieldName))) {
             $errorMsg = true;
             $this->form->setFieldError($fieldName, $fieldValidator->getMessage());
         }
     }
     if ($errorMsg) {
         $this->form->setErrorMessage($this->_('There were errors, please check highlighted fields'));
     }
     return !$errorMsg;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:17,代码来源:FormValidatorCollection.class.php

示例2: execute

 protected function execute(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     if (!$form->getFieldValue(self::LICENSE_AGREE_NAME)) {
         $form->setFieldError(self::LICENSE_AGREE_NAME, $this->_('You have to agree license.'));
         $form->setErrorMessage($this->_('You have to agree license.'));
         return $form;
     }
     try {
         $setting = new Gpf_File_Settings();
         $settingsArray = $setting->getAll();
         if (is_array($settingsArray) && empty($settingsArray)) {
             $this->addDBDefaultSettings($setting);
         }
         $setting->saveAll();
         @chmod($setting->getSettingFileName(), 0777);
     } catch (Exception $e) {
         $form->setErrorMessage($this->_('Could not create settings file. Reason: %s', $e->getMessage()));
         return $form;
     }
     try {
         $info = $this->licenseManager->getLicense(trim($form->getFieldValue(self::LICENSE_ID_NAME)));
         if (!$info->isApplicationCodeValid()) {
             $form->setErrorMessage($this->_('Invalid license.'));
             return $form;
         }
     } catch (Exception $e) {
         $form->setErrorMessage($this->_('Could not validate license. Reason: %s', $e->getMessage()));
         return $form;
     }
     $this->setNextStep($form);
     return $form;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:33,代码来源:AcceptLicense.class.php

示例3: save

 /**
  * @anonym
  * @service custom_separator write
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Form
  */
 public function save(Gpf_Rpc_Params $params) {
     $form = new Gpf_Rpc_Form($params);
     $customFieldNumber = (integer)$form->getFieldValue(self::CUSTOM_FIELD_NUMBER);
     if ($customFieldNumber < 1 || $customFieldNumber > 4) {
         $form->setFieldError(self::CUSTOM_FIELD_NUMBER, $this->_('Custom field number must be from range 1-4.'));
         return $form;
     }
     Gpf_Settings::set(self::CUSTOM_FIELD_NUMBER, $customFieldNumber);
     $form->setInfoMessage($this->_('CyberSource plugin configuration saved'));
     return $form;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:17,代码来源:Config.class.php

示例4: checkUsernameIsValidEmail

    protected function checkUsernameIsValidEmail(Gpf_Rpc_Form $form, $operationType) {
        $username = $form->getFieldValue("username");
        $emailValidator = new Gpf_Rpc_Form_Validator_EmailValidator();

        if(Gpf::YES == Gpf_Settings::get(Gpf_Settings_Gpf::NOT_FORCE_EMAIL_USERNAMES) || $emailValidator->validate($username)) {
            return true;
        }

        $form->setFieldError("username", $this->_("Username must be valid email address"));
        $form->setErrorMessage($form->getFieldError('username'));
        return false;
    }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:12,代码来源:UserForm.class.php

示例5: save

 /**
  * special handling
  *
  * @service password_constraints write
  * @param $fields
  * @return Gpf_Rpc_Form
  */
 public function save(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     if ($form->getFieldValue('minLength') > $form->getFieldValue('maxLength')) {
         $form->setFieldError('minLength', $this->_("Minimum password length can't be bigger as maximum password length"));
         return $form;
     }
     Gpf_Settings::set(Gpf_Settings_Gpf::PASSWORD_MIN_LENGTH, $form->getFieldValue('minLength'));
     Gpf_Settings::set(Gpf_Settings_Gpf::PASSWORD_MAX_LENGTH, $form->getFieldValue('maxLength'));
     Gpf_Settings::set(Gpf_Settings_Gpf::PASSWORD_LETTERS, $form->getFieldValue('azChars'));
     Gpf_Settings::set(Gpf_Settings_Gpf::PASSWORD_DIGITS, $form->getFieldValue('digitsChars'));
     Gpf_Settings::set(Gpf_Settings_Gpf::PASSWORD_SPECIAL, $form->getFieldValue('specialChars'));
     $form->setInfoMessage($this->_("Password constraints saved"));
     return $form;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:22,代码来源:PasswordConstraintForm.class.php

示例6: save

 /**
  * @anonym
  * @service custom_separator write
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Form
  */
 public function save(Gpf_Rpc_Params $params) {
     $form = new Gpf_Rpc_Form($params);
     
     $key = trim($form->getFieldValue(self::ENCRYPT_KEY));
     $iv = trim($form->getFieldValue(self::ENCRYPT_IV));
     
     if (!in_array(strlen($key), array(16, 24, 32))) {
         $form->setFieldError(self::ENCRYPT_KEY, $this->_('Key must be 16, 24 or 32 characters long'));
     }
     if (strlen($iv) != 16) {
         $form->setFieldError(self::ENCRYPT_IV, $this->_('Initialization vector must be 16 characters long'));
     }
     
     if (!$form->isError()) {
         if ($key != Gpf_Settings::get(self::ENCRYPT_KEY) || $iv != Gpf_Settings::get(self::ENCRYPT_IV)) {
             Pap_Features_PayoutFieldsEncryption_Main::getHandlerInstance()->recodeAllValues($key, $iv);
         }
         Gpf_Settings::set(self::ENCRYPT_KEY, $key);
         Gpf_Settings::set(self::ENCRYPT_IV, $iv);
         $form->setInfoMessage($this->_('Encrypt codes saved'));
     }
     
     return $form;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:30,代码来源:Config.class.php

示例7: setNewPassword

 /**
  * Set new password for user, which requested new password
  *
  * @service
  * @anonym
  * @param Gfp_Rpc_Params $params
  * @return Gpf_Rpc_Form
  */
 public function setNewPassword(Gpf_Rpc_Params $params)
 {
     $response = new Gpf_Rpc_Form($params);
     if (!Gpf_Captcha::isValid('set_pw_captcha', $response->getFieldValue('set_pw_captcha'))) {
         $response->setFieldError('set_pw_captcha', $this->_("You entered invalid security code"));
         return $response;
     }
     Gpf_Db_Table_PasswordRequests::expireOldRequest();
     $errorMessageInvalidUsername = $this->_('You entered invalid username');
     $user = new Gpf_Db_AuthUser();
     $user->setUsername($response->getFieldValue('username'));
     try {
         $user->loadFromData(array(Gpf_Db_Table_AuthUsers::USERNAME));
     } catch (Gpf_Exception $e) {
         $response->setFieldError('username', $errorMessageInvalidUsername);
         return $response;
     }
     $errorMessage = $this->getInvalidPasswordRequestErrorMessage();
     $passwordRequest = new Gpf_Db_PasswordRequest();
     $passwordRequest->setId($response->getFieldValue('requestid'));
     try {
         $passwordRequest->load();
     } catch (Gpf_Exception $e) {
         $response->setErrorMessage($errorMessage);
         return $response;
     }
     if ($user->getId() != $passwordRequest->getAuthUser()) {
         $response->setFieldError('username', $errorMessageInvalidUsername);
         return $response;
     }
     if ($passwordRequest->getStatus() != Gpf_Db_Table_PasswordRequests::STATUS_PENDING || $user->getUsername() != $response->getFieldValue('username')) {
         $response->setErrorMessage($errorMessage);
         return $response;
     }
     $user->setPassword($response->getFieldValue('password'));
     try {
         $user->update(array(Gpf_Db_Table_AuthUsers::PASSWORD));
     } catch (Gpf_DbEngine_Row_ConstraintException $e) {
         $response->setErrorMessage($e->getMessage());
         return $response;
     }
     $passwordRequest->setStatus(Gpf_Db_Table_PasswordRequests::STATUS_APPLIED);
     $passwordRequest->update(array(Gpf_Db_Table_PasswordRequests::STATUS));
     $response->setInfoMessage($this->_("Your password was changed. Go back to login dialog and login."));
     return $response;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:54,代码来源:Impression.php

示例8: importLanguage

 /**
  * Import language specified in parameter fileName
  *
  * @service language import
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Form
  */
 public function importLanguage(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     //Read metadata of file
     $file = new Gpf_Io_Csv_Reader($form->getFieldValue("fileName"), ';', '"', array('source', 'translation', 'type', 'module', 'status', 'customer'));
     $file->setMaxLinesToRead(10);
     $language = new Gpf_Lang_CsvLanguage();
     $language->loadFromCsvFile($file);
     try {
         $importer = new Gpf_Lang_ImportLanguageTask($form->getFieldValue("fileName"), $language->getCode(), false);
         $importer->run();
     } catch (Gpf_Tasks_LongTaskInterrupt $e) {
         $form->addField('progress', 'PROGRESS');
         $form->setFieldError('progress', $e->getMessage());
         $form->setErrorMessage($e->getMessage());
         return $form;
     }
     $form->setInfoMessage($this->_('%s (%s) imported', $language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_NAME), $language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_ENG_NAME)));
     return $form;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:27,代码来源:AddLanguageGrid.class.php

示例9: setFormFieldError

 private function setFormFieldError(Gpf_Rpc_Form $form, $fieldCode, $fieldName) {
     $form->setFieldError($fieldCode, $this->_('Field') . ' ' . $this->_localize($fieldName) . $this->_("&nbsp;is mandatory"));
     $form->setErrorMessage($form->getFieldError($fieldCode));
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:4,代码来源:AffiliateForm.class.php

示例10: saveExpandSettings

	private function saveExpandSettings(Gpf_Rpc_Form $form) {
		if ($form->existsField(Pap_Settings::MATRIX_EXPAND_WIDTH) && $form->existsField(Pap_Settings::MATRIX_EXPAND_HEIGHT)) {
			if ($form->getFieldValue(Pap_Settings::MATRIX_EXPAND_WIDTH) > 0 || $form->getFieldValue(Pap_Settings::MATRIX_EXPAND_HEIGHT) > 0) {
				Gpf_Settings::set(Pap_Settings::MATRIX_EXPAND_WIDTH, $form->getFieldValue(Pap_Settings::MATRIX_EXPAND_WIDTH));
				Gpf_Settings::set(Pap_Settings::MATRIX_EXPAND_HEIGHT, $form->getFieldValue(Pap_Settings::MATRIX_EXPAND_HEIGHT));
				return;
			}
			$form->setFieldError(Pap_Settings::MATRIX_EXPAND_WIDTH, $this->_('expand width by adding or expand height by adding must be defined'));
			$form->setFieldError(Pap_Settings::MATRIX_EXPAND_HEIGHT, $this->_('expand height by adding or expand width by adding must be defined'));
		}
	}
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:11,代码来源:Main.class.php


注:本文中的Gpf_Rpc_Form::setFieldError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。