public function __construct(EntityManager $em, OrmPublicador $publicador = null, OrmLogin $orm = null) { parent::__construct("formLogin"); // var_dump($option); // exit(); /* * txtID */ $txtId = new Element\Hidden("id"); /* * txtNome */ $txtEmail = new Element\Email("email"); $txtEmail->setAttributes(array('class' => 'form-control', 'placeholder' => 'Nome do Grupo', 'data-parsley-trigger' => 'change', 'required' => 'true')); /* * txtSenha */ $txtSenha = new Element\Password("senha"); $txtSenha->setAttributes(array('id' => "senha", 'class' => 'form-control', 'placeholder' => 'Nome do Grupo', 'required' => 'true', "data-parsley-trigger" => "change", "data-parsley-length" => "[6, 20]")); /* * txtSenhaConfirma */ $txtSenhaConfirma = new Element\Password("senhaconfirmar"); $txtSenhaConfirma->setAttributes(array('class' => 'form-control', 'placeholder' => 'Nome do Grupo', 'required' => 'true', "data-parsley-trigger" => "change", "data-parsley-equalto" => "#senha")); /* * cmbPublicador */ $dao = $em->getRepository('Stj\\Entity\\OrmPublicador'); if (empty($publicador)) { $lista = $dao->findAll(); } else { $lista = $dao->ListALLWhere($publicador->getGrupo()->getCongregacao()->getId()); } $option = array(); foreach ($lista as $key => $value) { $publicador = new OrmPublicador(); $publicador = $value; $option[$publicador->getId()] = $publicador->getNome(); } $cmbPublicador = new Element\Select('publicador'); $cmbPublicador->setValueOptions($option); $cmbPublicador->setEmptyOption("Selecionar"); $cmbPublicador->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * cmbNivel */ $dao = $em->getRepository('Stj\\Entity\\OrmNivel'); $lista = $dao->ListALL(FALSE); $option = array(); foreach ($lista as $key => $value) { $nivel = new OrmNivel(); $nivel = $value; $option[$nivel->getId()] = $nivel->getNome(); } $cmbNivel = new Element\Select('nivel'); $cmbNivel->setValueOptions($option); $cmbNivel->setEmptyOption("Selecionar"); $cmbNivel->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * Itoken */ $iToken = new Element\Csrf("iToken"); /* * btnSalvar */ $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 */ $btnVoltar = new Element\Button('voltar'); $btnVoltar->setAttributes(array('class' => 'btn btn-blue btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * Preencher Componentes */ if ($orm != null) { $txtId->setValue($orm->getId()); $txtEmail->setValue($orm->getEmail()); $cmbPublicador->setValue($orm->getPublicador()->getId()); $cmbNivel->setValue($orm->getNivel()->getId()); } // Adiciona componetes no form $this->add($txtId); $this->add($txtEmail); $this->add($txtSenha); $this->add($txtSenhaConfirma); $this->add($cmbPublicador); $this->add($cmbNivel); $this->add($iToken); $this->add($btnSalvar); $this->add($btnVoltar); $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL)); }
public function __construct(EntityManager $em, OrmPublicador $publicador) { parent::__construct("frmImprimi"); /* * cmbPublicador */ $dao = $em->getRepository('Stj\\Entity\\OrmPublicador'); if (empty($publicador)) { $lista = $dao->findAll(); } else { $lista = $dao->ListALLWhere($publicador->getGrupo()->getCongregacao()->getId()); } $option = array(); foreach ($lista as $key => $value) { $tipoPrivilegio = new OrmPublicador(); $tipoPrivilegio = $value; $option[$tipoPrivilegio->getId()] = $tipoPrivilegio->getNome(); } $cmbPublicador = new Element\Select('publicador'); $cmbPublicador->setValueOptions($option); $cmbPublicador->setEmptyOption("Selecionar"); $cmbPublicador->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * chkDados */ $chkDados = new Element\Checkbox('dados'); $chkDados->setAttributes(array('id' => "switch00", 'class' => 'onoffswitch-checkbox')); $chkDados->setValue(TRUE); /* * chkSetembro */ $chkSetembro = new Element\Checkbox('setembro'); $chkSetembro->setAttributes(array('id' => "switch01", 'class' => 'onoffswitch-checkbox')); $chkSetembro->setValue(TRUE); /* * $chkOutubro */ $chkOutubro = new Element\Checkbox('outubro'); $chkOutubro->setAttributes(array('id' => "switch02", 'class' => 'onoffswitch-checkbox')); $chkOutubro->setValue(TRUE); /* * $chkNovembro */ $chkNovembro = new Element\Checkbox('novembro'); $chkNovembro->setAttributes(array('id' => "switch03", 'class' => 'onoffswitch-checkbox')); $chkNovembro->setValue(TRUE); /* * $chkDezembro */ $chkDezembro = new Element\Checkbox('dezembro'); $chkDezembro->setAttributes(array('id' => "switch04", 'class' => 'onoffswitch-checkbox')); $chkDezembro->setValue(TRUE); /* * $chkJaneiro */ $chkJaneiro = new Element\Checkbox('janeiro'); $chkJaneiro->setAttributes(array('id' => "switch05", 'class' => 'onoffswitch-checkbox')); $chkJaneiro->setValue(TRUE); /* * $chkFevereiro */ $chkFevereiro = new Element\Checkbox('fevereiro'); $chkFevereiro->setAttributes(array('id' => "switch06", 'class' => 'onoffswitch-checkbox')); $chkFevereiro->setValue(TRUE); /* * $chkMarco */ $chkMarco = new Element\Checkbox('marco'); $chkMarco->setAttributes(array('id' => "switch07", 'class' => 'onoffswitch-checkbox')); $chkMarco->setValue(TRUE); /* * $chkAbril */ $chkAbril = new Element\Checkbox('abril'); $chkAbril->setAttributes(array('id' => "switch08", 'class' => 'onoffswitch-checkbox')); $chkAbril->setValue(TRUE); /* * $chkMaio */ $chkMaio = new Element\Checkbox('maio'); $chkMaio->setAttributes(array('id' => "switch09", 'class' => 'onoffswitch-checkbox')); $chkMaio->setValue(TRUE); /* * $chkJunho */ $chkJunho = new Element\Checkbox('junho'); $chkJunho->setAttributes(array('id' => "switch10", 'class' => 'onoffswitch-checkbox')); $chkJunho->setValue(TRUE); /* * $chkJulho */ $chkJulho = new Element\Checkbox('julho'); $chkJulho->setAttributes(array('id' => "switch11", 'class' => 'onoffswitch-checkbox')); $chkJulho->setValue(TRUE); /* * $chkAgosto */ $chkAgosto = new Element\Checkbox('agosto'); $chkAgosto->setAttributes(array('id' => "switch12", 'class' => 'onoffswitch-checkbox')); $chkAgosto->setValue(TRUE); /* * iToken */ $iToken = new Element\Csrf("iToken"); /* * btnImprimir */ $btnSalvar = new Element\Button('imprimir'); $btnSalvar->setAttributes(array('class' => 'btn btn-darkgray btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * btnVoltar */ $btnVoltar = new Element\Button('voltar'); $btnVoltar->setAttributes(array('class' => 'btn btn-blue btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * Adiciona Objetos ao form */ $this->add($cmbPublicador); $this->add($chkDados); $this->add($chkSetembro); $this->add($chkOutubro); $this->add($chkNovembro); $this->add($chkDezembro); $this->add($chkJaneiro); $this->add($chkFevereiro); $this->add($chkMarco); $this->add($chkAbril); $this->add($chkMaio); $this->add($chkJunho); $this->add($chkJulho); $this->add($chkAgosto); $this->add($iToken); $this->add($btnSalvar); $this->add($btnVoltar); /* * Form */ $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL)); }
public function __construct(EntityManager $em, OrmPublicador $orm = null, $publicador = null) { parent::__construct("formPublicador"); $dao = $em->getRepository('Stj\\Entity\\OrmGrupo'); if ($publicador == null) { $lista = $dao->findAll(); } else { $lista = $dao->ListALL(FALSE, $publicador->getGrupo()->getCongregacao()); } $option = array(); $grupoarray = array(); $i = 0; $nomeCongregacao = ""; foreach ($lista as $key => $value) { $grupo = new OrmGrupo(); $grupo = $value; if ($nomeCongregacao != "") { if ($grupo->getCongregacao()->getNome() == $nomeCongregacao) { $option[$grupo->getCongregacao()->getNome()]['options'][$grupo->getId()] = $grupo->getNome(); } else { $option[$grupo->getCongregacao()->getNome()] = array('label' => $grupo->getCongregacao()->getNome()); $option[$grupo->getCongregacao()->getNome()]['options'][$grupo->getId()] = $grupo->getNome(); } } else { $option[$grupo->getCongregacao()->getNome()] = array('label' => $grupo->getCongregacao()->getNome()); $option[$grupo->getCongregacao()->getNome()]['options'][$grupo->getId()] = $grupo->getNome(); } $nomeCongregacao = $grupo->getCongregacao()->getNome(); } /* * txtID */ $txtId = new Element\Hidden("id"); /* * txtNome */ $txtNome = new Element\Text("nome"); $txtNome->setAttributes(array('class' => 'form-control', 'placeholder' => 'Nome do Publicador', 'data-parsley-trigger' => 'change', 'pattern' => '^[aA-zZ]+((\\s[aA-zZ]+)+)?$', 'required' => 'true')); /* * cmbGrupo */ $cmbGrupo = new Element\Select('grupo'); $cmbGrupo->setValueOptions($option); $cmbGrupo->setEmptyOption("Escolha o grupo"); $cmbGrupo->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * cmbClasse */ $cmbClasse = new Element\Select('classe'); $cmbClasse->setValueOptions(array('OO' => 'Outra Ovelha', 'U' => 'Ungido')); $cmbClasse->setEmptyOption("Escolha a classe"); $cmbClasse->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * cmbSexo */ $cmbSexo = new Element\Select('sexo'); $cmbSexo->setValueOptions(array('M' => 'Masculino', 'F' => 'Feminino')); $cmbSexo->setEmptyOption("Escolha o sexo"); $cmbSexo->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * txtdataNascimento */ $txtNascimento = new Element\Text("nascimento"); $txtNascimento->setAttributes(array('class' => 'form-control', 'placeholder' => 'XX/XX/XXXX', 'max-length' => '10')); /* * txtdataEmissao */ $txtEmissao = new Element\Text("emissao"); $txtEmissao->setAttributes(array('class' => 'form-control', 'placeholder' => 'XX/XX/XXXX', 'max-length' => '10')); /* * txtTelefone */ $txtTelefone = new Element\Text("telefone"); $txtTelefone->setAttributes(array('class' => 'form-control', 'placeholder' => '(11)1234-1234', 'max-length' => '13', 'data-parsley-trigger' => "change", 'pattern' => "^\\([0-9]{2}\\)[0-9]{4}-[0-9]{4}")); /* * txtCelular */ $txtCelular = new Element\Text("celular"); $txtCelular->setAttributes(array('class' => 'form-control', 'placeholder' => '(11)12345-1234', 'max-length' => '14', 'data-parsley-trigger' => "change", 'pattern' => "^\\([0-9]{2}\\)[0-9]{5}-[0-9]{4}")); /* * txtCep */ $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')); /* * txtNumero */ $txtNumero = new Element\Text("numero"); $txtNumero->setAttributes(array('class' => 'form-control', 'placeholder' => 'Numero', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'max-length' => '6')); /* * txtLogradouro */ $txtLogradouro = new Element\Text("logradouro"); $txtLogradouro->setAttributes(array('class' => 'form-control', 'placeholder' => 'Ex: Rua, Avenida, Travessa...')); /* * txtComplemento */ $txtComplemento = new Element\Text("complemento"); $txtComplemento->setAttributes(array('class' => 'form-control', 'placeholder' => 'Ex: Rua, Avenida, Travessa...')); /* * txtBairro */ $txtBairro = new Element\Text("bairro"); $txtBairro->setAttributes(array('class' => 'form-control')); /* * txtCidade */ $txtCidade = new Element\Text("cidade"); $txtCidade->setAttributes(array('class' => 'form-control')); /* * txtUf */ $txtUf = new Element\Text("uf"); $txtUf->setAttributes(array('class' => 'form-control', 'max-length' => '2')); /* * Itoken */ $iToken = new Element\Csrf("iToken"); /* * btnSalvar */ $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 */ $btnVoltar = new Element\Button('voltar'); $btnVoltar->setAttributes(array('class' => 'btn btn-blue btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * Preencher Componentes */ if ($orm != null) { $txtId->setValue($orm->getId()); $txtNome->setValue($orm->getNome()); $cmbGrupo->setValue($orm->getGrupo()->getId()); $cmbClasse->setValue($orm->getClasse()); $cmbSexo->setValue($orm->getSexo()); if ($orm->getDtNascimento() != "") { $txtNascimento->setValue($orm->getDtNascimento()->format('d-m-Y')); } if ($orm->getDtEmissao() != "") { $txtEmissao->setValue($orm->getDtEmissao()->format('d-m-Y')); } $txtTelefone->setValue($orm->getTel()); $txtCelular->setValue($orm->getCel()); $txtCep->setValue($orm->getCep()); $txtNumero->setValue($orm->getNumero()); $txtLogradouro->setValue($orm->getLogradouro()); $txtComplemento->setValue($orm->getComplemento()); $txtBairro->setValue($orm->getBairro()); $txtCidade->setValue($orm->getCidade()); $txtUf->setValue($orm->getUf()); } // Adiciona componetes no form $this->add($txtId); $this->add($txtNome); $this->add($cmbGrupo); $this->add($cmbClasse); $this->add($cmbSexo); $this->add($txtNascimento); $this->add($txtEmissao); $this->add($txtTelefone); $this->add($txtCelular); $this->add($txtCep); $this->add($txtNumero); $this->add($txtLogradouro); $this->add($txtComplemento); $this->add($txtBairro); $this->add($txtCidade); $this->add($txtUf); $this->add($iToken); $this->add($btnSalvar); $this->add($btnVoltar); $this->add($cmbGrupo); $this->setAttributes(array('id' => 'form', 'action' => '/Publicador/Salvar', 'data-parsley-validate' => NULL)); }
/** * {@inheritDoc} */ public function getGrupo() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getGrupo', array()); return parent::getGrupo(); }