本文整理汇总了PHP中Zend\Form\Element\Text::setAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::setAttributes方法的具体用法?PHP Text::setAttributes怎么用?PHP Text::setAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element\Text
的用法示例。
在下文中一共展示了Text::setAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($name = null)
{
parent::__construct('reginfo');
$id_hidden = new Element\Hidden('id');
$id_hidden->setName('id');
$email_text = new Element\Text('login');
$email_text->setLabel('E-mail');
$email_text->setLabelAttributes(array('class' => 'type_text'));
$email_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'disabled' => 'disable'));
$type_text = new Element\Text('type');
$type_text->setLabel('Type');
$type_text->setLabelAttributes(array('class' => 'type_text'));
$type_text->setAttributes(array('class' => 'type_text_input', 'disabled' => 'disable'));
$password_text = new Element\Password('password');
$password_text->setLabel('New password');
$password_text->setLabelAttributes(array('class' => 'type_text'));
$password_text->setAttributes(array('id' => 'password', 'class' => 'type_text_input'));
$cpassword_text = new Element\Password('cpassword');
$cpassword_text->setLabel('Confirm password');
$cpassword_text->setLabelAttributes(array('class' => 'type_text'));
$cpassword_text->setAttributes(array('id' => 'cpassword', 'class' => 'type_text_input'));
$this->add($id_hidden);
$this->add($email_text);
$this->add($type_text);
$this->add($password_text);
$this->add($cpassword_text);
}
示例2: __construct
public function __construct($name = null, $options = array())
{
//Formulario
//Contruimos el formulario en base al padre
parent::__construct('login', $options);
//seteamos el actiond el formulario
$this->setAttributes(array('action' => '/application/index/login'));
//Elementos
//Creamos un elemento de tipo texto y seteamos su atributo name
$e = new Element\Text('name');
//Seteamos los atributos del elemento
$e->setAttributes(array('id' => 'txt_name', 'class' => 'txt_name_clase'));
//seteamos las opciones del elemento
$e->setOptions(array('label' => 'Usuario: '));
//añadimos al formulario
$this->add($e);
//Definimos los parametros del elemento a generar
$e = array('type' => 'password', 'name' => 'password', 'attributes' => array('id' => `txt_password`, 'class' => 'txt_password_clase'), 'options' => array('label' => 'Clave: '));
//agregamo el elemento
$this->add($e);
//Agregando un boton
$e = new Element\Submit('enviar');
$e->setAttributes(array('id' => `btn_login`, 'value' => 'Enviar', 'class' => 'btn_login'));
$this->add($e);
}
示例3: __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')));
}
示例4: __construct
public function __construct(EntityManager $objectManager)
{
parent::__construct('ligue');
$this->setAttributes(array('method' => 'post', 'id' => 'auth', 'role' => 'form'));
$this->setInputFilter(new LigueFilter($objectManager));
$this->setHydrator(new DoctrineObject($objectManager));
// Id
$id = new Hidden('id');
$this->add($id);
// Nom
$nom = new Text('nom');
$nom->setLabel('Nom')->setLabelAttributes(array('class', 'control-label'));
$nom->setAttributes(array('id' => 'nom', 'class' => 'form-control', 'placeholder' => 'Nom', 'required' => true));
$this->add($nom);
// Image
$image = new File('image');
$image->setLabel('Image')->setLabelAttributes(array('class', 'control-label'));
$image->setAttributes(array('id' => 'image', 'class' => 'form-control', 'placeholder' => 'Image'));
$this->add($image);
// Date début
$dateDebut = new Text('dateDebut');
$dateDebut->setLabel('Début de la ligue')->setLabelAttributes(array('class', 'control-label'));
$dateDebut->setAttributes(array('id' => 'dateDebut', 'class' => 'form-control'));
//$this->add($dateDebut);
// Date fin
$dateFin = new Text('dateFin');
$dateFin->setLabel('Fin de la ligue')->setLabelAttributes(array('class', 'control-label'));
$dateFin->setAttributes(array('id' => 'dateFin', 'class' => 'form-control'));
//$this->add($dateFin);
// Submit
$submit = new Submit('submit');
$submit->setValue('Enregistrer');
$submit->setAttributes(array('class' => 'btn btn-primary'));
$this->add($submit);
}
示例5: __construct
/**
* @param null|string $name
*/
public function __construct($serviceLocator, $options = null)
{
parent::__construct('passwordForgot');
$this->setServiceLocator($serviceLocator);
$this->setAttribute('method', 'post');
$filter = $this->getInputFilter();
$groupBasic = new DisplayGroup('groupBasic');
$this->add($groupBasic);
$email = new Text('email');
$email->setLabel('Email:');
$email->setAttributes(['maxlength' => 255, 'autocomplete' => 'off']);
$email->setOptions(['descriptions' => ['Nhập email khi bạn đăng ký tài khoản']]);
$this->add($email);
$groupBasic->addElement($email);
$filter->add(array('name' => 'email', '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 email'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('max' => 50, 'min' => 4, 'messages' => array(StringLength::TOO_LONG => 'Tên đăng nhập giới hạn 4-50 kí tự', StringLength::TOO_SHORT => 'Tên đăng nhập giới hạn 4-50 kí tự'))), array('name' => 'EmailAddress', 'break_chain_on_failure' => true, 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Địa chỉ email không hợp lệ'))))));
$config = $this->getServiceLocator()->get('Config');
$this->captcha = new ReCaptcha(array('pubkey' => $config['captcha']['reCAPTCHA']['publicKey'], 'privkey' => $config['captcha']['reCAPTCHA']['privateKey'], 'ssl' => !isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off' ? false : true));
$this->captcha->setPrivkey($config['captcha']['reCAPTCHA']['privateKey']);
$this->captcha->setPubkey($config['captcha']['reCAPTCHA']['publicKey']);
$captcha = new Captcha('captcha');
$captcha->setLabel('Mã bảo mật:');
$captcha->setCaptcha($this->captcha);
$this->add($captcha);
$groupBasic->addElement($captcha);
$filter->add(array('name' => 'captcha', '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 email'))), $this->captcha)));
$this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Khôi phục mật khẩu', 'id' => 'btnSubmit', 'class' => 'htmlBtn first btn btn-primary'), 'options' => array('clearBefore' => true, 'decorator' => array('type' => 'li', 'attributes' => array('class' => 'btns')))));
}
示例6: getLogin
public function getLogin()
{
$element = new Text('login');
$element->setLabel('Login');
$element->setAttributes(array('id' => 'login', 'class' => 'form-control', 'placeholder' => 'Digite o seu login'));
return $element;
}
示例7: __construct
public function __construct($serviceLocator, $options = null)
{
parent::__construct('AccountIndex');
$this->setServiceLocator($serviceLocator);
$this->setAttribute('method', 'post');
$filter = $this->getInputFilter();
$group = new DisplayGroup('Subject');
$group->setLabel('Thêm danh mục môn học');
$this->add($group);
// name
$name = new Text('name');
$name->setLabel('Tên danh mục:');
$name->setAttributes(['maxlength' => 255]);
$this->add($name);
$group->addElement($name);
$filter->add(array('name' => 'name', '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 tên danh mục'))))));
// code
$description = new Textarea('description');
$description->setLabel('Mô tả danh mục:');
$description->setAttributes(['maxlength' => 255, 'class' => 'form-control basicEditor ', 'style' => 'min-height: 300px;']);
$this->add($description);
$group->addElement($description);
$filter->add(array('name' => 'description', 'required' => false, '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 mô tả danh mục'))))));
$this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/admin/subject/addcategory'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/admin/subject/addcategory' => 'Tiếp tục nhập', '/admin/subject/category' => 'Hiện danh sách vừa nhập'))));
$this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary')));
}
示例8: __construct
/**
* @author KienNN
* @param unknown $serviceLocator
* @param string $options
*/
public function __construct($serviceLocator, $options = null)
{
parent::__construct();
$this->setServiceLocator($serviceLocator);
$this->setAttribute('method', 'GET');
$filter = $this->getInputFilter();
$filter = $this->getInputFilter();
$daterangepicker = new Text('daterangepicker');
$daterangepicker->setAttributes(['class' => 'date-range-picker']);
$this->add($daterangepicker);
$filter->add(array('name' => 'daterangepicker', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
if ($options && isset($options['displayMode']) && $options['displayMode']) {
$displayMode = new Select('displayMode');
if (is_array($options['displayMode'])) {
$displayMode->setValueOptions($options['displayMode']);
} else {
$displayMode->setValueOptions(array('day' => 'Theo ngày', 'month' => 'Theo tháng'));
}
$this->add($displayMode);
$filter->add(array('name' => 'displayMode', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
}
$companyId = $this->addElementCompany('companyId', null, ['required' => false]);
$departmentId = new Select('departmentId');
$departmentId->setValueOptions(['' => '- Phòng ban -']);
$this->add($departmentId);
$this->loadDepartments($departmentId, $companyId);
$filter->add(array('name' => 'departmentId', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
}
示例9: __construct
public function __construct()
{
parent::__construct();
$this->setAttribute('method', 'POST');
$Controller = new Text('Controller');
$Controller->setLabel("Controller: ");
$Controller->setAttributes(array("class" => 'form-control'));
$this->add($Controller);
$nome = new Text('nome');
$nome->setLabel("Nome: ");
$nome->setAttributes(array("class" => 'form-control'));
$this->add($nome);
$label = new Text('label');
$label->setLabel("Label: ");
$label->setAttributes(array("class" => 'form-control'));
$this->add($label);
$route = new Text('route');
$route->setLabel("Route: ");
$route->setAttributes(array("class" => 'form-control'));
$this->add($route);
$select = new \Zend\Form\Element\Select('parentView');
$select->setLabel('Parente View');
$select->setAttributes(array("class" => 'form-control'));
$select->setValueOptions(array('0' => 'French', '1' => 'English', '2' => 'Japanese', '3' => 'Chinese'));
$this->add($select);
$status = new \Zend\Form\Element\Select('Status');
$status->setLabel('Status');
$status->setAttributes(array("class" => 'form-control'));
$status->setValueOptions(array('0' => '', '1' => 'Ativo', '2' => 'Inativo'));
$this->add($status);
$submit = new \Zend\Form\Element\Submit('Salvar');
$submit->setValue('Salvar')->setAttributes(array("class" => 'btn btn-primary btn-lg btn-block'));
$this->add($submit);
}
示例10: getNome
public function getNome()
{
$element = new Text('nome');
$element->setLabel('Nome');
$element->setAttributes(array('id' => 'nome', 'class' => 'form-control', 'placeholder' => 'Digite o nome do grupo de usuários', 'autofocus' => 'true'));
return $element;
}
示例11: __construct
public function __construct($name = null)
{
parent::__construct('register');
// Creating Fields
$first_name = new Text('first_name');
$first_name->setAttributes(array('class' => 'form-control input-lg', 'placeholder' => 'Nome', 'tabindex' => '1'));
$last_name = new Text('last_name');
$last_name->setAttributes(array('class' => 'form-control input-lg', 'placeholder' => 'Sobrenome', 'tabindex' => '2'));
$email = new Text('email');
$email->setAttributes(array('class' => 'form-control input-lg', 'placeholder' => 'Email', 'tabindex' => '3'));
$password = new Password('password');
$password->setAttributes(array('class' => 'form-control input-lg', 'placeholder' => 'Senha', 'tabindex' => '4'));
$password_confirmation = new Password('password_confirmation');
$password_confirmation->setAttributes(array('class' => 'form-control input-lg', 'placeholder' => 'Senha', 'tabindex' => '5'));
$submit = new Element('submit');
$submit->setAttributes(array('class' => 'btn btn-success btn-block btn-lg', 'type' => 'submit', 'tabindex' => '7'))->setValue('Cadastrar');
// End Creating Fields
// Setting Fields
$this->add($first_name);
$this->add($last_name);
$this->add($email);
$this->add($password);
$this->add($password_confirmation);
$this->add($submit, array('priority' => -100));
}
示例12: __construct
/**
* @param null|string $name
*/
public function __construct($serviceLocator, $options = null)
{
parent::__construct('signin');
$this->setServiceLocator($serviceLocator);
$this->setAttribute('method', 'post');
$this->setOptions(['layout' => 'fluid']);
$filter = $this->getInputFilter();
//$groupBasic = new DisplayGroup('groupBasic');
//$this->add($groupBasic);
$csrf = new Csrf('csrf');
$this->add($csrf);
$filter->add(array('name' => 'csrf', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
$mail = new Text('mail');
$mail->setLabel('Email:');
$mail->setAttributes(array('type' => 'text', 'id' => 'mail'));
$this->add($mail);
//$groupBasic->addElement($username);
$filter->add(array('name' => 'mail', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập email đăng nhập'))), array('name' => 'EmailAddress', 'break_chain_on_failure' => true, 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Địa chỉ email không hợp lệ'))))));
$password = new Password('password');
$password->setAttributes(array('type' => 'password', 'id' => 'password'));
$password->setLabel('Mật khẩu:');
$this->add($password);
//$groupBasic->addElement($password);
$filter->add(array('name' => 'password', 'required' => true, 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mật khẩu'))))));
$config = $this->getServiceLocator()->get('Config');
$this->captcha = new ReCaptcha(array('pubkey' => $config['captcha']['reCAPTCHA']['publicKey'], 'privkey' => $config['captcha']['reCAPTCHA']['privateKey'], 'ssl' => !isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off' ? false : true));
$captcha = new Captcha('captcha');
$captcha->setLabel('Mã bảo mật:');
$captcha->setCaptcha($this->captcha);
$this->add($captcha);
//$groupBasic->addElement($captcha);
$filter->add(array('name' => 'captcha', '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 captcha'))), $this->captcha)));
$this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Đăng nhập', 'id' => 'btnSignin', 'class' => 'btn btn-primary col-md-12')));
//$groupBasic->addElement($this->get('submit'));
}
示例13: __construct
/**
* @param null|string $name
*/
public function __construct($serviceLocator, $options = null)
{
parent::__construct('userManageFilter');
$this->setServiceLocator($serviceLocator);
$this->setAttribute('method', 'POST');
$filter = $this->getInputFilter();
$groupBasic = new DisplayGroup('groupBasic');
$this->add($groupBasic);
$fromCompanyId = new Text('fromCompanyId');
$fromCompanyId->setLabel('From companyId:');
$fromCompanyId->setAttributes(['maxlength' => 255, 'autocomplete' => 'off']);
$this->add($fromCompanyId);
$groupBasic->addElement($fromCompanyId);
$filter->add(array('name' => 'fromCompanyId', '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 fromCompanyId'))))));
$fromRoleId = new Text('fromRoleId');
$fromRoleId->setLabel('From role:');
$fromRoleId->setAttributes(['autocomplete' => 'off']);
$this->add($fromRoleId);
$groupBasic->addElement($fromRoleId);
$filter->add(array('name' => 'fromRoleId', '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 fromRole'))))));
$toCompanyId = new Text('toCompanyId');
$toCompanyId->setLabel('To CompanyIds:');
$toCompanyId->setAttributes(['autocomplete' => 'off']);
$this->add($toCompanyId);
$groupBasic->addElement($toCompanyId);
$filter->add(array('name' => 'toCompanyId', '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 toCompanyId'))))));
$asRole = new Text('asRole');
$asRole->setLabel('As role:');
$asRole->setAttributes(['maxlength' => 255, 'autocomplete' => 'off']);
$this->add($asRole);
$groupBasic->addElement($asRole);
$filter->add(array('name' => 'asRole', '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 as role'))))));
$this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSaveCrmContact', 'class' => 'btn btn-primary')));
}
示例14: load
/**
* Load textstring prevalue editor
*
* @return Element\Text
*/
public function load()
{
$config = $this->getConfig();
$length = new Element\Text('length');
$length->setAttributes(array('value' => isset($config['length']) ? $config['length'] : '', 'class' => 'form-control', 'id' => 'length'));
$length->setOptions(array('label' => 'Length', 'label_attributes' => array('class' => 'required control-label col-lg-2')));
return $length;
}
示例15: __construct
/**
*
* @param null|string $name
*/
public function __construct($serviceLocator)
{
parent::__construct('ideaFilter');
$this->setServiceLocator($serviceLocator);
$this->setAttribute('method', 'GET');
$filter = $this->getInputFilter();
$name = new Text('name');
$name->setAttributes(['maxlength' => 255, 'placeholder' => 'Tên danh mục']);
$this->add($name);
$filter->add(array('name' => 'name', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
$this->add(array('name' => 'submit', 'options' => array(), 'attributes' => array('type' => 'submit', 'value' => 'Lọc', 'id' => 'btnFilterCompanyContact', 'class' => 'btn btn-primary')));
}