/** * returns a input element for the inline filter * * @param $elementName * @return string|\Zend\Form\ElementInterface */ public function showFilter($elementName) { $select = new Select($elementName); $select->setEmptyOption(''); $select->setValueOptions(array('0' => $this->view->translate('no'), '1' => $this->view->translate('yes'))); return $select; }
public function __construct($name = null) { parent::__construct('objetosform'); $this->setAttribute('method', 'post'); $this->setAttribute('role', 'form'); $this->setAttributes(array('id' => 'objetosform')); $objetos_actividad_id = new Element('objetos_actividad_id'); $objetos_actividad_id->setLabel('Actividad'); $objetos_actividad_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'objetos_actividad_id', 'readonly' => 'readonly', 'class' => 'form-control')); $objetos_id = new Element('objetos_id'); $objetos_id->setLabel('ID'); $objetos_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'objetos_id', 'readonly' => 'readonly', 'class' => 'form-control')); $objetos_nombre = new Element('objetos_nombre'); $objetos_nombre->setLabel('Nombre'); $objetos_nombre->setAttributes(array('type' => 'text', 'placeholder' => 'ej: wKER001', 'id' => 'objetos_nombre', 'class' => 'form-control')); $objetos_tipo = new Element\Select('objetos_tipo'); $objetos_tipo->setLabel('Tipo'); $objetos_tipo->setEmptyOption('Elige un Tipo..'); $objetos_tipo->setOptions(array('disable_inarray_validator' => true)); $objetos_tipo->setAttributes(array('id' => 'objetos_tipo', 'class' => "form-control")); $guardar = new Element\Button('guardar'); $guardar->setAttributes(array('class' => 'btn btn-success mr5', 'type' => 'submit', 'id' => 'guardar')); $guardar->setOptions(array('label' => '<i class="glyphicon glyphicon-floppy-disk"></i>', 'label_options' => array('disable_html_escape' => true))); $etiquetas_id = new Element\Hidden('etiquetas_id'); $etiquetas_id->setAttributes(array('id' => 'etiquetas_id')); $this->add($objetos_actividad_id); $this->add($objetos_id); $this->add($objetos_nombre); $this->add($objetos_tipo); $this->add($etiquetas_id); $this->add($guardar); }
/** * Initially loaded to display the list page's template * @return ViewModel */ public function listAction() { $categoryTree = $this->getServiceLocator()->get('category-tree'); $selectCategoryElement = new Select('filter_category'); $selectCategoryElement->setAttribute('id', 'filter_category'); $selectCategoryElement->setEmptyOption($this->translator->translate('All categories')); $selectCategoryElement->setValueOptions($categoryTree->getSelectOptions()); return new ViewModel(['selectCategory' => $selectCategoryElement, 'locale' => $this->translator->getLocale()]); }
public function __construct($name = null) { parent::__construct('actividadesform'); $this->setAttribute('method', 'post'); $this->setAttribute('role', 'form'); $this->setAttributes(array('id' => 'actividadesform')); $actividades_id = new Element('actividades_id'); $actividades_id->setLabel('ID'); $actividades_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'actividades_id', 'readonly' => 'readonly', 'class' => 'form-control')); $actividades_nombre = new Element('actividades_nombre'); $actividades_nombre->setLabel('Nombre'); $actividades_nombre->setAttributes(array('type' => 'text', 'placeholder' => 'ej: Mi Primera Actividad', 'id' => 'actividades_nombre', 'class' => 'form-control')); $actividades_estado = new Element\Select('actividades_estado'); $actividades_estado->setLabel('Estado'); //$actividades_estado->setEmptyOption('ELige un Estado..'); $actividades_estado->setOptions(array('disable_inarray_validator' => true)); $actividades_estado->setAttributes(array('id' => 'actividades_estado', 'class' => "form-control", 'data-rule-required' => "true", 'data-msg-required' => "Debe seleccionar el Estado")); $actividades_responsable = new Element\Select('actividades_responsable'); $actividades_responsable->setLabel('Responsable'); // $actividades_responsable->setEmptyOption('Elige un Responsable..'); $actividades_responsable->setOptions(array('disable_inarray_validator' => true)); $actividades_responsable->setAttributes(array('id' => 'actividades_responsable', 'class' => "form-control")); $actividades_area = new Element\Select('actividades_area'); $actividades_area->setLabel('Área'); $actividades_area->setEmptyOption('Elige una Área..'); $actividades_area->setOptions(array('disable_inarray_validator' => true)); $actividades_area->setAttributes(array('id' => 'actividades_area', 'class' => "form-control")); $actividades_reporta = new Element('actividades_reporta'); $actividades_reporta->setLabel('Reportada Por'); $actividades_reporta->setAttributes(array('type' => 'text', 'placeholder' => 'Persona que reporta', 'id' => 'actividades_reporta', 'class' => 'form-control')); $actividades_fecha = new Element('actividades_fecha'); $actividades_fecha->setLabel('Fecha de Inicio'); $actividades_fecha->setAttributes(array('placeholder' => 'Fecha de Inicio', 'id' => 'actividades_fecha', 'class' => 'form-control')); $actividades_fecha_fin = new Element('actividades_fecha_fin'); $actividades_fecha_fin->setLabel('Fecha de Finalización'); $actividades_fecha_fin->setAttributes(array('placeholder' => 'Fecha de Finalización', 'id' => 'actividades_fecha_fin', 'class' => 'form-control')); $guardar = new Element\Button('guardar'); $guardar->setAttributes(array('class' => 'btn btn-success mr5', 'type' => 'submit', 'id' => 'guardar')); $guardar->setOptions(array('label' => '<i class="glyphicon glyphicon-floppy-disk"></i>', 'label_options' => array('disable_html_escape' => true))); $this->add($actividades_id); $this->add($actividades_nombre); $this->add($actividades_fecha); $this->add($actividades_estado); $this->add($actividades_responsable); $this->add($actividades_area); $this->add($actividades_reporta); $this->add($actividades_fecha_fin); $this->add($guardar); }
public function init() { $uom = new Select('uom'); $uom->setAttribute('id', 'uom'); $uom->setAttribute('title', $this->translator->translate('web.form.article.uom.title')); $uom->setAttribute('class', 'form-control'); $uom->setEmptyOption($this->translator->translate('web.form.article.uom.emptyOption')); $uom->setValueOptions($this->getUomValues()); $uom->setLabel($this->translator->translate('web.form.article.uom.label')); $this->add($uom); $name = new Text('name'); $name->setAttribute('id', 'name'); $name->setAttribute('title', $this->translator->translate('web.form.article.name.title')); $name->setAttribute('class', 'form-control'); $name->setAttribute('placeholder', $this->translator->translate('web.form.article.name.placeholder')); $name->setLabel($this->translator->translate('web.form.article.name.label')); $this->add($name); $code = new Text('code'); $code->setAttribute('id', 'code'); $code->setAttribute('title', $this->translator->translate('web.form.article.code.title')); $code->setAttribute('class', 'form-control'); $code->setAttribute('placeholder', $this->translator->translate('web.form.article.code.placeholder')); $code->setLabel($this->translator->translate('web.form.article.code.label')); $this->add($code); $salesPrice = new Text('salesPrice'); $salesPrice->setAttribute('id', 'salesPrice'); $salesPrice->setAttribute('class', 'form-control'); $salesPrice->setAttribute('title', $this->translator->translate('web.form.article.salesPrice.title')); $salesPrice->setAttribute('placeholder', $this->translator->translate('web.form.article.salesPrice.placeholder')); $salesPrice->setLabel($this->translator->translate('web.form.article.salesPrice.label')); $this->add($salesPrice); $qty = new Text('qty'); $qty->setAttribute('id', 'qty'); $qty->setAttribute('class', 'form-control'); $qty->setAttribute('title', $this->translator->translate('web.form.article.qty.title')); $qty->setAttribute('placeholder', $this->translator->translate('web.form.article.qty.placeholder')); $qty->setLabel($this->translator->translate('web.form.article.qty.label')); $this->add($qty); $description = new Text('description'); $description->setAttribute('id', 'description'); $description->setAttribute('title', $this->translator->translate('web.form.article.description.title')); $description->setAttribute('class', 'form-control'); $description->setAttribute('placeholder', $this->translator->translate('web.form.article.description.placeholder')); $description->setLabel($this->translator->translate('web.form.article.description.label')); $this->add($description); return $this; }
public function __construct(EntityManager $em, $name = null, $options = array()) { $this->em = $em; // we want to ignore the name passed parent::__construct('vehiclemodel'); $this->setAttribute('method', 'post'); $this->add(array('name' => 'vehicleModelId', 'attributes' => array('type' => 'hidden'))); $vehicleBrand = new Element\Select('vehicleBrandId'); $vehicleBrand->setAttributes(array('class' => 'dropDnInput')); $vehicleBrand->setEmptyOption("Select Brand"); $vehicleBrand->setValueOptions($this->getOptionsForSelectBrands()); $vehicleBrand->setDisableInArrayValidator(TRUE); $this->add($vehicleBrand); $this->add(array('name' => 'vehicleModelName', 'attributes' => array('type' => 'text', 'class' => 'commonDropDnInput', 'placeholder' => 'Vehicle Model Name'))); $this->add(array('name' => 'status', 'type' => 'Select', 'attributes' => array('class' => 'dropDnInput'), 'options' => array('empty_option' => 'Select Status', 'value_options' => array('0' => 'InActive', '1' => 'Active')))); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'vehiclModeladd', 'id' => 'submitbutton', 'class' => "btn-blue"))); }
public function __invoke() { $serviceManager = $this->getServiceLocator()->getServiceLocator()->get('UthandoServiceManager'); /* @var $menuItemMapper \UthandoNavigation\Service\MenuItem */ $menuItemMapper = $serviceManager->get('UthandoNavigationMenuItem'); $menuItems = $menuItemMapper->fetchAll(); /* @var $menuMapper \UthandoNavigation\Service\Menu */ $menuMapper = $serviceManager->get('UthandoNavigationMenu'); $menus = $menuMapper->fetchAll(); $select = new Element\Select('position'); $menuItemsOptions = []; $menuArray = []; foreach ($menus as $menu) { $menuArray[$menu->getMenuId()] = $menu->getMenu(); $menuItemsOptions[$menu->getMenuId()]['options'][$menu->getMenuId() . '-' . '0'] = 'At top of this menu'; $menuItemsOptions[$menu->getMenuId()]['empty_option'] = '---Please Select a page---'; $menuItemsOptions[$menu->getMenuId()]['label'] = $menu->getMenu(); } /* @var $page \UthandoNavigation\Model\MenuItem */ foreach ($menuItems as $menuItem) { $ident = $menuItem->getDepth() > 0 ? str_repeat('%space%%space%', $menuItem->getDepth()) . '%bull%%space%' : ''; $menuItemsOptions[$menuItem->getMenuId()]['options'][$menuItem->getMenuId() . '-' . $menuItem->getMenuItemId()] = $ident . $menuItem->getLabel(); } $select = new Element\Select('position'); $select->setLabel('Location In Menu:'); $select->setValueOptions($menuItemsOptions); $select->setEmptyOption('Please select a Position'); $select->setAttribute('class', 'form-control'); $element = $this->view->plugin('formElement'); $errors = $this->view->plugin('formElementErrors'); $html = $element($select); $html = str_replace('%space%', ' ', $html); $html = str_replace('%bull%', '•', $html); $html = '<div class="form-group"> <label class="col-sm-4 control-label" for="position">' . $select->getLabel() . '</label> <div class="col-sm-8">' . $html . ' <span class="help-block">' . $errors($select, ["class" => "unstyled"]) . ' </span> </div> </div>'; return $html; }
public function __construct($name = NULL) { parent::__construct($name); $this->setAttribute('method', 'post'); $this->add(array('name' => 'nombre', 'options' => array('label' => 'Empresa'), 'attributes' => array('type' => 'text', 'placeholder' => 'Tu Empresa', 'class' => 'input'))); $this->add(array('type' => 'Zend\\Form\\Element\\Email', 'name' => 'email', 'options' => array('label' => 'Email'), 'attributes' => array('placeholder' => '*****@*****.**'))); $this->add(array('type' => 'textarea', 'name' => 'servicios', 'options' => array('label' => 'Servicios'), 'attributes' => array('placeholder' => 'Que ofrece tu empresa', 'rows' => '10'))); $this->add(array('type' => 'submit', 'name' => 'send', 'attributes' => array('value' => 'Publicar', 'class' => 'btn btn-lg btn-primary btn-block'))); $this->add(array('type' => 'file', 'name' => 'file', 'attributes' => array('id' => 'file'))); //* Campo tipo password $this->add(array('name' => 'password', 'options' => array('label' => 'Empresa'), 'attributes' => array('type' => 'password', 'placeholder' => 'password', 'class' => 'input'))); $paquete = new Element\Radio('paquete'); $paquete->setLabel("Paquete:"); $paquete->setValueOptions(array('0' => 'Gratuito :: $0.00', '1' => utf8_encode('Básico :: $50.00 Mensual'), '2' => 'Estandard :: $300.00 Mensual', '3' => 'Premium :: $589.00 Mensual')); $this->add($paquete); $ciudad = new Element\Select('ciudad'); $ciudad->setLabel("Ciudad:"); $ciudad->setEmptyOption('Seleccione la ciudad...'); $ciudad->setValueOptions(array('Xalapa' => 'Xalapa', 'Veracruz' => 'Veracruz', 'Actopan' => 'Actopan', 'Coatzacoalcos' => 'Coatzacoalcos')); $this->add($ciudad); }
public function __construct(EntityManager $em, $name = null, $options = array()) { $this->em = $em; parent::__construct('toll'); $this->setAttribute('method', 'post'); $this->add(array('name' => 'tollName', 'attributes' => array('type' => 'text', 'class' => 'commonDropDnInput', 'placeholder' => 'Toll Name'))); $city = new Element\Select('cityId'); $city->setEmptyOption("Select City Name"); $city->setAttributes(array("id" => "cityId")); $city->setAttributes(array("class" => "dropDnInput")); // $city->setAttributes(array('onChange'=>'setter("city",this.options[this.selectedIndex].text)','class'=>'dropDnInput')); $city->setValueOptions($this->getOptionsForSelectCity()); $this->add($city); $locationId = new Element\Select('locationId'); $locationId->setEmptyOption("Select Location Name"); // $locationId->setAttributes("id","location"); $locationId->setAttributes(array("id" => "location")); $locationId->setAttributes(array("class" => "dropDnInput")); // $locationId->setAttributes(array('onChange'=>'setter("city",this.options[this.selectedIndex].text)','class'=>'dropDnInput')); $locationId->setValueOptions($this->getOptionsForSelectLocation()); $locationId->setDisableInArrayValidator(true); $this->add($locationId); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Go', 'id' => 'submitbutton', 'class' => "btn-blue"))); }
/** * Set the string for an empty option (can be empty string). If set to null, no option will be added * * @param string|null $emptyOption * @return Select */ public function setEmptyOption($emptyOption) { parent::setEmptyOption($emptyOption); $this->appendEmptyInArray($this->validator); return $this; }
public function caricaAction() { $posId = (int) $this->getRequest()->getPost('posId', 0); $posizione = new Element\Select('posizione'); $posizione->setLabel('Posizione'); $posizione->setEmptyOption('Seleziona una posizione =>'); $posizione->setValueOptions($this->getContenutiDao()->listaPosizioni($posId)); $view = new ViewModel(array('selectPosizione' => $posizione)); $view->setTerminal(true); return $view; }
public function testCanMarkOptionsAsSelectedWhenEmptyOptionOrZeroValueSelected() { $element = new SelectElement('foo'); $element->setEmptyOption('empty'); $element->setValueOptions(array(0 => 'label0', 1 => 'label1')); $element->setValue(''); $markup = $this->helper->render($element); $this->assertContains('<option value="" selected="selected">empty</option>', $markup); $this->assertContains('<option value="0">label0</option>', $markup); $element->setValue('0'); $markup = $this->helper->render($element); $this->assertContains('<option value="">empty</option>', $markup); $this->assertContains('<option value="0" selected="selected">label0</option>', $markup); }
public function __construct(EntityManager $em, OrmPublicador $tipoPrivilegio = null, OrmPrivilegios $orm = null) { parent::__construct("formPrivilegios"); // var_dump($option); // exit(); /* * txtID */ $txtId = new Element\Hidden("id"); /* * txtNome */ $txtDataInicio = new Element\Text("dataInicio"); $txtDataInicio->setAttributes(array('class' => 'form-control', 'placeholder' => 'XX/XX/XXXX', 'max-length' => '10', 'required' => 'true')); $txtDataTermino = new Element\Text("dataTermino"); $txtDataTermino->setAttributes(array('class' => 'form-control', 'placeholder' => 'XX/XX/XXXX', 'max-length' => '10')); /* * cmbPublicador */ $dao = $em->getRepository('Stj\\Entity\\OrmPublicador'); if (empty($tipoPrivilegio)) { $lista = $dao->findAll(); } else { $lista = $dao->ListALLWhere($tipoPrivilegio->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')); /* * cmbPrivilegio */ $dao = $em->getRepository('Stj\\Entity\\OrmTipoPrivilegios'); $lista = $dao->findAll(); $option = array(); foreach ($lista as $key => $value) { $tipoPrivilegio = new OrmTipoPrivilegios(); $tipoPrivilegio = $value; $option[$tipoPrivilegio->getId()] = $tipoPrivilegio->getNome(); } $cmbPrivilegio = new Element\Select('privilegio'); $cmbPrivilegio->setValueOptions($option); $cmbPrivilegio->setEmptyOption("Selecionar"); $cmbPrivilegio->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()); $txtDataInicio->setValue($orm->getDataInicio() != "" ? $orm->getDataInicio()->format('d/m/Y') : ""); $txtDataTermino->setValue($orm->getDataTermino() != "" ? $orm->getDataTermino()->format('d/m/Y') : ""); $cmbPrivilegio->setValue($orm->getTipoPrivilegio()->getId()); $cmbPublicador->setValue($orm->getPublicador()->getId()); } // Adiciona componetes no form $this->add($txtId); $this->add($txtDataInicio); $this->add($txtDataTermino); $this->add($cmbPublicador); $this->add($cmbPrivilegio); $this->add($iToken); $this->add($btnSalvar); $this->add($btnVoltar); $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL)); }
public function testNullEmptyOptionDoesNotRenderEmptyOption() { $element = new SelectElement('foo'); $element->setEmptyOption(null); $element->setValueOptions(array(array('label' => 'label1', 'value' => 'value1'))); $markup = $this->helper->render($element); $this->assertNotContains('<option value=""></option>', $markup); }
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)); }
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(ObjectManager $objectManager) { parent::__construct('register'); $this->filter = new InputFilter(); $primary = new Element\Hidden('primary'); $this->add($primary); $callName = new Element\Text('callName'); $callName->setAttribute('required', true); $callName->setAttribute('placeholder', 'Call Name'); $this->add($callName); $callNameFilter = new Input('callName'); $callNameFilter->setRequired(true); $callNameFilter->getFilterChain()->attach(new AppFilter\TitleCase()); $callNameFilter->getFilterChain()->attach(new Filter\StringTrim()); $callNameFilter->getFilterChain()->attach(new Filter\StripTags()); $callNameFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 15))); $callNameFilter->getValidatorChain()->attach(new LocaleValidator\Alpha(array('allowWhiteSpace' => true))); $this->filter->add($callNameFilter); $regName = new Element\Text('regName'); $regName->setAttribute('placeholder', 'Registered Name'); $this->add($regName); $regNameFilter = new Input('regName'); $regNameFilter->setRequired(false); $regNameFilter->getFilterChain()->attach(new AppFilter\TitleCase()); $regNameFilter->getFilterChain()->attach(new Filter\StringTrim()); $regNameFilter->getFilterChain()->attach(new Filter\StripTags()); $regNameFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 50))); $regNameFilter->getValidatorChain()->attach(new Validator\Regex("/^[a-z][a-z\\'\\- ]*\$/i")); $this->filter->add($regNameFilter); $sex = new Element\Select('sex'); $sex->setAttribute('required', true); $sex->setValueOptions(array(1 => 'Male', 2 => 'Female')); $sex->setEmptyOption('Select a Sex'); $this->add($sex); $sexFilter = new Input('sex'); $sexFilter->setRequired(true); $this->filter->add($sexFilter); $breed = new AppElement\ObjectLiveSearch('breed'); $breed->setOption('object_manager', $objectManager); $breed->setOption('target_class', 'Application\\Entity\\Breed'); $breed->setOption('find_method', array('name' => 'findBy', 'params' => array('criteria' => array(), 'orderBy' => array('name' => 'ASC')))); $breed->setEmptyOption('Select a Breed'); $this->add($breed); $breedFilter = new Input('breed'); $breedFilter->setRequired(true); $this->filter->add($breedFilter); $dateOfBirth = new Element\Date('dateOfBirth'); $dateOfBirth->setAttribute('required', true); $dateOfBirth->setAttribute('data-placeholder', 'Date of Birth'); // placeholder attr is invalid for date input $dateOfBirth->setAttribute('data-mask', '0000-00-00'); $dateOfBirth->setAttribute('class', 'datepicker'); $this->add($dateOfBirth); $dateOfBirthFilter = new Input('dateOfBirth'); $dateOfBirthFilter->setRequired(true); $dateOfBirthFilter->getValidatorChain()->attach(new Validator\Date()); $this->filter->add($dateOfBirthFilter); $height = new Element\Number('height'); $height->setAttribute('required', true); $height->setAttribute('placeholder', 'Height (Inches)'); $this->add($height); $heightFilter = new Input('height'); $heightFilter->setRequired(true); $heightFilter->getValidatorChain()->attach(new Validator\Between(array('min' => 6, 'max' => 30))); $this->filter->add($heightFilter); $champion = new Element\Checkbox('champion'); $champion->setLabel('Dog is a champion of record.'); $this->add($champion); $championFilter = new Input('champion'); $championFilter->setRequired(false); $this->filter->add($championFilter); $rescue = new Element\Checkbox('rescue'); $rescue->setLabel('Dog is a rescue.'); $this->add($rescue); $rescueFilter = new Input('rescue'); $rescueFilter->setRequired(false); $this->filter->add($rescueFilter); $buttons = new Form('buttons'); $buttons->setOption('twb-layout', 'inline'); $buttons->setAttribute('class', 'form-group'); $submit = new Element\Submit('submit'); $submit->setAttribute('class', 'btn-primary pull-right'); $submit->setOption('glyphicon', 'circle-arrow-up'); $submit->setLabel('Register'); $buttons->add($submit); $cancel = new Element\Submit('cancel'); $cancel->setAttribute('formnovalidate', true); $cancel->setAttribute('class', 'btn-warning pull-right'); $cancel->setOption('glyphicon', 'ban-circle'); $cancel->setLabel('Cancel'); $buttons->add($cancel); $this->add($buttons); }
public function __construct(EntityManager $em) { parent::__construct("formEstudante"); // var_dump($option); // exit(); /* * txtID */ $txtId = new Element\Hidden("id"); /* * cmbPublicador */ $dao = $em->getRepository('Stj\\Entity\\OrmEstudante'); $lista = $dao->findBy(array("status" => FALSE, "ciclo" => FALSE)); $option = array(); foreach ($lista as $key => $value) { $estudante = new OrmEstudante(); $estudante = $value; $option[$estudante->getId()] = $estudante->getPublicador()->getNome(); } $cmbEstudante = new Element\Select('estudante'); $cmbEstudante->setValueOptions($option); $cmbEstudante->setEmptyOption("Selecionar"); $cmbEstudante->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); $dao = $em->getRepository('Stj\\Entity\\OrmEstudante'); $lista = $dao->findBy(array("status" => FALSE)); $option = array(); foreach ($lista as $key => $value) { $estudante = new OrmEstudante(); $estudante = $value; $option[$estudante->getId()] = $estudante->getPublicador()->getNome(); } /* * $cmbAjudante */ $cmbAjudante = new Element\Select('ajudante'); $cmbAjudante->setValueOptions($option); $cmbAjudante->setEmptyOption("Selecionar"); $cmbAjudante->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * $cmbSubstitutoEstudante */ $cmbSubstitutoEstudante = new Element\Select('substitutoEstudante'); $cmbSubstitutoEstudante->setValueOptions($option); $cmbSubstitutoEstudante->setEmptyOption("Selecionar"); $cmbSubstitutoEstudante->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * $cmbSubstitutoAjudante */ $cmbSubstitutoAjudante = new Element\Select('substitutoAjudante'); $cmbSubstitutoAjudante->setValueOptions($option); $cmbSubstitutoAjudante->setEmptyOption("Selecionar"); $cmbSubstitutoAjudante->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * $txtData */ $txtData = new Element\Text("data"); $txtData->setAttributes(array('class' => 'form-control', 'placeholder' => 'XX/XX/XXXX', 'max-length' => '10', 'required' => 'true')); $dao = $em->getRepository('Stj\\Entity\\OrmCaracteristicaOratoria'); $lista = $dao->findAll(); $option = array(); foreach ($lista as $key => $value) { $oratoria = new \Stj\Entity\OrmCaracteristicaOratoria(); $oratoria = $value; $option[$oratoria->getId()] = $oratoria->getId() . ' - ' . $oratoria->getCaracteristica(); } $cmbOratoria = new Element\Select("oratoria"); $cmbOratoria->setValueOptions($option); $cmbOratoria->setEmptyOption("Selecionar"); $cmbOratoria->setAttributes(array('class' => 'chosen-select', 'style' => 'width:175px;', 'required' => 'true')); /* * $chkDesignação */ $dao = $em->getRepository('Stj\\Entity\\OrmDesignacao'); $lista = $dao->findAll(); $option = array(); $this->listachk = array(); foreach ($lista as $key => $value) { $designacao = new \Stj\Entity\OrmDesignacao(); $designacao = $value; $this->listachk[$designacao->getId()]["id"] = $designacao->getId(); $this->listachk[$designacao->getId()]["nome"] = $designacao->getNome(); } $dao = $em->getRepository('Stj\\Entity\\OrmLocal'); $lista = $dao->findAll(); $option = array(); $this->localchk = array(); foreach ($lista as $key => $value) { $local = new \Stj\Entity\OrmLocal(); $local = $value; $this->localchk[$local->getId()]["id"] = $local->getId(); $this->localchk[$local->getId()]["nome"] = $local->getNome(); } /* * $txtoutros */ $txtoutros = new Element\Text("outros"); $txtoutros->setAttributes(array('class' => 'form-control underline-input', 'placeholder' => 'Titulo da designação')); /* * 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()); // } // Adiciona componetes no form $this->add($txtId); $this->add($cmbEstudante); $this->add($cmbAjudante); $this->add($txtData); $this->add($cmbOratoria); $this->add($cmbSubstitutoEstudante); $this->add($cmbSubstitutoAjudante); $this->add($txtoutros); $this->add($iToken); $this->add($btnSalvar); $this->add($btnVoltar); $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL)); }
public function init() { $customer = new Select('customer'); $customer->setAttribute('id', 'customer'); $customer->setAttribute('title', $this->translator->translate('web.form.document.customer.title')); $customer->setAttribute('class', 'form-control'); $customer->setEmptyOption($this->translator->translate('web.form.document.customer.emptyOption')); $customer->setValueOptions($this->getCustomerValues()); $customer->setLabel($this->translator->translate('web.form.document.customer.label')); $this->add($customer); $supplier = new Select('supplier'); $supplier->setAttribute('id', 'supplier'); $supplier->setAttribute('title', $this->translator->translate('web.form.document.supplier.title')); $supplier->setAttribute('class', 'form-control'); $supplier->setEmptyOption($this->translator->translate('web.form.document.supplier.emptyOption')); $supplier->setValueOptions($this->getSupplierValues()); $supplier->setLabel($this->translator->translate('web.form.document.supplier.label')); $this->add($supplier); $paymentType = new Select('paymentType'); $paymentType->setAttribute('id', 'paymentType'); $paymentType->setAttribute('title', $this->translator->translate('web.form.document.paymentMethod.title')); $paymentType->setAttribute('class', 'form-control'); $paymentType->setEmptyOption($this->translator->translate('web.form.document.paymentMethod.emptyOption')); $paymentType->setValueOptions(Document::$paymentTypes); $paymentType->setLabel($this->translator->translate('web.form.document.paymentMethod.label')); $this->add($paymentType); $vat = new Select('vat'); $vat->setAttribute('id', 'vat'); $vat->setAttribute('title', $this->translator->translate('web.form.document.vat.title')); $vat->setAttribute('class', 'form-control'); $vat->setEmptyOption($this->translator->translate('web.form.document.vat.emptyOption')); $vat->setValueOptions($this->getVatValues()); $vat->setLabel($this->translator->translate('web.form.document.vat.label')); $this->add($vat); $docDate = new Date('docDate'); $docDate->setAttributes(array('id' => 'docDate', 'type' => 'text', 'class' => 'input datepicker form-control', 'data-date-weekstart' => 1, 'data-date-format' => 'dd.mm.yyyy')); $docDate->setAttribute('title', $this->translator->translate('web.form.document.docDate.title')); $docDate->setAttribute('readonly', 'readonly'); $docDate->setAttribute('placeholder', $this->translator->translate('web.form.document.docDate.placeholder')); $docDate->setLabel($this->translator->translate('web.form.document.docDate.label')); $this->add($docDate); $supplierDocNumber = new Text('supplierDocNumber'); $supplierDocNumber->setAttribute('id', 'supplierDocNumber'); $supplierDocNumber->setAttribute('title', $this->translator->translate('web.form.document.supplierDocNumber.title')); $supplierDocNumber->setAttribute('class', 'form-control'); $supplierDocNumber->setAttribute('placeholder', $this->translator->translate('web.form.document.supplierDocNumber.placeholder')); $supplierDocNumber->setLabel($this->translator->translate('web.form.document.supplierDocNumber.label')); $this->add($supplierDocNumber); $deadlineDays = new Text('deadlineDays'); $deadlineDays->setAttribute('id', 'deadlineDays'); $deadlineDays->setAttribute('title', $this->translator->translate('web.form.document.deadlineDays.title')); $deadlineDays->setAttribute('class', 'form-control'); $deadlineDays->setAttribute('placeholder', $this->translator->translate('web.form.document.deadlineDays.placeholder')); $deadlineDays->setLabel($this->translator->translate('web.form.document.deadlineDays.label')); $this->add($deadlineDays); $delayPercent = new Text('delayPercent'); $delayPercent->setAttribute('id', 'delayPercent'); $delayPercent->setAttribute('class', 'form-control'); $delayPercent->setAttribute('title', $this->translator->translate('web.form.document.delayPercent.title')); $delayPercent->setAttribute('placeholder', $this->translator->translate('web.form.document.delayPercent.placeholder')); $delayPercent->setLabel($this->translator->translate('web.form.document.delayPercent.label')); $this->add($delayPercent); $amount = new Text('amount'); $amount->setAttribute('id', 'amount'); $amount->setAttribute('title', $this->translator->translate('web.form.document.amount.title')); $amount->setAttribute('class', 'form-control'); $amount->setAttribute('readonly', 'readonly'); $amount->setAttribute('placeholder', $this->translator->translate('web.form.document.amount.placeholder')); $amount->setLabel($this->translator->translate('web.form.document.amount.label')); $this->add($amount); $taxAmount = new Text('taxAmount'); $taxAmount->setAttribute('id', 'taxAmount'); $taxAmount->setAttribute('title', $this->translator->translate('web.form.document.taxAmount.title')); $taxAmount->setAttribute('class', 'form-control'); $taxAmount->setAttribute('readonly', 'readonly'); $taxAmount->setAttribute('placeholder', $this->translator->translate('web.form.document.taxAmount.placeholder')); $taxAmount->setLabel($this->translator->translate('web.form.document.taxAmount.label')); $this->add($taxAmount); $comment = new Textarea('comment'); $comment->setAttribute('id', 'comment'); $comment->setAttribute('title', $this->translator->translate('web.form.document.comment.title')); $comment->setAttribute('class', 'form-control'); $comment->setAttribute('cols', 15); $comment->setAttribute('rows', 4); $comment->setAttribute('placeholder', $this->translator->translate('web.form.document.comment.placeholder')); $comment->setLabel($this->translator->translate('web.form.document.comment.label')); $this->add($comment); $amountTax = new Text('amountTax'); $amountTax->setAttribute('id', 'amountTax'); $amountTax->setAttribute('title', $this->translator->translate('web.form.document.amountTax.title')); $amountTax->setAttribute('class', 'form-control'); $amountTax->setAttribute('readonly', 'readonly'); $amountTax->setAttribute('placeholder', $this->translator->translate('web.form.document.amountTax.placeholder')); $amountTax->setLabel($this->translator->translate('web.form.document.amountTax.label')); $this->add($amountTax); return $this; }
public function sessioniAction() { if (!$this->request->isPost()) { return "error"; } $catId = (int) $this->getRequest()->getPost("catId", 0); // $ver = $this->getInterattivoDao()->obtenerSessioniSelect($idposterlab); // Crear y configurar el elemento pais: $producto = new Element\Select('categoria'); $producto->setLabel('categoria'); $producto->setEmptyOption('Seleccione una Sessione =>'); $producto->setValueOptions($this->getInterattivoDao()->obtenerSessioniSelect($catId)); $view = new ViewModel(array('selectProducto' => $producto)); $view->setTerminal(true); return $view; }
public function __construct(EntityManager $em, $publicador = null, OrmGrupo $orm = null) { parent::__construct("formGrupo"); $dao = $em->getRepository('Stj\\Entity\\OrmCongregacao'); $lista = $dao->findAll(); $option = array(); foreach ($lista as $key => $value) { $congregacao = new OrmCongregacao(); $congregacao = $value; $option[$congregacao->getId()] = $congregacao->getNome(); } // var_dump($option); // exit(); /* * txtID */ $txtId = new Element\Hidden("id"); /* * txtNome */ $txtNome = new Element\Text("nome"); $txtNome->setAttributes(array('class' => 'form-control', 'placeholder' => 'Nome do Grupo', 'data-parsley-trigger' => 'change', 'pattern' => '^[aA-zZ0-9]+((\\s[aA-zZ0-9]+)+)?$', 'required' => 'true')); /* * cmbCongregacao */ $cmbCongregacao = new Element\Select('congregacao'); $cmbCongregacao->setValueOptions($option); $cmbCongregacao->setEmptyOption("Escolha a congregação"); $cmbCongregacao->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * 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()); $cmbCongregacao->setValue($orm->getCongregacao()->getId()); $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); if (empty($publicador)) { $this->add($cmbCongregacao); } $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->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL)); }
public function __construct(EntityManager $em, OrmRelatorio $orm = null) { parent::__construct("formRelatorio"); /* * txtID */ $txtId = new Element\Hidden("id"); /* * txtAno */ $option = array(); $ano = 0; if (date("m") >= 9) { $ano = 1; } $ano = $ano + date("Y"); $option[$ano] = $ano; $option[$ano - 1] = $ano - 1; $cmbAno = new Element\Select('ano'); $cmbAno->setValueOptions($option); $cmbAno->setEmptyOption("Escolha o ano"); $cmbAno->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * txtMes */ setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese'); date_default_timezone_set('America/Sao_Paulo'); $option = array(); for ($index = 1; $index < 13; $index++) { $option[$index] = strftime("%B", strtotime(date("Y") . "/" . $index . "/01")); } $cmbMes = new Element\Select('mes'); $cmbMes->setValueOptions($option); $cmbMes->setEmptyOption("Escolha o ano"); $cmbMes->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * cmbPublicador */ $dao = $em->getRepository('Stj\\Entity\\OrmPublicador'); $lista = $dao->findAll(); $option = array(); foreach ($lista as $key => $value) { $congregacao = new OrmCongregacao(); $congregacao = $value; $option[$congregacao->getId()] = $congregacao->getNome(); } $cmbPublicador = new Element\Select('publicador'); $cmbPublicador->setValueOptions($option); $cmbPublicador->setEmptyOption("Escolha o publicador"); $cmbPublicador->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * txtLivros */ $txtPublicacoes = new Element\Number("publicacoes"); $txtPublicacoes->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "3", 'required' => 'true')); /* * $txtVideos */ $txtVideos = new Element\Number("videos"); $txtVideos->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "3", 'required' => 'true')); /* * $txtPublicacoes */ $txtHoras = new Element\Text("horas"); $txtHoras->setAttributes(array('class' => 'form-control', 'placeholder' => 'HH:MM', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+\\:[0-9]{2}$/', 'data-parsley-maxlength' => "6", 'required' => 'true')); /* * txtRevisitas */ $txtRevisitas = new Element\Number("revisitas"); $txtRevisitas->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "2", 'required' => 'true')); /* * txtEstudos */ $txtEstudos = new Element\Number("estudos"); $txtEstudos->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "2", 'required' => 'true')); /* * txtObs */ $txtObs = new Element\Textarea("obs"); $txtObs->setAttributes(array('class' => 'form-control', 'placeholder' => 'Digites suas observações aqui')); /* * 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()); $cmbAno->setValue($orm->getAno()); $cmbMes->setValue($orm->getMes()); $cmbPublicador->setValue($orm->getPublicador()->getId()); $txtPublicacoes->setValue($orm->getPublicacoes()); $txtVideos->setValue($orm->getVideos()); $txtHoras->setValue($orm->getHoras()); $txtRevisitas->setValue($orm->getRevisitas()); $txtEstudos->setValue($orm->getEstudos()); } // Adiciona componetes no form $this->add($txtId); // $this->add(); $this->add($cmbAno); $this->add($cmbMes); $this->add($cmbPublicador); $this->add($txtPublicacoes); $this->add($txtVideos); $this->add($txtHoras); $this->add($txtRevisitas); $this->add($txtEstudos); $this->add($txtObs); $this->add($iToken); $this->add($btnSalvar); $this->add($btnVoltar); $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL)); }