當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Form_Element_Submit::isChecked方法代碼示例

本文整理匯總了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();
 }
開發者ID:GemsTracker,項目名稱:MUtil,代碼行數:42,代碼來源:FormSnippetAbstract.php

示例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();
 }
開發者ID:GemsTracker,項目名稱:MUtil,代碼行數:51,代碼來源:WizardFormSnippetAbstract.php

示例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());
 }
開發者ID:jsnshrmn,項目名稱:Suma,代碼行數:15,代碼來源:SubmitTest.php


注:本文中的Zend_Form_Element_Submit::isChecked方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。