本文整理匯總了PHP中Gpf_Rpc_Form::validate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gpf_Rpc_Form::validate方法的具體用法?PHP Gpf_Rpc_Form::validate怎麽用?PHP Gpf_Rpc_Form::validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gpf_Rpc_Form
的用法示例。
在下文中一共展示了Gpf_Rpc_Form::validate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: save
/**
* @anonym
* @service
* @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_EmailValidator(), self::AUTORESPONDER_ADDRESS, $this->_('Autoresponder'));
if (!$form->validate()) {
return $form;
}
Gpf_Settings::set(self::AUTORESPONDER_ADDRESS, $form->getFieldValue(self::AUTORESPONDER_ADDRESS));
$form->setInfoMessage($this->_('AWeber saved'));
return $form;
}
示例2: validateAndRun
private function validateAndRun($type) {
if ($this->form->validate()) {
try {
$this->task->run();
} catch (Gpf_Tasks_LongTaskInterrupt $e) {
$this->form->setField(self::SUCCESS, Gpf::NO);
$this->form->setInfoMessage($e->getMessage());
return;
} catch (Exception $e) {
$this->task->forceFinishTask();
$this->form->setField(self::SUCCESS, Gpf::YES);
$this->form->setErrorMessage($this->_('Error during ' . $this->getActionName($type) . ' coupons') . ' (' . $e->getMessage() . ') ');
return;
}
$this->form->setInfoMessage($this->_('Coupons are successfully ' . $this->getActionName($type, true)));
$this->form->setField(self::SUCCESS, Gpf::YES);
}
}
示例3: 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;
}