本文整理汇总了PHP中Zend\Form\Element\Text::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::setName方法的具体用法?PHP Text::setName怎么用?PHP Text::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element\Text
的用法示例。
在下文中一共展示了Text::setName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($sm)
{
parent::__construct('GTEventSearch');
$element = new Text();
$element->setName('GTEventData')->setAttribute('class', 'form-control')->setLabel('Error search')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$this->add($element);
}
示例2: __construct
public function __construct()
{
parent::__construct();
$this->setAttribute('method', 'post')->setAttribute('action', '/user/register')->setAttribute('id', 'user-register-form');
$email = new Email();
$email->setName('email')->setLabel('Email Address');
$userName = new Text();
$userName->setName('userName')->setLabel('Username');
$password = new Password();
$password->setName('password')->setLabel('Password');
$firstName = new Text();
$firstName->setName('firstName')->setLabel('First Name');
$lastName = new Text();
$lastName->setName('lastName')->setLabel('Last Name');
$csrf = new Csrf();
$csrf->setName('prev');
$submit = new Submit();
$submit->setName('submit')->setValue('Register');
$this->add($email)->add($userName)->add($password)->add($firstName)->add($lastName)->add($csrf)->add($submit);
foreach ($this->elements as $element) {
if (!$element instanceof Submit) {
$element->setAttribute('class', 'form-control');
}
}
}
示例3: addElements
public function addElements()
{
$id = new Element\Hidden('id');
$title = new Element\Text('title');
$description = new Element\Textarea('description');
$postDate = new Element\Hidden('post_date');
$submit = new Element\Submit('submit');
$title->setName('title')->setAttributes(['placeholder' => 'Título', 'size' => 41])->setLabel('Título')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$description->setName('description')->setAttributes(['placeholder' => 'Digite o conteúdo', 'rows' => 10, 'cols' => 40])->setLabel('Conteúdo')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
$submit->setAttribute('value', 'Salvar')->setAttribute('class', 'btn btn-info');
$this->add($id)->add($title)->add($description)->add($postDate)->add($submit);
}
示例4: 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;
}
示例5: 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);
}
示例6: 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);
}
示例7: __construct
public function __construct()
{
parent::__construct();
$this->setAttribute('method', 'post');
$this->setAttribute('action', '/user/dashboard/post/create');
$this->setAttribute('id', 'user-post-form');
$title = new Text();
$title->setName('title')->setLabel('Title')->setAttribute('required', 'true');
$body = new Textarea();
$body->setName('body')->setAttributes(array('placeholder' => 'Your post content...', 'rows' => 8, 'resizable' => 'false', 'required' => 'true'));
$csrf = new Csrf();
$csrf->setName('prev');
$submit = new Submit();
$submit->setName('submit')->setValue('Create')->setAttribute('class', 'btn btn-info');
$this->add($title)->add($body)->add($csrf)->add($submit);
foreach ($this->elements as $element) {
if (!$element instanceof Submit) {
$element->setAttribute('class', 'form-control');
}
}
}
示例8: getForm
public function getForm(array $holidayType)
{
if (!$this->form) {
$hidId = new Hidden();
$hidId->setName('calendarId');
$cboType = new Select();
$cboType->setName('type')->setLabel('Type')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose Types --')->setValueOptions($holidayType);
$maxYear = date('Y', time()) + 10;
$datePicker = new DateSelect('date');
$datePicker->setValue(new \DateTime('now'))->setShouldRenderDelimiters(false)->setMinYear(2011)->setMaxYear($maxYear)->setLabel('Date')->setDayAttributes(array('class' => 'date-control', 'id' => 'dayCombo'))->setMonthAttributes(array('class' => 'date-control', 'id' => 'monthCombo'))->setYearAttributes(array('class' => 'date-control', 'id' => 'yearCombo'));
$txtTitle = new Text();
$txtTitle->setName('title')->setLabel('Title')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Title');
$form = new Form();
$form->setAttributes(array('class' => 'form-horizontal', 'role' => 'form'));
$form->add($hidId);
$form->add($cboType);
$form->add($datePicker);
$form->add($txtTitle);
$this->form = $form;
}
return $this->form;
}
示例9: getForm
public function getForm(array $currencies)
{
if (!$this->form) {
$hidId = new Element\Hidden();
$hidId->setName('receiveVoucherId');
$txtVoucherNo = new Element\Text();
$txtVoucherNo->setLabel('Number')->setName("voucherNo")->setAttribute('class', 'form-control text-center')->setAttribute('readonly', 'readonly');
$txtVoucherDate = new Element\Date('voucherDate');
$txtVoucherDate->setLabel('Date')->setAttributes(array('class' => 'form-control', 'allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD')));
$txtAccountType = new Element\Hidden('accountType');
$txtDescription = new Element\Textarea();
$txtDescription->setName("description")->setLabel('Description')->setAttribute('class', 'form-control');
$txtAmount = new Element\Number();
$txtAmount->setName("amount")->setLabel('Amount')->setAttribute('class', 'form-control')->setattributes(array('min' => '10', 'max' => '99999999999', 'step' => '1'));
$cboCurrency = new Element\Select();
$cboCurrency->setName('currencyId')->setLabel('Currency Type')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose --')->setValueOptions($currencies);
$txtDepositBy = new Element\Hidden();
$txtDepositBy->setName("depositBy");
$txtReason = new Element\Textarea();
$txtReason->setName('reason');
$txtGroupCode = new Element\Text();
$txtGroupCode->setName('group_code')->setLabel('Group Code (optional)')->setAttribute('class', 'form-control');
$form = new Form();
$form->setAttribute('role', 'form');
$form->add($hidId);
$form->add($txtVoucherNo);
$form->add($txtVoucherDate);
$form->add($txtAccountType);
$form->add($txtDescription);
$form->add($txtAmount);
$form->add($cboCurrency);
$form->add($txtDepositBy);
$form->add($txtReason);
$form->add($txtGroupCode);
$this->form = $form;
}
return $this->form;
}
示例10: __construct
public function __construct()
{
parent::__construct();
$this->setAttribute('method', 'post');
$this->setAttribute('action', '/user/dashboard/messages/create');
$this->setAttribute('class', 'form-horizontal');
$this->setAttribute('id', 'user-message-form');
$to = new Text();
$to->setName('recipient')->setLabel('Recipients')->setAttribute('id', 'recipients');
$subject = new Text();
$subject->setName('subject')->setLabel('Subject');
$body = new Textarea();
$body->setName('body')->setAttributes(array('placeholder' => 'Your message...', 'rows' => 4));
$csrf = new Csrf();
$csrf->setName('prev');
$submit = new Submit();
$submit->setName('submit')->setValue('Send');
$this->add($to)->add($subject)->add($body)->add($csrf)->add($submit);
foreach ($this->elements as $element) {
if (!$element instanceof Submit) {
$element->setAttribute('class', 'form-control');
}
}
}
示例11: __construct
public function __construct($name = null)
{
parent::__construct('create-cliente');
//nome
$nome = new Text();
$nome->setName("name");
$nome->setAttribute('placeholder', 'Nome');
$nome->setAttribute('class', 'form-control');
$this->add($nome);
//cognome
$cognome = new Text();
$cognome->setName("cognome");
$cognome->setAttribute('placeholder', 'Cognome');
$cognome->setAttribute('class', 'form-control');
$this->add($cognome);
//email
$email = new Text();
$email->setName("email");
$email->setAttribute('placeholder', 'email');
$email->setAttribute('class', 'form-control');
$this->add($email);
// numero di telefono
$num = new Text();
$num->setName("num");
$num->setAttribute('placeholder', 'Numero di telefono');
$num->setAttribute('class', 'form-control');
$this->add($num);
//bottone
$btn = new Submit();
$btn->setName("submit");
$btn->setAttribute('value', 'go');
$btn->setAttribute('id', 'submitbutton');
$btn->setAttribute('class', 'btn btn-primary');
$this->add($btn);
$this->setInputFilter($this->createInputFilter());
}
示例12: getForm
public function getForm(array $staffList, array $statusList, array $leaveList, $formType = 'W')
{
if (!$this->form) {
$leaveId = new Element\Hidden('leaveId');
$staff = new Element\Select();
$staff->setName('staffId')->setEmptyOption('-- Choose Staff --')->setLabel('Staff')->setAttribute('class', 'form-control')->setValueOptions($staffList);
$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');
$status = new Element\Select();
$status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($statusList);
if ($formType == 'R' || $formType == 'V') {
$staff->setAttribute('disabled', 'disabled');
$leaveType->setAttribute('disabled', 'disabled');
$description->setAttribute('readonly', 'readonly');
}
if ($formType == 'V') {
$status->setAttribute('disabled', 'disabled');
$date = new Element\Text();
$date->setName('date')->setLabel('Date')->setattributes(array('class' => 'form-control', 'disabled' => 'disabled'));
}
$form = new Form();
$form->setAttribute('class', 'form-horizontal');
$form->add($leaveId);
$form->add($staff);
$form->add($leaveType);
$form->add($date);
$form->add($description);
$form->add($status);
$this->form = $form;
}
return $this->form;
}
示例13: load
/**
* Load mixed prevalue editor
*
* @return string
*/
public function load()
{
$config = $this->getConfig();
$listDir = $this->getDatatype()->getDatatypesList();
$options = array();
foreach ($listDir as $dir) {
$options[$dir] = $dir;
}
$datatypes = empty($config['datatypes']) ? array() : $config['datatypes'];
foreach ($datatypes as $datatypeId => $datatypeConfig) {
//Get datatypes
$object = $this->loadDatatype($datatypeConfig['name']);
//Force configuration
$object->getPrevalueEditor()->setConfig(empty($datatypeConfig['config']) ? null : serialize($datatypeConfig['config']));
//Initiliaze prefix
$prefix = 'datatypes[' . $datatypeId . ']';
//Create form
$fieldset = new Fieldset();
$hidden = new Element\Hidden();
$hidden->setName($prefix . '[name]');
$hidden->setValue($datatypeConfig['name']);
$fieldset->add($hidden);
$label = new Element\Text();
$label->setName($prefix . '[label]');
$label->setAttribute('class', 'form-control');
$label->setLabel('Label');
$label->setAttribute('id', 'label' . $datatypeId);
$label->setValue(empty($datatypeConfig['label']) ? '' : $datatypeConfig['label']);
$fieldset->add($label);
AbstractForm::addContent($fieldset, $object->getPrevalueEditor()->load(), $prefix);
$datatypes[$datatypeId]['fieldset'] = $fieldset;
}
$data = array();
$data['datatypes'] = $datatypes;
$data['modelOptions'] = $options;
return $this->addPath(__DIR__)->render('mixed-prevalue.phtml', $data);
}
示例14: render
public function render($formPV, $id)
{
$form = new Form();
$form->setAttribute('id', $id);
$inputFilter = new \Zend\InputFilter\InputFilter();
$factory = new InputFactory();
foreach ($formPV as $element) {
if (isset($element->line_text)) {
$attributes = $element->line_text[0];
$name = isset($attributes->name) ? $attributes->name : '';
$type = isset($attributes->type) ? $attributes->type : '';
$position = isset($attributes->order) ? $attributes->order : '';
$placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
$label = isset($attributes->data->label) ? $attributes->data->label : '';
//$required = ($attributes->data->required == 'true') ? true : false ;
$required = false;
$class = isset($attributes->data->class) ? $attributes->data->class : '';
$id = isset($attributes->data->id) ? $attributes->data->id : '';
$lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
$lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
$element = new Element\Text($name);
$element->setName($label);
$element->setLabel($label);
$element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id));
$form->add($element);
$options = array();
$options['encoding'] = 'UTF-8';
if ($lengthMin && $lengthMin > 0) {
$options['min'] = $lengthMin;
}
if ($lengthMax && $lengthMax > $lengthMin) {
$options['max'] = $lengthMax;
$element->setAttribute('maxlength', $lengthMax);
$options['messages'] = array(\Zend\Validator\StringLength::TOO_LONG => sprintf($this->getServiceManager()->get('translator')->translate('This field contains more than %s characters', 'playgroundgame'), $lengthMax));
}
$inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options)))));
}
if (isset($element->line_email)) {
$attributes = $element->line_email[0];
$name = isset($attributes->name) ? $attributes->name : '';
$type = isset($attributes->type) ? $attributes->type : '';
$position = isset($attributes->order) ? $attributes->order : '';
$placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
$label = isset($attributes->data->label) ? $attributes->data->label : '';
//$required = ($attributes->data->required == 'true') ? true : false ;
$required = false;
$class = isset($attributes->data->class) ? $attributes->data->class : '';
$id = isset($attributes->data->id) ? $attributes->data->id : '';
$lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
$lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
$element = new Element\Email($name);
$element->setLabel($label);
$element->setName($label);
$element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id));
$form->add($element);
$options = array();
$options['encoding'] = 'UTF-8';
if ($lengthMin && $lengthMin > 0) {
$options['min'] = $lengthMin;
}
if ($lengthMax && $lengthMax > $lengthMin) {
$options['max'] = $lengthMax;
$element->setAttribute('maxlength', $lengthMax);
$options['messages'] = array(\Zend\Validator\StringLength::TOO_LONG => sprintf($this->getServiceManager()->get('translator')->translate('This field contains more than %s characters', 'playgroundgame'), $lengthMax));
}
$inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options)))));
}
if (isset($element->line_checkbox)) {
$attributes = $element->line_checkbox[0];
$name = isset($attributes->name) ? $attributes->name : '';
$type = isset($attributes->type) ? $attributes->type : '';
$position = isset($attributes->order) ? $attributes->order : '';
$label = isset($attributes->data->label) ? $attributes->data->label : '';
// $required = ($attributes->data->required == 'yes') ? true : false;
$required = false;
$class = isset($attributes->data->class) ? $attributes->data->class : '';
$id = isset($attributes->data->id) ? $attributes->data->id : '';
$lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
$lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
$innerData = isset($attributes->data->innerData) ? $attributes->data->innerData : array();
$element = new Element\MultiCheckbox($name);
$element->setLabel($label);
$element->setName($label);
$element->setAttributes(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required, 'class' => $class, 'id' => $id));
$values = array();
foreach ($innerData as $value) {
$values[] = $value->label;
}
$element->setValueOptions($values);
$form->add($element);
$options = array();
$options['encoding'] = 'UTF-8';
$inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required)));
}
if (isset($element->line_paragraph)) {
$attributes = $element->line_paragraph[0];
$name = isset($attributes->name) ? $attributes->name : '';
$type = isset($attributes->type) ? $attributes->type : '';
$position = isset($attributes->order) ? $attributes->order : '';
$placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
//.........这里部分代码省略.........