本文整理汇总了PHP中Gpf_Rpc_Form::addValidator方法的典型用法代码示例。如果您正苦于以下问题:PHP Gpf_Rpc_Form::addValidator方法的具体用法?PHP Gpf_Rpc_Form::addValidator怎么用?PHP Gpf_Rpc_Form::addValidator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gpf_Rpc_Form
的用法示例。
在下文中一共展示了Gpf_Rpc_Form::addValidator方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), self::COMMISSION_KEY);
$form->addValidator(new Gpf_Rpc_Form_Validator_NumberRangeValidator(0, 100), self::COMMISSION_KEY);
$form->validate();
if($form->isSuccessful()){
Gpf_Settings::set(self::COMMISSION_KEY, $form->getFieldValue(self::COMMISSION_KEY));
$form->setInfoMessage($this->_('Plugin configuration saved'));
}
return $form;
}
示例2: execute
protected function execute(Gpf_Rpc_Params $params)
{
$form = new Gpf_Rpc_Form($params);
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Gpf_Install_CreateDatabase::DB_HOSTNAME, $this->_('Database Hostname'));
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Gpf_Install_CreateDatabase::DB_USERNAME, $this->_('Username'));
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Gpf_Install_CreateDatabase::DB_NAME, $this->_('Database Name'));
if (!$form->validate()) {
return $form;
}
$createDatabaseTask = new Gpf_Install_CreateDatabaseTask();
$createDatabaseTask->setDBSettings($form->getFieldValue(Gpf_Install_CreateDatabase::DB_HOSTNAME), $form->getFieldValue(Gpf_Install_CreateDatabase::DB_USERNAME), $form->getFieldValue(Gpf_Install_CreateDatabase::DB_NAME), $form->getFieldValue(Gpf_Install_CreateDatabase::DB_PASSWORD));
try {
$createDatabaseTask->run();
} catch (Gpf_Tasks_LongTaskInterrupt $e) {
$this->setResponseType($form, self::PART_DONE_TYPE);
$form->setInfoMessage($e->getMessage());
return $form;
} catch (Exception $e) {
$form->setErrorMessage($e->getMessage());
return $form;
}
$this->setNextStep($form);
return $form;
}
示例3: initValidators
public function initValidators(Gpf_Rpc_Form $form) {
if (!($form->existsField('isdesign') && $form->getFieldValue('isdesign') == Gpf::YES)) {
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Pap_Db_Table_Banners::NAME, $this->_('name'));
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Pap_Db_Table_Banners::STATUS, $this->_('status'));
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Pap_Db_Table_Banners::SIZE, $this->_('size'));
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Pap_Db_Table_Banners::DATA1, $this->_('description'));
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Pap_Db_Table_Banners::DATA2, $this->_('maximum coupons per affiliate'));
$form->addValidator(new Gpf_Rpc_Form_Validator_IntegerNumberPositiveValidator(), Pap_Db_Table_Banners::DATA2);
}
}
示例4: setValidators
private function setValidators($type) {
if($this->form->getFieldValue("unlimitedValidity") == Gpf::YES) {
$this->form->setField('validto', '2030-12-30');
}
$this->form->addValidator(new Gpf_Rpc_Form_Validator_IntegerNumberPositiveValidator(), self::MAX_USE_COUNT, $this->_('Limit use'));
$this->form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), self::MAX_USE_COUNT);
$this->form->addValidator(new Gpf_Rpc_Form_Validator_DateValidator(), self::VALID_FROM, $this->_('Valid from'));
$this->form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), self::VALID_FROM);
$this->form->addValidator(new Gpf_Rpc_Form_Validator_DateValidator(), self::VALID_TO, $this->_('Valid to'));
$this->form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), self::VALID_TO);
$this->form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), self::COUPON_ASSIGMENT, $this->_('Coupon assigment'));
if ($this->form->getFieldValue(self::COUPON_ASSIGMENT) == 'A') {
$this->form->addValidator(new Gpf_Rpc_Form_Validator_IntegerNumberPositiveValidator(), self::COUPONS_PER_AFF, $this->_('Coupons to each affiliate'));
$this->form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), self::COUPONS_PER_AFF);
}
if ($type == self::IMPORT) {
$this->form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), self::COUPONS_CODES, $this->_('Coupon codes'));
return;
}
$this->form->addValidator(new Gpf_Rpc_Form_Validator_RegExpValidator('/^([^{},]*({[zZ9X]+})+[^{},]*)+$/', $this->_('Enter valid %s')), self::COUPON_FORMAT, $this->_('Coupon format'));
$this->form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), self::COUPON_FORMAT);
$this->form->addValidator(new Gpf_Rpc_Form_Validator_IntegerNumberPositiveValidator(), self::COUPONS_COUNT, $this->_('Number of coupons'));
$this->form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), self::COUPONS_COUNT);
}
示例5: initValidators
public function initValidators(Gpf_Rpc_Form $form)
{
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Pap_Db_Table_Banners::NAME, $this->_('name'));
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Pap_Db_Table_Banners::STATUS, $this->_('status'));
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Pap_Db_Table_Banners::SIZE, $this->_('size'));
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), Pap_Db_Table_Banners::DESTINATION_URL, $this->_('destination url'));
}
示例6: setValidators
private function setValidators(Gpf_Rpc_Form $form) {
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), 'totalcost', $this->_('Total cost'));
$form->addValidator(new Gpf_Rpc_Form_Validator_NumberValidator(), 'totalcost');
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), 'orderid', $this->_('Order ID'));
$form->addValidator(new Gpf_Rpc_Form_Validator_MandatoryValidator(), 'productid', $this->_('Product ID'));
}
示例7: initValidators
private function initValidators(Gpf_Rpc_Form $form) {
$form->addValidator(new Pap_Merchants_Config_AutoDeleteWithRepeatingClicksValidator($form), Pap_Settings::REPEATING_CLICKS_SECONDS_SETTING_NAME, '');
}
示例8: initValidators
private function initValidators(Gpf_Rpc_Form $form) {
$form->addValidator(new Pap_Merchants_Config_TrackingAutoDeleteWithIpValidityValidator($form), Pap_Settings::AUTO_DELETE_RAWCLICKS);
$form->addValidator(new Pap_Merchants_Config_TrackingAutoDeleteWithRepeatingClicksValidator($form), Pap_Settings::AUTO_DELETE_RAWCLICKS);
}