Exemplo n.º 1
0
 /**
  * Method check subform data is storage
  *
  * @param Zend_Form_SubForm|string $subForm
  * @return bool
  */
 public function isStored($subForm)
 {
     if ($subForm instanceof Zend_Form_SubForm) {
         $key = $subForm->getName();
     } else {
         $key = $subForm;
     }
     return $this->getSessionNamespace()->{$key} ? true : false;
 }
Exemplo n.º 2
0
 public function subFormIsValid(Zend_Form_SubForm $subForm, array $data)
 {
     $name = $subForm->getName();
     if ($subForm->isValid($data)) {
         $this->getSessionNamespace()->{$name} = $subForm->getValues();
         return true;
     }
     return false;
 }
Exemplo n.º 3
0
 /**
  * Insert radio buttons to activate data copy if checked. <br />
  * Depending on the radio checked, the address used will be extracted from
  * the profile or from a temporary table or empty.
  *
  * @param Zend_Form_SubForm $addressSubForm The subForm containing the
  *                                          address fields to duplicate.
  * @param Array             $options        Options to defined the radio buttons.
  *
  * @return void
  */
 public function addressSource($addressSubForm, $options = array())
 {
     if ($addressSubForm instanceof Zend_Form_SubForm || $addressSubForm instanceof Cible_Form_SubForm) {
         $name = $this->_parentForm . $addressSubForm->getName();
         if (empty($name)) {
             throw new Exception('Please, set this subform name in order to add the checkbox to duplicate address.');
         }
         $addrSource = new Zend_Form_Element_Radio('addrSource');
         $addrSource->addMultiOptions($options['choices']);
         $addrSource->setValue($options['default']);
         $addrSource->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'addrSource label_after_checkbox'))));
         $this->_form->addElement($addrSource);
         $this->_addJsActions($name . '-addrSource', 'addrSource');
     } else {
         throw new Exception('The parameter is not an instance of Zend_Form_SubForm or Cible_form_SubForm');
     }
 }