Exemple #1
0
 public function __construct(OrmCongregacao $orm = null)
 {
     parent::__construct("formProduto");
     $txtId = new Element\Hidden("id");
     $txtNome = new Element\Text("nome");
     $txtNome->setAttributes(array('class' => 'form-control', 'placeholder' => 'Nome da Congregação', 'data-parsley-trigger' => 'change', 'pattern' => '^[aA-zZ]+((\\s[aA-zZ]+)+)?$', 'required' => 'true'));
     $txtCep = new Element\Text("cep");
     $txtCep->setAttributes(array('class' => 'form-control', 'placeholder' => 'XXXXXXXX', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]{2}[0-9]{3}[0-9]{3}$/', 'max-length' => '8', 'required' => 'true'));
     $txtNumero = new Element\Text("numero");
     $txtNumero->setAttributes(array('class' => 'form-control', 'placeholder' => 'Numero', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'max-length' => '6', 'required' => 'true'));
     $txtLogradouro = new Element\Text("logradouro");
     $txtLogradouro->setAttributes(array('class' => 'form-control', 'placeholder' => 'Ex: Rua, Avenida, Travessa...', 'required' => 'true'));
     $txtBairro = new Element\Text("bairro");
     $txtBairro->setAttributes(array('class' => 'form-control', 'required' => 'true'));
     $txtCidade = new Element\Text("cidade");
     $txtCidade->setAttributes(array('class' => 'form-control', 'required' => 'true'));
     $txtUf = new Element\Text("uf");
     $txtUf->setAttributes(array('class' => 'form-control', 'max-length' => '2', 'required' => 'true'));
     $iToken = new Element\Csrf("iToken");
     $btnSalvar = new Element\Button('salvar');
     $btnSalvar->setAttributes(array('class' => 'btn btn-darkgray btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button'));
     $btnVoltar = new Element\Button('voltar');
     $btnVoltar->setAttributes(array('class' => 'btn btn-blue btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button'));
     if ($orm != null) {
         $txtId->setValue($orm->getId());
         $txtNome->setValue($orm->getNome());
         $txtCep->setValue($orm->getCep());
         $txtNumero->setValue($orm->getNumero());
         $txtLogradouro->setValue($orm->getLogradouro());
         $txtBairro->setValue($orm->getBairro());
         $txtCidade->setValue($orm->getCidade());
         $txtUf->setValue($orm->getUf());
     }
     //
     $this->add($txtId);
     $this->add($txtNome);
     $this->add($txtCep);
     $this->add($txtNumero);
     $this->add($txtLogradouro);
     $this->add($txtBairro);
     $this->add($txtCidade);
     $this->add($txtUf);
     $this->add($iToken);
     $this->add($btnSalvar);
     $this->add($btnVoltar);
     $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL));
 }
 /**
  * {@inheritDoc}
  */
 public function getCep()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCep', array());
     return parent::getCep();
 }