本文整理汇总了PHP中Zend\Form\Form::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::__construct方法的具体用法?PHP Form::__construct怎么用?PHP Form::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Form
的用法示例。
在下文中一共展示了Form::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class constructor.
*/
public function __construct(ProjectService $projectService)
{
parent::__construct();
$this->setAttribute('method', 'post');
$this->setAttribute('class', 'form-horizontal');
$this->setAttribute('id', 'create-report');
/*
* Create an array with possible periods. This will trigger a date but display a period (semester)
*/
$semesterOptions = [];
foreach ($projectService->parseYearRange() as $year) {
/*
* Use the Report object to parse the data
*/
$report = new Report();
$report->setDatePeriod(\DateTime::createFromFormat('Y-m-d', $year . '-03-01'));
$semesterOptions[$year . '-1'] = $report->parseName();
$report->setDatePeriod(\DateTime::createFromFormat('Y-m-d', $year . '-09-01'));
$semesterOptions[$year . '-2'] = $report->parseName();
}
$this->add(['type' => 'Zend\\Form\\Element\\Select', 'name' => 'period', 'options' => ['label' => _("txt-report-period"), 'help-block' => _("txt-report-period-explanation"), 'value_options' => $semesterOptions], 'attributes' => ['class' => "form-control", 'id' => "period"]]);
$this->add(['type' => 'Zend\\Form\\Element\\Text', 'name' => 'item', 'options' => ['label' => _("txt-document-name"), 'help-block' => _("txt-document-name-explanation")], 'attributes' => ['placeholder' => _("txt-please-give-a-document-name")]]);
$this->add(['type' => '\\Zend\\Form\\Element\\File', 'name' => 'file', 'options' => ["label" => "txt-file", "help-block" => _("txt-file-requirements")]]);
$this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'submit', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-create")]]);
$this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'cancel', 'attributes' => ['class' => "btn btn-warning", 'value' => _("txt-cancel")]]);
}
示例2: __construct
public function __construct($name = null)
{
parent::__construct('bibtex');
$this->setAttribute('id', 'form_bibtex');
$this->add(array('name' => 'bibtex', 'type' => 'File', 'required' => true, 'attributes' => array('id' => 'upload'), 'options' => array('label' => 'Importer fichier Bibtex')));
$this->add(array('name' => 'submit', 'type' => 'Submit', 'attributes' => array('value' => 'Valider', 'id' => 'submitBibtex')));
}
示例3: __construct
public function __construct($name = null)
{
parent::__construct('registration');
$this->setAttribute('method', 'post');
$this->add(array('name' => 'usr_email', 'attributes' => array('type' => 'email'), 'options' => array('label' => 'E-mail')));
$this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Send', 'id' => 'submitbutton')));
}
示例4: __construct
public function __construct($placeholder)
{
parent::__construct('busca');
$this->setAttribute('method', 'post');
$this->setAttribute('action', '');
$this->add(array('name' => 'search', 'type' => 'Text', 'options' => array('label' => ''), 'attributes' => array('id' => 'search', 'class' => 'form-control input-sm', 'placeholder' => $placeholder)));
}
示例5: __construct
public function __construct($name = 'mailchimp-sub-form', $options = array())
{
parent::__construct($name, $options);
$firstName = new Element\Text('firstName');
$firstName->setLabel('First Name');
$lastName = new Element\Text('lastName');
$lastName->setLabel('Last Name');
$email = new Element\Email('email');
$email->setLabel('Email Address');
$emailValidator = new Validator\EmailAddress(array('allow' => Validator\Hostname::ALLOW_DNS, 'domain' => true));
$email->setValidator($emailValidator);
$privacyPolicy = new Element\Checkbox('privacyPolicy');
$privacyPolicy->setLabel('I accept the privacy policy and the terms of use');
$csrf = new Element\Csrf('mcSubCSRF');
$submit = new Element\Submit('submit');
$submit->setValue('Subscribe');
$this->add($firstName);
$this->add($lastName);
$this->add($email);
$this->add($privacyPolicy);
$this->add($csrf);
$this->add($submit);
$inputFilter = $this->getInputFilter();
$inputFilter->get($firstName->getName())->setAllowEmpty(false)->setRequired(true);
$inputFilter->get($lastName->getName())->setAllowEmpty(false)->setRequired(true);
}
示例6: __construct
public function __construct()
{
parent::__construct(__CLASS__);
$this->add(array('name' => 'email'));
$this->add(array('name' => 'password'));
$this->add(array('name' => 'rememberme'));
}
示例7: __construct
/**
* @inheritdoc
*/
public function __construct($name = null, $options = array())
{
parent::__construct($name, $options);
$this->add(array('name' => 'title', 'type' => 'Text', 'options' => array('label' => '* Nome'), 'attributes' => array('required' => 'required', 'placeholder' => 'Titolo...', 'title' => 'Inserisci il titolo', 'id' => 'title')));
$this->add(array('name' => 'messageText', 'type' => 'Textarea', 'options' => array('label' => 'Testo'), 'attributes' => array('id' => 'messageText', 'required' => 'required', 'rows' => 10)));
$this->add(array('type' => 'Zend\\Form\\Element\\Hidden', 'name' => 'id', 'attributes' => array("class" => 'hiddenField')));
}
示例8: __construct
public function __construct()
{
parent::__construct('venda');
$this->setHydrator(new ClassMethods());
$this->add(array('name' => 'id', 'type' => 'hidden'));
$this->add(array('name' => 'submit', 'type' => 'submit', 'attributes' => array('value' => 'Nova venda', 'id' => 'btnSubmit', 'class' => 'btn btn-primary')));
}
示例9: __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')));
}
示例10: __construct
public function __construct()
{
parent::__construct('login');
$this->add(array('name' => 'nick', 'type' => 'Text'));
$this->add(array('name' => 'heslo', 'type' => 'Password'));
$this->add(array('name' => 'submit', 'type' => 'Submit', 'attributes' => array('value' => 'Přihlásit', 'class' => 'btn btn-info')));
}
示例11: __construct
public function __construct($name = null)
{
parent::__construct($name);
//id
$this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
//titolo
$this->add(array('name' => 'titolo', 'options' => array('label' => 'Titolo'), 'attributes' => array('type' => 'text', 'class' => 'form-control')));
//contenuto
$nota = new Element\Textarea('contenuto');
$nota->setLabel('Contenuto');
$nota->setAttribute('class', 'ckeditor form-control');
$this->add($nota);
//Background
$this->add(array('name' => 'background', 'attributes' => array('type' => 'Zend\\Form\\Element\\File'), 'options' => array('label' => 'Background')));
// Posterlab
$this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'posterlab', 'options' => array('label' => 'Posterlab', 'empty_option' => 'Scegli un posterlab =>'), 'attributes' => array('class' => 'form-control', 'onChange' => 'javascript:caricaPosizioni()', 'id' => 'posterlabs')));
// Posizione
$this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'posizione', 'options' => array('label' => 'posizione', 'empty_option' => 'Scegli una posizione =>', 'disable_inarray_validator' => true), 'attributes' => array('class' => 'form-control', 'id' => 'posizioni')));
// tipo
$this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'tipo', 'options' => array('label' => 'Tipo', 'empty_option' => 'Scegli tipo =>'), 'attributes' => array('class' => 'form-control')));
//stato
$stato = new Element\Checkbox('stato');
$stato->setLabel('Stato');
$stato->setAttribute('class', 'make-switch');
$this->add($stato);
$this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Salva', 'class' => 'btn green-haze pull-right')));
}
示例12: __construct
public function __construct($name, $options = [])
{
parent::__construct($name, $options);
$this->add(array('type' => 'Zend\\Form\\Element\\Csrf', 'name' => 'csrf', 'attributes' => array('id' => 'csrf')));
$this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('type' => 'submit', 'value' => 'Batch Submit', 'id' => 'listsubmit', 'class' => 'btn btn-primary')));
$this->setInputFilter(new InputFilter());
}
示例13: __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);
}
示例14: __construct
public function __construct($name = null)
{
parent::__construct('news-form');
$this->setAttribute('method', 'post');
$this->setAttribute('enctype', 'multipart/form-data');
// $this->add(array(
// 'name' => 'news_name',
// 'attributes' => array(
// 'type' => 'text',
// 'maxlength' => 250,
// 'class' => 'form-control',
// //'required' => 'true',
// 'onchange','get_static()',
// ),
// 'options' => array(
// 'label' => 'Title',
// ),
// ));
$news_name = new Element\Text('news_name');
$news_name->setLabel('Title:')->setAttribute('class', 'Title')->setAttribute('id', 'news_name')->setAttribute('type', 'text')->setAttribute('maxlength', 250)->setAttribute('class', 'form-control')->setAttribute('onchange', 'get_static();')->setAttribute('type', 'text');
$this->add($news_name);
$this->add(array('name' => 'url_static', 'attributes' => array('type' => 'text', 'id' => 'url_static', 'maxlength' => 250, 'class' => 'form-control'), 'options' => array('label' => 'Static-url')));
$this->add(array('name' => 'news_thumbnail', 'attributes' => array('type' => 'file', 'class' => '', 'accept' => '.jpg, .png, .gif, .jpeg, .JPG, .PNG, .GIF, .JPEG'), 'options' => array('label' => 'Thumbnail')));
$this->add(array('name' => 'news_content', 'type' => 'Zend\\Form\\Element\\Textarea', 'attributes' => array('class' => 'form-control', 'rows' => 5), 'options' => array('label' => 'Content')));
$this->add(array('type' => 'Zend\\Form\\Element\\Csrf', 'name' => 'security', 'options' => array('csrf_options' => array('timeout' => 600))));
$this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Save changes', 'class' => 'btn btn-primary')));
}
示例15: __construct
public function __construct($name = null)
{
parent::__construct('SarePrices-form');
$this->setAttribute('method', 'post');
$this->setAttribute('enctype', 'multipart/form-data');
$this->setAttribute('class', 'client-form');
$this->add(array('name' => 'email', 'required' => true, 'attributes' => array('type' => 'email', 'placeholder' => 'Ваш email*', 'id' => 'form-email')));
// $this->add(array(
// 'type' => 'Zend\Form\Element\Captcha',
// 'name' => 'captcha',
// 'attributes' => array(
// 'class' => 'form-control',
// 'placeholder' => 'Введите текст*'
// ),
// 'options' => array(
// 'captcha' => new Captcha\Figlet(array(
// 'name' => 'foo',
// 'wordLen' => 4,
// 'timeout' => 300,
// 'messages' => array(
// 'badCaptcha' => 'Неправильно введена каптча!'
// )
// )),
// ),
// ));
$this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'УЗНАТЬ СТОИМОСТЬ ПО АКЦИИ', 'id' => 'form-submit', 'data-form' => 'Form2')));
}