Advertisement
Alfredao

Encargo Vigencia Form

Mar 7th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.20 KB | None | 0 0
  1. <?php
  2. namespace Cadastro\Form;
  3.  
  4. use Zend\Form\Form;
  5. use Zend\InputFilter\InputFilterProviderInterface;
  6. use Zend\Form\Element\Submit;
  7. use Zend\Form\Element\Text;
  8. use Application\Hydrator\ObjectHydrator;
  9.  
  10. /**
  11.  * Cadastro de custas
  12.  *
  13.  * @author Alfredo Costa
  14.  * @category Form
  15.  * @package Cadastro/Form
  16.  * @copyright 2014 P21 Sistemas
  17.  * @version 1.0.0
  18.  */
  19. class EncargoVigenciaForm extends Form implements InputFilterProviderInterface
  20. {
  21.  
  22.     /**
  23.      */
  24.     public function __construct($objectManager)
  25.     {
  26.         parent::__construct('custas');
  27.        
  28.         $this->setHydrator(new ObjectHydrator($objectManager))->setObject(new \Cadastro\Entity\EncargoVigencia());
  29.        
  30.         $this->add(array(
  31.             'type' => 'Zend\Form\Element\Hidden',
  32.             'name' => 'id'
  33.         ));
  34.        
  35.         // COMBO
  36.         $this->add(array(
  37.             'type' => 'DoctrineModule\Form\Element\ObjectSelect',
  38.             'name' => 'encargo',
  39.             'options' => array(
  40.                 'label' => 'Encargo',
  41.                 'object_manager' => $objectManager,
  42.                 'target_class' => 'Cadastro\Entity\Encargo',
  43.                 'display_empty_item' => true,
  44.                 'label_generator' => function ($encargo)
  45.                 {
  46.                     return $encargo->getNome();
  47.                 },
  48.                 'is_method' => true,
  49.                 'find_method' => array(
  50.                     'name' => 'findBy',
  51.                     'params' => array(
  52.                         'criteria' => array(),
  53.                         'orderBy' => array(
  54.                             'nome' => 'ASC'
  55.                         )
  56.                     )
  57.                 )
  58.             ),
  59.             'attributes' => array(
  60.                 'class' => 'form-control',
  61.                 'id' => 'encargo'
  62.             )
  63.         ));
  64.        
  65.         $this->add(array(
  66.             'type' => 'Zend\Form\Element\Collection',
  67.             'name' => 'valores',
  68.             'options' => array(
  69.                  'label' => 'Valores',
  70.                 'count' => 1,
  71.                 'target_element' => new EncargoValorFieldset($objectManager)
  72.             )
  73.         ));
  74.        
  75.         $this->add(array(
  76.             'type' => 'Zend\Form\Element\Date',
  77.             'name' => 'dataVigencia',
  78.             'options' => array(
  79.                 'label' => 'Data vigรชncia',
  80.                 'format' => 'd/m/Y'
  81.             ),
  82.             'attributes' => array(
  83.                 'class' => 'form-control form-control-inline input-medium date-picker'
  84.             )
  85.         ));
  86.        
  87.         $this->add(array(
  88.             'type' => 'Zend\Form\Element\Submit',
  89.             'name' => 'confirmar',
  90.             'attributes' => array(
  91.                 'class' => 'btn blue',
  92.                 'value' => 'Confirmar'
  93.             )
  94.         ));
  95.        
  96.         $this->add(array(
  97.             'type' => 'Zend\Form\Element\Submit',
  98.             'name' => 'cancelar',
  99.             'attributes' => array(
  100.                 'class' => 'btn default',
  101.                 'value' => 'Cancelar'
  102.             )
  103.         ));
  104.     }
  105.  
  106.     public function getInputFilterSpecification()
  107.     {
  108.         return array();
  109.     }
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement