当前位置: 首页>>代码示例>>PHP>>正文


PHP Select::setEmptyOption方法代码示例

本文整理汇总了PHP中Zend\Form\Element\Select::setEmptyOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::setEmptyOption方法的具体用法?PHP Select::setEmptyOption怎么用?PHP Select::setEmptyOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Form\Element\Select的用法示例。


在下文中一共展示了Select::setEmptyOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showFilter

 /**
  * 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;
 }
开发者ID:nstapelbroek,项目名称:zf2-doctrine-datagrid,代码行数:13,代码来源:BooleanStrategy.php

示例2: __construct

 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);
 }
开发者ID:Crisstthian,项目名称:Reminder,代码行数:32,代码来源:ObjetosForm.php

示例3: listAction

 /**
  * 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()]);
 }
开发者ID:veniva,项目名称:zcms,代码行数:13,代码来源:ListingController.php

示例4: __construct

 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);
 }
开发者ID:Crisstthian,项目名称:Reminder,代码行数:49,代码来源:ActividadesForm.php

示例5: init

 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;
 }
开发者ID:kristjanAnd,项目名称:SimpleIV,代码行数:47,代码来源:ArticleForm.php

示例6: __construct

 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")));
 }
开发者ID:viplovegithub,项目名称:Myzend,代码行数:17,代码来源:vehicleModelForm.php

示例7: __invoke

 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%', '&nbsp;', $html);
     $html = str_replace('%bull%', '&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;
 }
开发者ID:uthando-cms,项目名称:uthando-navigation,代码行数:42,代码来源:NavigationForm.php

示例8: __construct

 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' => 'you@domain.com')));
     $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);
 }
开发者ID:amirws,项目名称:em-1,代码行数:21,代码来源:Pyme.php

示例9: __construct

 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")));
 }
开发者ID:viplovegithub,项目名称:Myzend,代码行数:24,代码来源:TollForm.php

示例10: setEmptyOption

 /**
  * 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;
 }
开发者ID:gridguyz,项目名称:zork,代码行数:12,代码来源:Select.php

示例11: caricaAction

 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;
 }
开发者ID:sebaxplace,项目名称:skilla-local,代码行数:11,代码来源:ContenutiController.php

示例12: testCanMarkOptionsAsSelectedWhenEmptyOptionOrZeroValueSelected

 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);
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:14,代码来源:FormSelectTest.php

示例13: __construct

 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));
 }
开发者ID:jonnathanvb,项目名称:stj,代码行数:85,代码来源:formPrivilegios.php

示例14: testNullEmptyOptionDoesNotRenderEmptyOption

 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);
 }
开发者ID:nuklehed,项目名称:zf2,代码行数:8,代码来源:FormSelectTest.php

示例15: __construct

 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...'));
     /*
//.........这里部分代码省略.........
开发者ID:jonnathanvb,项目名称:stj,代码行数:101,代码来源:formPublicador.php


注:本文中的Zend\Form\Element\Select::setEmptyOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。