本文整理汇总了PHP中Zend\Form\Element\Select::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::setName方法的具体用法?PHP Select::setName怎么用?PHP Select::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element\Select
的用法示例。
在下文中一共展示了Select::setName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
public function getForm(array $companyTypes, array $statusList)
{
if (!$this->form) {
$companyId = new Element\Hidden();
$companyId->setName('companyId');
$name = new Element\Text();
$name->setLabel('Name')->setName("name")->setAttribute('class', 'form-control');
$phone = new Element\Text();
$phone->setLabel('Phone')->setName("phone")->setAttribute('class', 'form-control');
$address = new Element\Textarea();
$address->setLabel('Address')->setName("address")->setAttribute('class', 'form-control');
$website = new Element\Url();
$website->setLabel('Website')->setName("website")->setAttribute('class', 'form-control');
$type = new Element\Select();
$type->setName("type")->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions($companyTypes);
$status = new Element\Select();
$status->setName("status")->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($statusList);
$form = new Form();
$form->setAttribute('class', 'form-horizontal');
$form->add($companyId);
$form->add($name);
$form->add($phone);
$form->add($address);
$form->add($website);
$form->add($type);
$form->add($status);
$this->form = $form;
}
return $this->form;
}
示例2: 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;
}
示例3: getForm
public function getForm(array $defaultStatus)
{
if (!$this->form) {
$currencyId = new Element\Hidden();
$currencyId->setName('currencyId');
$name = new Element\Text();
$name->setLabel('Name')->setName("name")->setAttribute('class', 'form-control');
$code = new Element\Text();
$code->setLabel('Code')->setName("code")->setAttribute('class', 'form-control');
$rate = new Element\Text();
$rate->setLabel('Rate')->setName("rate")->setAttributes(array('class' => 'form-control'));
$status = new Element\Select();
$status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($defaultStatus);
$changedRate = new Element\Checkbox();
$changedRate->setName('changedRate')->setLabel('Auto renew?')->setAttribute('class', 'form-control');
$form = new Form();
$form->setAttribute('class', 'form-horizontal');
$form->add($currencyId);
$form->add($code);
$form->add($name);
$form->add($rate);
$form->add($status);
$form->add($changedRate);
$this->form = $form;
}
return $this->form;
}
示例4: __construct
public function __construct($name = null, array $departamentos = null)
{
parent::__construct('usuario');
$this->departamentos = $departamentos;
$this->setAttribute('method', 'post');
$this->setInputFilter(new UsuarioFilter());
$this->setAttribute('enctype', 'multipart/form-data');
$this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
$this->add(array('name' => 'matricula', 'options' => array('type' => 'text'), 'attributes' => array('id' => 'matricula', 'placeholder' => 'Número da matricula', 'class' => 'form-control input-lg')));
$this->add(array('name' => 'admissao', 'options' => array('type' => 'text'), 'attributes' => array('id' => 'admissao', 'placeholder' => 'Data de Admissao', 'class' => 'form-control input-lg')));
$this->add(array('name' => 'nome', 'options' => array('type' => 'text'), 'attributes' => array('id' => 'nome', 'placeholder' => 'Nome', 'class' => 'form-control input-lg')));
$departamento = new Select();
$departamento->setName('departamento')->setOptions(array('empty_option' => 'Departamento do usuario', 'value_options' => $this->departamentos))->setAttributes(array('class' => 'form-control input-lg'));
$this->add($departamento);
$this->add(array('name' => 'foto', 'attributes' => array('type' => 'file', 'id' => 'foto')));
$this->add(array('name' => 'dataNascimento', 'options' => array('type' => 'text'), 'attributes' => array('id' => 'dataNascimento', 'placeholder' => 'Data de Nascimento', 'class' => 'form-control input-lg')));
$this->add(array('name' => 'email', 'options' => array('type' => 'email'), 'attributes' => array('id' => 'email', 'placeholder' => 'E-mail', 'class' => 'form-control input-lg')));
$this->add(array('name' => 'password', 'options' => array('type' => 'Password'), 'attributes' => array('id' => 'password', 'placeholder' => 'Senha', 'class' => 'form-control input-lg', 'type' => 'password')));
$status = new Select();
$status->setName('status')->setOptions(array('empty_option' => 'Tipo de Usuario', 'value_options' => array('0' => 'Administrador', '1' => 'Colaborador', '2' => 'Visitante')))->setAttributes(array('class' => 'form-control input-lg'));
$this->add($status);
/*$ativo = new \Zend\Form\Element\Checkbox("ativo");
$ativo->setLabel("Desativar?: ");
$ativo->setCheckedValue("0");
$this->add($ativo);*/
$this->add(array('type' => 'Zend\\Form\\Element\\Checkbox', 'name' => 'ativo', 'options' => array('label' => 'Desativar?:', 'use_hidden_element' => true, 'checked_value' => 0, 'unchecked_value' => 1)));
$this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn btn-primary')));
}
示例5: getForm
public function getForm(array $staff)
{
if (!$this->form) {
$attendanceId = new Element\Hidden();
$attendanceId->setName('attendanceId');
$staffId = new Element\Select();
$staffId->setName('staffId')->setLabel('Staff')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose --')->setValueOptions($staff);
$type = new Element\Select();
$type->setName('type')->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions(array('I' => 'In', 'O' => 'Out'));
$date = new Element\Date();
$date->setName('attendanceDate')->setLabel('Date')->setAttributes(array('class' => 'form-control', 'allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD')));
$workingHours = array();
for ($i = 8; $i < 20; $i++) {
$workingHours[$i] = sprintf('%02d', $i);
}
$hour = new Element\Select();
$hour->setName('hour')->setAttribute('class', 'form-control')->setValueOptions($workingHours);
$workingMinutes = array();
for ($i = 0; $i < 12; $i++) {
$workingMinutes[$i] = sprintf('%02d', $i * 5);
}
$minute = new Element\Select();
$minute->setName('minute')->setAttribute('class', 'form-control')->setValueOptions($workingMinutes);
$form = new Form();
$form->setAttributes(array('role' => 'form', 'class' => 'form-horizontal'));
$form->add($attendanceId);
$form->add($staffId);
$form->add($type);
$form->add($date);
$form->add($hour);
$form->add($minute);
$this->form = $form;
}
return $this->form;
}
示例6: getForm
public function getForm(array $default_status)
{
if (!$this->form) {
$hidId = new Element\Hidden();
$hidId->setName('userId');
$txtName = new Element\Text();
$txtName->setLabel('User Name')->setName("userName")->setAttribute('class', 'form-control');
$password = new Element\Password();
$password->setLabel('Password')->setName('password')->setAttribute('class', 'form-control');
$confirmPassword = new Element\Password();
$confirmPassword->setName('confirmPassword')->setLabel('Retype Password')->setAttribute('class', 'form-control');
$selectRole = new Element\Hidden('userRole');
$description = new Element\Textarea();
$description->setName('description')->setLabel('Description')->setAttribute('class', 'form-control');
$status = new Element\Select();
$status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($default_status);
$image = new Element\File();
$image->setName('image')->setLabel('Profile image');
$form = new Form();
$form->setAttribute('class', 'form-horizontal');
$form->setAttribute('enctype', 'multipart/form-data');
$form->add($hidId);
$form->add($txtName);
$form->add($password);
$form->add($confirmPassword);
$form->add($selectRole);
$form->add($description);
$form->add($status);
$form->add($image);
$this->form = $form;
}
return $this->form;
}
示例7: prepareElement
/**
* Prepare the form element (mostly used for rendering purposes)
*
* @param FormInterface $form
* @return mixed
*/
public function prepareElement(FormInterface $form)
{
parent::prepareElement($form);
$name = $this->getName();
$this->dayElement->setName($name . '[day]');
}
示例8: prepareElement
/**
* Prepare the form element (mostly used for rendering purposes)
*
* @param FormInterface $form
* @return mixed
*/
public function prepareElement(FormInterface $form)
{
parent::prepareElement($form);
$name = $this->getName();
$this->hourElement->setName($name . '[hour]');
$this->minuteElement->setName($name . '[minute]');
$this->secondElement->setName($name . '[second]');
}
示例9: getForm
public function getForm(array $currencies, array $companies, array $contacts, array $statusList)
{
if (!$this->form) {
$hidId = new Element\Hidden();
$hidId->setName('proposalId');
$txtCompanyId = new Element\Select();
$txtCompanyId->setLabel('Company Name')->setName("companyId")->setAttribute('class', 'form-control')->setEmptyOption("--Choose Company--")->setValueOptions($companies);
$txtContactId = new Element\Select();
$txtContactId->setLabel('Contact Name')->setName('contactId')->setAttribute('class', 'form-control')->setEmptyOption("--Choose Contact--")->setValueOptions($contacts);
$txtCode = new Element\Text();
$txtCode->setLabel('Code')->setName('code')->setAttribute('class', 'form-control');
$txtName = new Element\Text();
$txtName->setLabel('Name')->setName('name')->setAttribute('class', 'form-control');
$txtAmount = new Element\Number();
$txtAmount->setName("amount")->setLabel('Amount')->setAttribute('class', 'form-control')->setAttributes(array('min' => '100', 'max' => '99999999999', 'step' => '100'));
$selectCurrency = new Element\Select();
$selectCurrency->setName('currencyId')->setLabel('Currency')->setAttribute('class', 'form-control')->setValueOptions($currencies);
$txtProposalDate = new Element\Date('proposalDate');
$txtProposalDate->setLabel('Date')->setAttributes(array('class' => 'form-control', 'allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD')));
$txtProposalFile = new Element\File();
$txtProposalFile->setName('proposalFile')->setLabel('Upload file');
$txtNodes = new Element\Textarea();
$txtNodes->setLabel('Notes')->setName('notes')->setAttribute('class', 'form-control');
$txtProposalBy = new Element\Text();
$txtProposalBy->setName('proposalBy')->setLabel('Proposal By')->setAttribute('class', 'form-control');
$txtGroupCode = new Element\Text();
$txtGroupCode->setLabel('Group Code')->setName('group_code')->setAttribute('class', 'form-control');
$txtStatus = new Element\Select();
$txtStatus->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($statusList);
$form = new Form();
$form->setAttribute('class', 'form-horizontal');
$form->setAttribute('enctype', 'multipart/form-data');
$form->add($hidId);
$form->add($txtCompanyId);
$form->add($txtContactId);
$form->add($txtCode);
$form->add($txtName);
$form->add($txtAmount);
$form->add($selectCurrency);
$form->add($txtProposalDate);
$form->add($txtProposalFile);
$form->add($txtNodes);
$form->add($txtProposalBy);
$form->add($txtGroupCode);
$form->add($txtStatus);
$this->form = $form;
}
return $this->form;
}
示例10: getLeaveForm
public function getLeaveForm(array $leaveList)
{
$leaveType = new Element\Select();
$leaveType->setName('leaveType')->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions($leaveList);
$date = new Element\Date();
$date->setName('date')->setLabel('Date')->setAttributes(array('allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD')));
$description = new Element\Textarea('description');
$description->setLabel('Description')->setAttribute('class', 'form-control');
$form = new Form();
$form->setAttribute('class', 'form');
$form->add($leaveType);
$form->add($date);
$form->add($description);
return $form;
}
示例11: __construct
public function __construct($name = null, array $categorias)
{
parent::__construct('livro');
$this->categorias = $categorias;
$this->setAttribute('method', 'post');
// $this->setInputFilter(new LivroFilter());
$this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
$this->add(array('name' => 'nome', 'options' => array('type' => 'text', 'label' => 'Nome:'), 'attributes' => array('id' => 'nome', 'placeholder' => 'Entre com a categoria')));
$categoria = new Select();
$categoria->setName('categoria')->setLabel('Categoria')->setOptions(array('value_options' => $this->categorias));
$this->add($categoria);
$this->add(array('name' => 'autor', 'options' => array('type' => 'text', 'label' => 'Autor'), 'attributes' => array('id' => 'autor', 'placeholder' => 'Informe o nome do autor')));
$this->add(array('name' => 'isbn', 'options' => array('type' => 'text', 'label' => 'ISBN'), 'attributes' => array('id' => 'isbn', 'placeholder' => 'Entre com o código ISBN')));
$this->add(array('name' => 'valor', 'options' => array('type' => 'text', 'label' => 'Valor'), 'attributes' => array('id' => 'valor', 'placeholder' => 'Entre com o valor')));
$this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success')));
}
示例12: getForm
public function getForm(array $usersData, array $positionsData, array $currencyData, array $defaultStatus)
{
if (!$this->form) {
$hidId = new Element\Hidden();
$hidId->setName('staffId');
$selectUsers = new Element\Select();
$selectUsers->setName('userId')->setLabel('User')->setAttribute('class', 'form-control')->setEmptyOption("--Choose User --")->setValueOptions($usersData);
$staffCode = new Element\Text();
$staffCode->setLabel('Code')->setName("staffCode")->setAttribute('class', 'form-control');
$staffName = new Element\Text();
$staffName->setLabel('Name')->setName("staffName")->setAttribute('class', 'form-control');
$selectPosition = new Element\Select();
$selectPosition->setName('positionId')->setLabel('Position')->setAttribute('class', 'form-control')->setEmptyOption("-- Choose Position --")->setValueOptions($positionsData);
$selectDepartment = new Element\Hidden('departmentId');
$salary = new Element\Number();
$salary->setLabel('Salary')->setName("salary")->setAttributes(array('min' => '0', 'max' => '999999999999', 'step' => '1'));
$leave = new Element\Number();
$leave->setLabel('Leave')->setName("annual_leave")->setAttributes(array('min' => '0.5', 'max' => '100', 'step' => '0.5'));
$PermanentDate = new Element\Date('permanentDate');
$PermanentDate->setLabel('P-Date')->setAttributes(array('allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD')));
$birthDay = new Element\Date('birthday');
$birthDay->setLabel('Birthday')->setAttributes(array('allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD')));
$selectCurrency = new Element\Select();
$selectCurrency->setName('currencyId')->setAttribute('class', 'form-control')->setValueOptions($currencyData);
$status = new Element\Select();
$status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($defaultStatus);
$bankCode = new Element\Text('bankCode');
$bankCode->setLabel('Bank Account')->setAttributes(array('class' => 'form-control', 'placeholder' => 'Aya Bank Account No'));
$form = new Form();
$form->setAttribute('class', 'form-horizontal');
$form->add($hidId);
$form->add($selectUsers);
$form->add($staffCode);
$form->add($staffName);
$form->add($selectPosition);
$form->add($selectDepartment);
$form->add($salary);
$form->add($leave);
$form->add($PermanentDate);
$form->add($status);
$form->add($birthDay);
$form->add($selectCurrency);
$form->add($bankCode);
$this->form = $form;
}
return $this->form;
}
示例13: addElements
public function addElements()
{
$this->setAttributes(array('method' => 'post', 'class' => 'form-horizontal', 'action' => '/admin/users/save'));
$usrId = new Element\Hidden('usr_id');
$name = new Element\Text('name');
$name->setName('name')->setAttribute('placeholder', 'Nome do usuário')->setLabel('Nome do usuário')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$username = new Element\Text('username');
$username->setName('username')->setAttributes(array('id' => 'username', 'placeholder' => 'Usuário'))->setLabel('Usuário')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$password = new Element\Password('password');
$password->setName('password')->setAttributes(array('id' => 'password', 'placeholder' => 'Senha'))->setLabel('Senha')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$role = new Element\Select('role');
$role->setName('role')->setLabel('Perfil de usuário')->setLabelAttributes(array('class' => 'col-sm-2 control-label'))->setValueOptions(array('' => 'Escolha um perfil', 'admin' => 'Administrador', 'redator' => 'Redator'));
$valid = new Element\Checkbox('valid');
$valid->setName('valid')->setLabel('Ativar usuário')->setLabelAttributes(array('class' => 'lbl'));
$submit = new Element\Submit('submit');
$submit->setAttribute('value', 'Salvar')->setAttribute('class', 'btn btn-primary');
$this->add($usrId)->add($name)->add($username)->add($password)->add($role)->add($valid)->add($submit);
}
示例14: addElements
public function addElements()
{
$id = new Element\Hidden('id');
$postsId = new Element\Select('postsId');
$description = new Element\Text('description');
$name = new Element\Text('name');
$email = new Element\Email('email');
$webpage = new Element\Text('webpage');
$commentDate = new Element\Hidden('commentDate');
$submit = new Element\Submit('submit');
$description->setName('description')->setAttribute('placeholder', 'Digite o seu comentário')->setLabel('Comentário')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$postsId->setName('postsId')->setLabel('Post')->setLabelAttributes(array('class' => 'col-sm-2 control-label'))->setEmptyOption('Escolha um post');
$name->setName('name')->setAttribute('placeholder', 'Nome')->setLabel('Nome')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$email->setName('email')->setAttribute('placeholder', 'E-mail')->setLabel('E-mail')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$webpage->setName('webpage')->setAttribute('placeholder', 'Web page')->setLabel('Web page')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$submit->setAttribute('value', 'Salvar')->setAttribute('class', 'btn btn-info');
$this->add($id)->add($postsId)->add($description)->add($name)->add($email)->add($commentDate)->add($webpage)->add($submit);
}
示例15: getForm
public function getForm(array $formulaList)
{
if (!$this->form) {
$fromDate = new Element\Date('fromDate');
$fromDate->setAttributes(array('allowPastDates' => true, 'style' => 'width:120px;', 'momentConfig' => array('format' => 'YYYY-MM-DD')));
$fromDate->setValue(date('Y-m-26', strtotime('-1 month')));
$toDate = new Element\Date('toDate');
$toDate->setAttributes(array('allowPastDates' => true, 'style' => 'width:120px;margin-left:5px;', 'momentConfig' => array('format' => 'YYYY-MM-DD')));
$toDate->setValue(date('Y-m-25', time('')));
$formula = new Element\Select();
$formula->setName('formula')->setAttribute('class', 'form-control')->setAttribute('style', 'width:200px')->setValueOptions($formulaList)->setEmptyOption('-- Choose Formula --');
$form = new Form();
$form->setAttributes(array('class' => 'form-inline', 'role' => 'form', 'id' => 'process-form'));
$form->add($fromDate);
$form->add($toDate);
$form->add($formula);
$this->form = $form;
}
return $this->form;
}