本文整理汇总了PHP中Zend\Form\Element\Select类的典型用法代码示例。如果您正苦于以下问题:PHP Select类的具体用法?PHP Select怎么用?PHP Select使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Select类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
public function getForm(array $defaultStatus, array $currencyList)
{
if (!$this->form) {
$positionId = new Element\Hidden();
$positionId->setName('positionId');
$name = new Element\Text();
$name->setLabel('Name')->setName("name")->setAttribute('class', 'form-control');
$minSalary = new Element\Text();
$minSalary->setLabel('MinSalary')->setName("min_Salary")->setAttribute('class', 'form-control');
$maxSalary = new Element\Text();
$maxSalary->setLabel('MaxSalary')->setName("max_Salary")->setAttribute('class', 'form-control');
$currency = new Element\Select();
$currency->setName('currencyId')->setLabel('Currency Type')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose Currency --')->setValueOptions($currencyList);
$status = new Element\Select();
$status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($defaultStatus);
$form = new Form();
$form->setAttribute('class', 'form-horizontal');
$form->add($positionId);
$form->add($name);
$form->add($currency);
$form->add($minSalary);
$form->add($maxSalary);
$form->add($status);
$this->form = $form;
}
return $this->form;
}
示例2: __construct
public function __construct($name = null, array $comissoes = null)
{
parent::__construct($name);
$this->comissoes = $comissoes;
$this->setInputFilter(new MembroFilter());
$this->setAttribute('method', 'POST');
$id = new Hidden('id');
$this->add($id);
$comissao = new Select();
$comissao->setLabel("Comissão ")->setName("comissao")->setOptions(array('value_options' => $this->comissoes));
$this->add($comissao);
$membro = new Textarea('membro');
$membro->setLabel('Membros')->setAttribute('placeholder', 'Entre com os membros')->setAttribute('cols', '60')->setAttribute('rows', '5')->setAttribute('autofocus', 'autofocus');
$this->add($membro);
$cargo = new Textarea('cargo');
$cargo->setLabel('Cargos')->setAttribute('placeholder', 'Entre com os cargos')->setAttribute('cols', '60')->setAttribute('rows', '5');
$this->add($cargo);
$dataInicio = new Text('data_inicio');
$dataInicio->setLabel('Data Inicio');
$this->add($dataInicio);
$dataFim = new Text('data_fim');
$dataFim->setLabel('Data Fim');
$this->add($dataFim);
$button = new Button('submit');
$button->setLabel('Salvar')->setAttributes(array('type' => 'submit', 'class' => 'btn btn-success'));
$this->add($button);
}
示例3: __construct
public function __construct(ServiceLocatorInterface $sl)
{
parent::__construct('form-categoria');
// instanciando o entity manager do doctrine
$em = $sl->get('Doctrine\\ORM\\EntityManager');
// definindo variáveis
$arrPerfil = array('' => 'Selecione');
$repoPerfil = $em->getRepository('Admin\\Entity\\Perfil');
$arrPerfil += $repoPerfil->findPairs();
$perfil = new Select('perfil');
$perfil->setLabel('Perfil')->setAttributes(array('id' => 'perfil', 'class' => 'form-control', 'options' => $arrPerfil));
$this->add($perfil);
$nome = new Text('nome');
$nome->setLabel('Nome')->setAttributes(array('id' => 'nome', 'class' => 'form-control'));
$this->add($nome);
$email = new Text('email');
$email->setLabel('Email')->setAttributes(array('id' => 'email', 'class' => 'form-control'));
$this->add($email);
$senha = new Text('senha');
$senha->setLabel('Senha')->setAttributes(array('id' => 'senha', 'class' => 'form-control'));
$this->add($senha);
$status = new Select('status');
$status->setLabel('Status')->setAttributes(array('id' => 'status', 'class' => 'form-control', 'options' => array('1' => 'Ativo', '0' => 'Inativo')));
$this->add($status);
}
示例4: __construct
public function __construct(EntityManager $entityManager)
{
parent::__construct();
$this->entityManager = $entityManager;
$this->setAttributes(array("method" => "post", "enctype" => "multipart/form-data", "class" => "form"));
$this->setInputFilter(new FaqPerguntasFilters());
// Campo de titulo
$titulo = new Text('titulo');
$titulo->setLabel("* Título")->setAttributes(array("maxLength" => "200", "class" => "form-control", "required" => "required"));
// Campo de resposta
$resposta = new Textarea('resposta');
$resposta->setLabel('* Resposta');
$resposta->setAttributes(array('class' => 'file form-control editor', 'cols' => '30', 'rows' => '10'));
// Campo de titulo
$tags = new Text('tags');
$tags->setLabel("* Tags")->setAttributes(array("maxLength" => "1000", "class" => "form-control count-character", "required" => "required"));
// Campo categoria
$categorias = new Select('id_categoria');
$categorias->setLabel("* Categoria")->setAttribute("class", "select")->setValueOptions($this->getCategorias());
// Botão de Submit
$botao = new Submit("submit");
$botao->setAttributes(array("value" => "Salvar"));
// Adiciona campos
$this->add($titulo)->add($resposta)->add($tags)->add($categorias)->add($botao);
}
示例5: __construct
public function __construct()
{
parent::__construct('personorg');
$this->setAttribute('method', 'post');
$this->add(new Element\Hidden('id_person'));
$this->add(new Element\Hidden('id_organization'));
$this->add(new Element\Hidden('bool_primary'));
$this->add(new Element\Hidden('nid_lov_personorgtype'));
$this->add(new Element\Hidden('dt_begin'));
$name_title = new Element\Text('name_title');
$name_title->setLabel('Title')->setAttributes(array('class' => 'largewhite'));
$this->add($name_title);
$pnum_primary_order = new Element\Select('num_primary_order');
$pnum_primary_order->setLabel('Primary Order')->setAttributes(array('class' => 'tinywhite'));
$this->add($pnum_primary_order);
$dt_end = new Element\Date('dt_end');
$dt_end->setLabel('End Date')->setAttributes(array('class' => 'smallwhite', 'type' => 'date', 'id' => 'dt_end'))->setOptions(array('datepickerOptions' => array('changeYear: true', 'changeMonth: true', 'yearRange: "c-100:c+100"')));
$this->add($dt_end);
$comment = new Element\Textarea('comment');
$comment->setLabel('Comment')->setAttributes(array('class' => 'smallwhite'));
$this->add($comment);
$back = new Element\Button('back');
$back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn-success', 'style' => 'margin-right:70px;', 'onclick' => ''));
$this->add($back);
$submit = new Element\Submit('submit');
$submit->setValue('Login')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn-success', 'style' => 'margin: 10px 0 10px 140px'));
$this->add($submit);
}
示例6: setId
public function setId($ids)
{
$this->data = $ids;
$cata = new Element\Select('parent');
$cata->setLabel('Parent')->setAttribute('class', 'form-control select-dropdown')->setValueOptions($this->data);
$this->add($cata);
}
示例7: __construct
public function __construct($name = null)
{
parent::__construct('menus');
$this->setAttribute('class', 'form-horizontal');
$this->setAttribute('id', 'searchform');
$this->setAttribute('method', 'post');
$formValue = $this->formValue();
$name = new Element\Text('name');
$name->setLabel('Name')->setAttribute('class', 'required form-control')->setAttribute('id', 'name')->setAttribute('placeholder', 'Name');
$type = new Element\Select('type');
$type->setLabel('Type')->setAttribute('class', 'required form-control')->setValueOptions($formValue['type'])->setDisableInArrayValidator(true)->setAttribute('id', 'type')->setAttribute('placeholder', 'Type');
$resource_id = new Element\Select('resource_id');
$resource_id->setLabel('Resource')->setAttribute('class', 'required form-control')->setOptions(array())->setDisableInArrayValidator(true)->setAttribute('id', 'resource_id')->setAttribute('placeholder', 'Resource');
$url = new Element\Text('url');
$url->setLabel('Url')->setAttribute('class', 'required form-control')->setAttribute('id', 'url')->setAttribute('placeholder', 'Url');
$target = new Element\Select('target');
$target->setLabel('Target')->setAttribute('class', 'required form-control')->setValueOptions($formValue['target'])->setDisableInArrayValidator(true)->setAttribute('id', 'target')->setAttribute('placeholder', 'Target');
$parent_id = new Element\Select('parent_id');
$parent_id->setLabel('Parent')->setAttribute('class', 'required form-control')->setOptions(array())->setDisableInArrayValidator(true)->setAttribute('id', 'parent_id')->setAttribute('placeholder', 'Parent Id');
$status = new Element\Select('status');
$status->setLabel('Status')->setAttribute('class', 'required form-control')->setValueOptions($formValue['status'])->setDisableInArrayValidator(true)->setAttribute('id', 'status')->setAttribute('placeholder', 'Status');
$submit = new Element\Submit('submit');
$submit->setValue('Search')->setAttribute('class', 'btn btn-primary');
$this->add($name);
$this->add($type);
$this->add($resource_id);
$this->add($url);
$this->add($target);
$this->add($parent_id);
$this->add($status);
$this->add($submit);
}
示例8: __construct
public function __construct(ServiceLocatorInterface $sm)
{
parent::__construct('formPost');
// definindo variáveis
$em = $sm->get('Doctrine\\ORM\\EntityManager');
$arrCategorias = array("" => "Selecione");
$repoCategoria = $em->getRepository('Admin\\Entity\\Categoria');
$arrCategorias += $repoCategoria->fetchPairs();
$categoria = new Select('categoria');
$categoria->setLabel('Categoria')->setAttributes(array('id' => 'categoria', 'class' => 'form-control', 'options' => $arrCategorias));
$this->add($categoria);
$nome = new Text('nome');
$nome->setLabel('Nome')->setAttributes(array('id' => 'nome', 'class' => 'form-control', 'placeholder' => 'Digite o seu nome'));
$this->add($nome);
$descricao = new Textarea('descricao');
$descricao->setLabel('Descrição')->setAttributes(array('id' => 'descricao', 'class' => 'form-control', 'style' => 'height: 80px', 'placeholder' => 'Digite a descrição do post'));
$this->add($descricao);
$conteudo = new Textarea('conteudo');
$conteudo->setLabel('Conteúdo')->setAttributes(array('id' => 'conteudo', 'class' => 'form-control', 'style' => 'min-height: 150px', 'placeholder' => 'Digite o conteúdo do post'));
$this->add($conteudo);
$tags = new Text('tags');
$tags->setLabel('Tags')->setAttributes(array('id' => 'tags', 'class' => 'form-control', 'placeholder' => 'Digite as tags do conteúdo'));
$this->add($tags);
$submit = new Submit('submit');
$submit->setValue('Salvar');
$this->add($submit);
}
示例9: __construct
public function __construct(ServiceLocatorInterface $sl)
{
parent::__construct('form-produto');
// instanciando o entity manager do doctrine
$em = $sl->get('Doctrine\\ORM\\EntityManager');
// definindo variáveis
$arrCategorias = array('' => 'Selecione');
$repoCategorias = $em->getRepository('Admin\\Entity\\Categoria');
$arrCategorias += $repoCategorias->getCategorias();
$categoria = new Select('categoria');
$categoria->setLabel('Categoria do produto')->setAttributes(array('id' => 'categoria', 'class' => 'form-control', 'style' => 'width: 700px', 'options' => $arrCategorias));
$this->add($categoria);
$codigo = new Text('codigo');
$codigo->setLabel('Código do produto')->setAttributes(array('id' => 'codigo', 'style' => 'width: 200px', 'class' => 'form-control'));
$this->add($codigo);
$nome = new Text('nome');
$nome->setLabel('Nome do produto')->setAttributes(array('id' => 'nome', 'style' => 'width: 700px', 'class' => 'form-control'));
$this->add($nome);
$slug = new Text('slug');
$slug->setLabel('Slug do produto')->setAttributes(array('id' => 'slug', 'style' => 'width: 700px', 'class' => 'form-control'));
$this->add($slug);
$descricao = new Textarea('descricao');
$descricao->setLabel('Descrição')->setAttributes(array('id' => 'descricao', 'style' => 'width: 700px; height: 100px', 'class' => 'form-control'));
$this->add($descricao);
$peso = new Text('peso');
$peso->setLabel('Peso')->setAttributes(array('id' => 'peso', 'style' => 'width: 150px', 'class' => 'form-control'));
$this->add($peso);
$ativo = new Checkbox('ativo');
$ativo->setLabel('Ativo')->setAttributes(array('id' => 'ativo', 'style' => 'width: 38px', 'class' => 'form-control'));
$this->add($ativo);
}
示例10: getPerfil
public function getPerfil()
{
$element = new Select('perfil');
$element->setLabel('Perfil:');
$element->setAttributes(array('id' => 'perfil', 'class' => 'form-control validar'));
return $element;
}
示例11: __construct
/**
*
* @param null|string $name
*/
public function __construct($serviceLocator)
{
parent::__construct('transactionFilter');
$this->setServiceLocator($serviceLocator);
$this->setAttribute('method', 'GET');
$filter = $this->getInputFilter();
$id = new Text('id');
$id->setAttributes(['placeholder' => 'ID']);
$this->add($id);
$filter->add(array('name' => 'id', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits'))));
$companyId = $this->addElementCompany('companyId', null, ['required' => false]);
$transaction = new \Accounting\Model\Transaction();
$status = new Select('status');
$status->setValueOptions(['' => '- Trạng thái -'] + $transaction->getStatuses());
$this->add($status);
$filter->add(array('name' => 'status', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits'))));
$type = new Select('type');
$type->setValueOptions(['' => '- Loại phiếu -'] + $transaction->getTypes());
$this->add($type);
$filter->add(array('name' => 'type', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits'))));
$applyDateRange = new Text('applyDateRange');
$applyDateRange->setAttributes(array('placeholder' => 'Ngày hạch toán', 'class' => 'date-range-picker'));
$this->add($applyDateRange);
$filter->add(array('name' => 'applyDateRange', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
$createdByName = new Text('createdByName');
$createdByName->setAttributes(array('placeholder' => 'Người tạo'));
$this->add($createdByName);
$filter->add(array('name' => 'createdByName', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
$createdById = new Hidden('createdById');
$this->add($createdById);
$filter->add(array('name' => 'createdById', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits'))));
$this->add(array('name' => 'submit', 'options' => array(), 'attributes' => array('type' => 'submit', 'value' => 'Lọc', 'id' => 'btnFilterCompanyContact', 'class' => 'btn btn-primary')));
}
示例12: init
/**
* Init Module form
*
* @return void
*/
public function init()
{
$this->setAttribute('class', 'relative');
$fileInfo = new Info();
$modulesInfos = array();
$options = array('' => 'Select an option');
foreach ($this->getServiceLocator()->get('ModulesList') as $path => $dir) {
$options[$dir] = $dir;
$configFile = $path . '/module.info';
if ($fileInfo->fromFile($configFile) === true) {
$modulesInfos[$dir] = $fileInfo->render();
}
}
$collection = new ModuleCollection();
$modules = $collection->getModules();
foreach ($modules as $module) {
if (in_array($module->getName(), $options)) {
unset($options[$module->getName()]);
unset($modulesInfos[$module->getName()]);
}
}
$module = new Element\Select('module');
$module->setLabel('Module')->setLabelAttributes(array('class' => 'required'));
$module->setAttribute('id', 'module')->setAttribute('class', 'form-control')->setAttribute('modules_info', $modulesInfos)->setValueOptions($options);
$this->add($module);
$inputFilterFactory = new InputFilterFactory();
$inputFilter = $inputFilterFactory->createInputFilter(array('module' => array('name' => 'module', 'required' => true, 'validators' => array(array('name' => 'not_empty')))));
$this->setInputFilter($inputFilter);
}
示例13: __construct
public function __construct($name = null, array $modulos = null)
{
parent::__construct('aula');
$this->modulos = $modulos;
$this->setInputFilter(new AulaFilter());
$this->setAttribute('method', 'post');
$id = new \Zend\Form\Element\Hidden('id');
$this->add($id);
$descricao = new \Zend\Form\Element\Text("descricao");
$descricao->setLabel("Descricao: ")->setAttribute('placeholder', 'Entre com a descrição');
$this->add($descricao);
$modulo = new Select();
$modulo->setLabel("Modulo: ")->setName("modulo")->setOptions(array('value_options' => $this->modulos));
$this->add($modulo);
$videos = new \Zend\Form\Element\Text("videos");
$videos->setLabel("Dados Videos: ")->setAttribute('placeholder', 'Entre com os dados do video');
$this->add($videos);
$allSituacao = array_merge(array(0 => 'DESATIVADO', 1 => 'ATIVADO'));
$situacao = new Select();
$situacao->setLabel("Situacao: ")->setName("situacao")->setOptions(array('value_options' => $allSituacao));
$this->add($situacao);
$material = new \Zend\Form\Element\Text("material");
$material->setLabel("Mateirla")->setAttribute('placeholder', 'Entre com a URL do Material');
$this->add($material);
$this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success')));
}
示例14: getForm
public function getForm(array $urlType)
{
if ($this->form) {
return $this->form;
}
$form = new Form();
$form->setAttribute('class', 'form-horizontal');
$form->setAttribute('role', 'form');
$form->add(array('name' => 'menuId', 'type' => 'Hidden'));
$form->add(array('name' => 'title', 'type' => 'text', 'options' => array('label' => 'Title'), 'attributes' => array('class' => 'form-control')));
$form->add(array('name' => 'description', 'type' => 'Textarea', 'options' => array('label' => 'Description'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'description')));
$form->add(array('name' => 'icon', 'type' => 'text', 'options' => array('label' => 'Icon'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'Icon Class')));
$form->add(array('name' => 'url', 'type' => 'text', 'options' => array('label' => 'Url'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'Url')));
$url_type = new Select('url_type');
$url_type->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions($urlType)->setEmptyOption('-- Choose URL Type --');
$form->add($url_type);
$hasDivider = new Checkbox('hasDivider');
$hasDivider->setLabel('Has divider?');
$form->add($hasDivider);
$form->add(array('name' => 'parentId', 'type' => 'hidden'));
$form->add(array('name' => 'priority', 'type' => 'number', 'options' => array('label' => 'Priority'), 'attributes' => array('class' => 'form-control')));
$form->setInputFilter($this->getInputFilter());
$this->form = $form;
return $this->form;
}
示例15: __construct
public function __construct($serviceLocator, $options = null)
{
parent::__construct('fTransaction');
$this->setServiceLocator($serviceLocator);
$this->setAttribute('method', 'post');
$filter = $this->getInputFilter();
$basicGroup = new DisplayGroup('basicGroup');
$this->add($basicGroup);
$companyId = $this->addElementCompany('companyId', $basicGroup, ['required' => true]);
$applyDate = new Text('applyDate');
$applyDate->setLabel('Ngày hạch toán:');
$applyDate->setAttribute('class', 'datepicker');
$this->add($applyDate);
$basicGroup->addElement($applyDate);
$applyDate->setValue(DateBase::toDisplayDate(DateBase::getCurrentDate()));
$filter->add(array('name' => 'applyDate', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập ngày hạch toán'))))));
$description = new Text('description');
$description->setLabel('Nội dung:');
$this->add($description);
$basicGroup->addElement($description);
$filter->add(array('name' => 'description', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập nội dung phiếu thu'))))));
$accountId = new Select('accountId');
$accountId->setLabel('Quỹ thu:');
$accountId->setValueOptions(['' => '- Quỹ thu -']);
$this->loadAccountingAccount($accountId, $companyId);
$this->add($accountId);
$basicGroup->addElement($accountId);
$filter->add(array('name' => 'accountId', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập quỹ thu'))), array('name' => 'InArray', 'break_chain_on_failure' => true, 'options' => array('haystack' => array_keys($accountId->getValueOptions()), 'messages' => array('notInArray' => 'Bạn chưa nhập quỹ thu'))))));
$items = new Hidden('items');
$this->add($items);
$filter->add(array('name' => 'items', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập chi tiết các khoản thu'))))));
$this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/accounting/transaction/addreqrecieve'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/accounting/transaction/addreqrecieve' => 'Tiếp tục nhập', '/accounting/transaction/index' => 'Hiện danh sách vừa nhập'))));
$this->add(array('name' => 'btnSubmit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'button', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary')));
}