本文整理汇总了PHP中Zend_Form_Element_Submit::isChecked方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Submit::isChecked方法的具体用法?PHP Zend_Form_Element_Submit::isChecked怎么用?PHP Zend_Form_Element_Submit::isChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Submit
的用法示例。
在下文中一共展示了Zend_Form_Element_Submit::isChecked方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processForm
/**
* Step by step form processing
*
* Returns false when $this->afterSaveRouteUrl is set during the
* processing, which happens by default when the data is saved.
*
* @return boolean True when the form should be displayed
*/
protected function processForm()
{
// Make sure there is $this->formData
$this->loadFormData();
// Make sure there is a $this->_form
$this->loadForm();
// Create $this->_saveButton
$this->addSaveButton();
// Use Csrf when enabled
if ($this->useCsrf) {
$this->addCsrf();
}
if ($this->request->isPost()) {
//First populate the form, otherwise the saveButton will never be 'checked'!
$this->populateForm();
// If there is a save button it should be checked, otherwise just validate
if (!$this->_saveButton || $this->_saveButton->isChecked()) {
if ($this->_form->isValid($this->formData)) {
// Remove all unwanted data
$this->cleanFormData();
// Save
$this->afterSave($this->saveData());
// Reroute (always, override function otherwise)
$this->setAfterSaveRoute();
} else {
$this->onInValid();
}
} else {
//The default save button was NOT used, so we have a fakesubmit button
$this->onFakeSubmit();
}
}
return !$this->getRedirectRoute();
}
示例2: processForm
/**
* Step by step form processing
*
* Returns false when $this->afterSaveRouteUrl is set during the
* processing, which happens by default when the data is saved.
*
* @return boolean True when the form should be displayed
*/
protected function processForm()
{
// Make sure there is $this->formData
$this->loadFormData();
if (isset($this->formData[$this->stepFieldName])) {
$this->currentStep = $this->formData[$this->stepFieldName];
}
$this->originalStep = $this->currentStep;
// Make sure there is a $this->_form
$this->loadFormFor($this->currentStep);
if ($this->request->isPost()) {
// \MUtil_Echo::track($this->formData);
if ($this->_cancelButton && $this->_cancelButton->isChecked()) {
$this->setAfterSaveRoute();
} elseif ($this->isPreviousClicked()) {
$this->loadFormFor($this->currentStep - 1);
} else {
if ($this->validateForm()) {
$this->afterFormValidationFor($this->currentStep);
if ($this->isNextClicked()) {
$this->loadFormFor($this->currentStep + 1);
} else {
/*
* Now that we validated, the form is populated. But I think the step
* below is not needed as the values in the form come from the data array
* but performing a getValues() cleans the data array so data in post but
* not in the form is removed from the data variable.
*/
$this->formData = $this->_form->getValues();
if ($this->_finishButton && $this->_finishButton->isChecked()) {
// Save
$this->saveData();
// Reroute (always, override function otherwise)
$this->setAfterSaveRoute();
}
}
} else {
$this->onInValid();
}
}
}
return !$this->getRedirectRoute();
}
示例3: testIsCheckedReturnsExpectedValueWhenUsingTranslator
/**
* Tests that the isChecked method works as expected when using a translator.
* @group ZF-4073
*/
public function testIsCheckedReturnsExpectedValueWhenUsingTranslator()
{
$translations = array('label' => 'translation');
$translate = new Zend_Translate('array', $translations);
$submit = new Zend_Form_Element_Submit('foo', 'label');
$submit->setTranslator($translate);
$submit->setValue($translations['label']);
$this->assertTrue($submit->isChecked());
$submit->setValue('label');
$this->assertFalse($submit->isChecked());
}