Example #1
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $dates = new TvcDates();
     $list = $dates->dropdown();
     parent::__construct($options);
     $this->setName('tvcdates');
     $date = new Zend_Form_Element_Select('tvcID');
     $date->setLabel('Date of TVC: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addErrorMessage('You must choose a TVC date')->addMultiOptions(array(null => 'Select a TVC', 'Valid dates' => $list))->addValidator('InArray', false, array(array_keys($list)));
     $submit = new Zend_Form_Element_Submit('submit');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $this->addElements(array($date, $submit, $hash));
     $this->addDisplayGroup(array('tvcID'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
Example #2
0
 public function addAction()
 {
     $form = new TVCForm();
     $form->submit->setLabel('Add TVC date');
     $this->view->form = $form;
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $data = $form->getValues();
             $provisionals = new TvcDates();
             $insert = $provisionals->add($data);
             $this->_redirect($this->_redirect);
             $this->_flashMessenger->addMessage('A new provisional value has been added.');
         } else {
             $form->populate($formData);
         }
     }
 }
Example #3
0
 public function __construct($options = null)
 {
     $dates = new TvcDates();
     $list = $dates->dropdown();
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $this->setName('tvcdates');
     $date = new Zend_Form_Element_Select('tvcID');
     $date->setLabel('Date of TVC: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must choose a TVC date')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->addMultiOptions(array('NULL' => 'Select a TVC', 'Valid dates' => $list))->addValidator('InArray', false, array(array_keys($list)))->setDecorators($decorators);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $this->addElements(array($date, $submit, $hash));
     $this->addDisplayGroup(array('tvcID'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->addDisplayGroup(array('submit'), 'submit');
 }