Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Cadastro\Form;
- use Zend\Form\Form;
- use DoctrineModule\Stdlib\Hydrator\DoctrineObject;
- use Zend\InputFilter\InputFilterProviderInterface;
- use Zend\Form\Element\Submit;
- use Cadastro\Hydrator\Strategy\DateTimeStrategy;
- /**
- * Cadastro de feriados e recesso.
- *
- * @author Alfredo Costa
- * @category Form
- * @package Cadastro/Form
- * @copyright 2014 P21 Sistemas
- * @version 1.0.0
- */
- class FeriadoForm extends Form implements InputFilterProviderInterface
- {
- /**
- */
- public function __construct($objectManager)
- {
- parent::__construct('feriado');
- $this->setHydrator(new DoctrineObject($objectManager))->setObject(new \Cadastro\Entity\Feriado());
- /**
- * Strategy para conversao de string [dataInicial|dataFinal] para object DateTime
- */
- $this->getHydrator()->addStrategy('dataInicial', new DateTimeStrategy());
- $this->getHydrator()->addStrategy('dataFinal', new DateTimeStrategy());
- $this->add(array(
- 'type' => 'Zend\Form\Element\Hidden',
- 'name' => 'id'
- ));
- $this->add(array(
- 'type' => 'Zend\Form\Element\Text',
- 'name' => 'nome',
- 'options' => array(
- 'label' => 'Nome:'
- ),
- 'attributes' => array(
- 'size' => '30'
- )
- ));
- $this->add(array(
- 'type' => 'Zend\Form\Element\DateTime',
- 'name' => 'dataInicial',
- 'options' => array(
- 'label' => 'Data inicial:',
- 'format' => 'd/m/Y'
- ),
- 'attributes' => array(
- 'class' => 'data'
- )
- ));
- $this->add(array(
- 'type' => 'Zend\Form\Element\DateTime',
- 'name' => 'dataFinal',
- 'options' => array(
- 'label' => 'Data final:',
- 'format' => 'd/m/Y'
- ),
- 'attributes' => array(
- 'class' => 'data',
- 'id' => 'dataFinal'
- )
- ));
- $this->add(array(
- 'type' => 'Zend\Form\Element\Checkbox',
- 'name' => 'extendido',
- 'options' => array(
- 'label' => 'Extendido'
- ),
- 'attributes' => array(
- 'id' => 'extendido'
- )
- ));
- $this->add(array(
- 'type' => 'Zend\Form\Element\Submit',
- 'name' => 'submit',
- 'attributes' => array(
- 'class' => 'submit',
- 'value' => 'Confirmar'
- )
- ));
- }
- public function getInputFilterSpecification()
- {
- return array();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment