作者:Crisstthia
项目:Reminde
public function __construct($name = null)
{
parent::__construct('objetosform');
$this->setAttribute('method', 'post');
$this->setAttribute('role', 'form');
$this->setAttributes(array('id' => 'objetosform'));
$objetos_actividad_id = new Element('objetos_actividad_id');
$objetos_actividad_id->setLabel('Actividad');
$objetos_actividad_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'objetos_actividad_id', 'readonly' => 'readonly', 'class' => 'form-control'));
$objetos_id = new Element('objetos_id');
$objetos_id->setLabel('ID');
$objetos_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'objetos_id', 'readonly' => 'readonly', 'class' => 'form-control'));
$objetos_nombre = new Element('objetos_nombre');
$objetos_nombre->setLabel('Nombre');
$objetos_nombre->setAttributes(array('type' => 'text', 'placeholder' => 'ej: wKER001', 'id' => 'objetos_nombre', 'class' => 'form-control'));
$objetos_tipo = new Element\Select('objetos_tipo');
$objetos_tipo->setLabel('Tipo');
$objetos_tipo->setEmptyOption('Elige un Tipo..');
$objetos_tipo->setOptions(array('disable_inarray_validator' => true));
$objetos_tipo->setAttributes(array('id' => 'objetos_tipo', 'class' => "form-control"));
$guardar = new Element\Button('guardar');
$guardar->setAttributes(array('class' => 'btn btn-success mr5', 'type' => 'submit', 'id' => 'guardar'));
$guardar->setOptions(array('label' => '<i class="glyphicon glyphicon-floppy-disk"></i>', 'label_options' => array('disable_html_escape' => true)));
$etiquetas_id = new Element\Hidden('etiquetas_id');
$etiquetas_id->setAttributes(array('id' => 'etiquetas_id'));
$this->add($objetos_actividad_id);
$this->add($objetos_id);
$this->add($objetos_nombre);
$this->add($objetos_tipo);
$this->add($etiquetas_id);
$this->add($guardar);
}
作者:siad00
项目:ctrlli
protected function createElement(ZendElement $element, $attr = array())
{
if ($element instanceof Element && $element->getAttribute('type') == 'hidden') {
return parent::createElement($element, $attr);
}
return '<div class="controls">' . parent::createElement($element, $attr) . '</div>';
}
作者:Abiani
项目:CoreAp
public function __construct($name = null)
{
parent::__construct('datbaseform');
$this->setAttribute('class', 'p-t-15');
$this->setAttributes(array('id' => 'form-datos-bd', 'class' => 'form-horizontal'));
$username = new Element('username');
$username->setLabel('Nombre de Usuario:')->setLabelAttributes(array('class' => 'col-sm-3 control-label'));
$username->setAttributes(array('type' => 'text', 'placeholder' => 'ej. Admin', 'id' => 'username', 'class' => 'form-control', 'data-rule-required' => "true", 'data-msg-required' => "Este campo debe estar lleno", 'data-rule-minlength' => "6", 'data-msg-minlength' => "Debe tener al menos 6 caracteres"));
$password = new Element\Password('password');
$password->setLabel('Contraseña:')->setLabelAttributes(array('class' => 'col-sm-3 control-label required'));
$password->setAttributes(array('placeholder' => 'No uses 1234 ;)', 'id' => 'password', 'class' => 'form-control', 'data-rule-required' => "true", 'data-msg-required' => "Este campo debe estar lleno"));
$confirmaPassword = new Element\Password('confirmaPassword');
$confirmaPassword->setLabel(' ')->setLabelAttributes(array('class' => 'col-sm-3 control-label'));
$confirmaPassword->setAttributes(array('placeholder' => 'Por seguridad este campo es necesario', 'id' => 'confirmaPassword', 'class' => 'form-control'));
$email = new Element\Email('email');
$email->setLabel('Correo Electrónico:')->setLabelAttributes(array('class' => 'col-sm-3 control-label'));
$email->setAttributes(array('placeholder' => 'admin@tudominio.com', 'id' => 'email', 'class' => 'form-control'));
$buttonContinuar = new Element\Button('buttonContinuar');
$buttonContinuar->setLabel('Instalar');
$buttonContinuar->setAttributes(array('class' => 'btn btn-success', 'type' => 'submit', 'id' => 'buttonContinuar'));
$buttonLimpiar = new Element\Button('buttonLimpiar');
$buttonLimpiar->setLabel('<i class="pg-close"></i> Limpiar')->setLabelOptions(array('disable_html_escape' => true));
$buttonLimpiar->setAttributes(array('class' => 'btn btn-default', 'id' => 'buttonLimpiar', 'type' => 'reset'));
$this->add($username);
$this->add($password);
$this->add($email);
$this->add($confirmaPassword);
$this->add($buttonContinuar);
$this->add($buttonLimpiar);
}
作者:thiagormoreir
项目:ClickMark-Ap
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));
}
作者:shashi9
项目:ZF2Dem
public function __construct($param = null)
{
$this->param = $param;
parent::__construct('register');
$first_name = new Element('first_name');
$first_name->setAttributes(array('type' => 'Zend\\Form\\Element\\Text', 'placeholder' => "Enter Your First Name", 'class' => "input-control", 'required' => true, 'id' => 'first_name'));
$last_name = new Element('last_name');
$last_name->setAttributes(array('type' => 'Zend\\Form\\Element\\Text', 'placeholder' => "Enter Your Last Name", 'class' => "input-control", 'required' => true, 'id' => 'last_name'));
$user_name = new Element('username');
$user_name->setAttributes(array('type' => 'Zend\\Form\\Element\\Text', 'placeholder' => "Enter Your Last Name", 'class' => "input-control", 'required' => true, 'id' => 'user_name'));
$email = new Element('email');
$email->setAttributes(array('type' => 'Zend\\Form\\Element\\Email', 'placeholder' => "Enter Your Email Address", 'class' => "input-control", 'required' => true, 'id' => 'email'));
$password = new Element('password');
$password->setAttributes(array('type' => 'password', 'placeholder' => "Create Your Password", 'class' => "input-control", 'required' => true, 'id' => 'password'));
$confirm_password = new Element('confirm_password');
$confirm_password->setAttributes(array('type' => 'password', 'placeholder' => "Re-enter Your Password", 'class' => "input-control", 'required' => true, 'id' => 'confirm_password'));
$submit_register = new Element('submit_register');
$submit_register->setAttributes(array('type' => 'Submit', 'value' => 'Sign Up', 'id' => 'submit_register'));
$this->setName("register");
$this->add($first_name);
$this->add($last_name);
$this->add($user_name);
$this->add($email);
$this->add($password);
$this->add($confirm_password);
$this->add($submit_register);
$this->setAttribute('enctype', 'multipart/form-data');
$rf = new RegisterFilter();
$this->inputFilter = $rf->getInputFilter();
$this->setInputFilter($this->inputFilter);
}
作者:rajanlami
项目:IntTes
public function testRendersValueAttributeAsTextareaContent()
{
$element = new Element('foo');
$element->setAttribute('value', 'Initial content');
$markup = $this->helper->render($element);
$this->assertContains('>Initial content</textarea>', $markup);
}
作者:netsensi
项目:zf2-foundatio
public function prepare()
{
$username = new Element('username');
$username->setLabel($this->translate('Your username'));
$username->setAttributes(['type' => 'text', 'icon' => 'user', 'class' => 'form-control']);
$email = new Element('email');
$email->setLabel($this->translate('Email (used to login)'));
$email->setAttributes(['type' => 'text', 'icon' => 'envelope', 'class' => 'form-control']);
$password = new Element('password');
$password->setLabel($this->translate('Password'));
$password->setAttributes(['type' => 'password', 'id' => 'password', 'icon' => 'lock', 'class' => 'form-control']);
$confirmPassword = new Element('confirm-password');
$confirmPassword->setLabel($this->translate('Confirm Password'));
$confirmPassword->setAttributes(['type' => 'password', 'icon' => 'lock', 'class' => 'form-control']);
$send = new Element('send');
$send->setValue($this->translate('Create My Account'));
$send->setAttributes(['type' => 'submit', 'class' => 'btn btn-default']);
$this->add($username);
$this->add($email);
$this->add($password);
$this->add($confirmPassword);
$this->addCaptcha();
$this->add($send);
parent::prepare();
}
作者:houzoum
项目:fm
public function updateAction()
{
$id = $this->params()->fromRoute('id');
if (!$id) {
return $this->redirect()->toRoute('album_dm/default', array('controller' => 'album-dm', 'action' => 'index'));
}
$entityManager = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
try {
$repository = $entityManager->getRepository('AlbumDm\\Entity\\Album');
$album = $repository->find($id);
} catch (\Exception $ex) {
echo $ex->getMessage();
// this never will be seen if you don't comment the redirect
return $this->redirect()->toRoute('album_dm/default', array('controller' => 'album-dm', 'action' => 'index'));
}
$builder = new DoctrineAnnotationBuilder($entityManager);
$form = $builder->createForm($album);
$form->setHydrator(new DoctrineHydrator($entityManager, 'AlbumDm\\Entity\\Album'));
$send = new Element('submit');
$send->setValue('Go');
// submit
$send->setAttributes(array('type' => 'submit'));
$form->add($send);
$form->bind($album);
$request = $this->getRequest();
if ($request->isPost()) {
$form->setData($request->getPost());
if ($form->isValid()) {
$entityManager->persist($album);
$entityManager->flush();
return $this->redirect()->toRoute('album_dm/default', array('controller' => 'album-dm', 'action' => 'index'));
}
}
return new ViewModel(array('form' => $form, 'id' => $id));
}
作者:rajanlami
项目:IntTes
public function __construct()
{
parent::__construct('nested_fieldset');
$field = new Element('anotherField', array('label' => 'Name'));
$field->setAttribute('type', 'text');
$this->add($field);
}
作者:Abiani
项目:CoreAp
public function __construct($name = null)
{
parent::__construct('datbaseform');
$this->setAttribute('class', 'p-t-15');
$this->setAttributes(array('id' => 'form-datos-bd', 'class' => 'form-horizontal'));
$servidorBd = new Element('servidorBd');
$servidorBd->setLabel('Servidor de la base de datos:')->setLabelAttributes(array('class' => 'col-sm-3 control-label'));
$servidorBd->setAttributes(array('type' => 'text', 'placeholder' => 'ej. localhost', 'id' => 'servidorBd', 'class' => 'form-control', 'data-rule-required' => "true", 'data-msg-required' => "Este campo debe estar lleno", 'data-rule-minlength' => "6", 'data-msg-minlength' => "Debe tener al menos 6 caracteres"));
$nombreBd = new Element('nombreBd');
$nombreBd->setLabel('Nombre de la base de datos:')->setLabelAttributes(array('class' => 'col-sm-3 control-label required'));
$nombreBd->setAttributes(array('type' => 'text', 'placeholder' => 'ej. tributum-produccion', 'id' => 'nombreBd', 'class' => 'form-control', 'data-rule-required' => "true", 'data-msg-required' => "Este campo debe estar lleno"));
$prefijoTablasBd = new Element('prefijoTablasBd');
$prefijoTablasBd->setLabel('Prefijo de tablas de la base de datos:')->setLabelAttributes(array('class' => 'col-sm-3 control-label'));
$prefijoTablasBd->setAttributes(array('type' => 'text', 'placeholder' => 'ej. trb-', 'id' => 'prefijoTablasBd', 'class' => 'form-control'));
$nombreUsuarioBd = new Element('nombreUsuarioBd');
$nombreUsuarioBd->setLabel('Nombre de usuario de la base de datos:')->setLabelAttributes(array('class' => 'col-sm-3 control-label'));
$nombreUsuarioBd->setAttributes(array('type' => 'text', 'placeholder' => 'ej. root', 'id' => 'nombreUsuarioBd', 'class' => 'form-control', 'data-rule-required' => "true", 'data-msg-required' => "Este campo debe estar lleno"));
$contrasenaDb = new Element\Password('contrasenaDb');
$contrasenaDb->setLabel('Contraseña de la base de datos:')->setLabelAttributes(array('class' => 'col-sm-3 control-label'));
$contrasenaDb->setAttributes(array('placeholder' => 'Por seguridad este campo es necesario', 'id' => 'contrasenaDb', 'class' => 'form-control'));
$buttonContinuar = new Element\Button('buttonContinuar');
$buttonContinuar->setLabel('Continuar');
$buttonContinuar->setAttributes(array('class' => 'btn btn-success', 'type' => 'submit', 'id' => 'buttonContinuar'));
$buttonLimpiar = new Element\Button('buttonLimpiar');
$buttonLimpiar->setLabel('<i class="pg-close"></i> Limpiar')->setLabelOptions(array('disable_html_escape' => true));
$buttonLimpiar->setAttributes(array('class' => 'btn btn-default', 'id' => 'buttonLimpiar', 'type' => 'reset'));
$this->add($servidorBd);
$this->add($nombreBd);
$this->add($prefijoTablasBd);
$this->add($nombreUsuarioBd);
$this->add($contrasenaDb);
$this->add($buttonContinuar);
$this->add($buttonLimpiar);
}
作者:razvansividr
项目:pnlzf2-
public function getCompleteElement()
{
$element = new Element('foo');
$element->setAttributes(array('accept' => 'value', 'alt' => 'value', 'autocomplete' => 'on', 'autofocus' => 'autofocus', 'checked' => 'checked', 'dirname' => 'value', 'disabled' => 'disabled', 'form' => 'value', 'formaction' => 'value', 'formenctype' => 'value', 'formmethod' => 'value', 'formnovalidate' => 'value', 'formtarget' => 'value', 'height' => 'value', 'id' => 'value', 'list' => 'value', 'max' => 'value', 'maxlength' => 'value', 'min' => 'value', 'multiple' => 'multiple', 'name' => 'value', 'pattern' => 'value', 'placeholder' => 'value', 'readonly' => 'readonly', 'required' => 'required', 'size' => 'value', 'src' => 'value', 'step' => 'value', 'width' => 'value'));
$element->setValue('value');
return $element;
}
作者:mauriciopibe
项目:sandbox-contac
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function __construct($entityManager)
{
parent::__construct('contatoForm');
$this->setAttribute('method', 'post');
$this->setAttribute('id', 'fileupload');
$this->setEntityManager($entityManager);
$idContato = new Element('idContato');
$idContato->setLabel('Contato');
$idContato->setAttributes(array('name' => 'idContato', 'id' => 'idContato', 'type' => 'hidden'));
$this->add($idContato);
$email = new Element('email');
$email->setLabel('Email');
$email->setAttributes(array('name' => 'email', 'id' => 'email', 'type' => 'text', 'class' => 'form-control'));
$this->add($email);
$assunto = new Element('assunto');
$assunto->setLabel('Assunto');
$assunto->setAttributes(array('name' => 'assunto', 'id' => 'assunto', 'type' => 'text', 'class' => 'form-control'));
$this->add($assunto);
$mensagem = new Element\Textarea('mensagem');
$mensagem->setLabel('Mensagem');
$mensagem->setAttributes(array('name' => 'mensagem', 'id' => 'mensagem', 'type' => 'textarea', 'class' => 'form-control'));
$this->add($mensagem);
$submit = new Element('submit');
$submit->setValue('Salvar');
$submit->setAttributes(array('type' => 'submit'));
$this->add($submit);
}
作者:Crisstthia
项目:Reminde
public function __construct($name = null)
{
parent::__construct('usuariosform');
$this->setAttribute('method', 'post');
$this->setAttribute('role', 'form');
$this->setAttributes(array('id' => 'usuariosform'));
$usuarios_id = new Element('usuarios_id');
$usuarios_id->setLabel('ID');
$usuarios_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'usuarios_id', 'readonly' => 'readonly', 'class' => 'form-control'));
$usuarios_username = new Element('usuarios_username');
$usuarios_username->setLabel('Usuario');
$usuarios_username->setAttributes(array('type' => 'text', 'placeholder' => 'dvader', 'id' => 'usuarios_username', 'class' => 'form-control'));
$usuarios_nombres = new Element('usuarios_nombres');
$usuarios_nombres->setLabel('Nombre');
$usuarios_nombres->setAttributes(array('type' => 'text', 'placeholder' => 'Darth Vader', 'id' => 'usuarios_nombres', 'class' => 'form-control'));
$usuarios_estado = new Element\Select('usuarios_estado');
$usuarios_estado->setLabel('Estado');
//$usuarios_estado->setEmptyOption('ELige un Estado..');
$usuarios_estado->setOptions(array('disable_inarray_validator' => true));
$usuarios_estado->setAttributes(array('id' => 'usuarios_estado', 'class' => "form-control", 'data-rule-required' => "true", 'data-msg-required' => "Debe seleccionar el Estado"));
$guardar = new Element\Button('guardar');
$guardar->setAttributes(array('class' => 'btn btn-success mr5', 'type' => 'submit', 'id' => 'guardar'));
$guardar->setOptions(array('label' => '<i class="glyphicon glyphicon-floppy-disk"></i>', 'label_options' => array('disable_html_escape' => true)));
$this->add($usuarios_id);
$this->add($usuarios_username);
$this->add($usuarios_nombres);
$this->add($usuarios_estado);
$this->add($guardar);
}
作者:3makk
项目:Foundatio
public function testRendersOnErrorAsEspected()
{
$element = new Element('testElement');
$element->setAttribute('value', 'Initial Content');
$element->setMessages(array('testElement' => 'no valid'));
$markup = $this->helper->render($element);
$this->assertContains('error', $markup);
}
作者:NguyenQuiDuon
项目:Funixtes
/**
* @param Element $element
*/
public function addElement($element)
{
$options = $element->getOptions();
$options['displayGroup'] = $this->getName();
$element->setOptions($options);
$this->elements[$element->getName()] = $element;
return $this;
}
作者:siad00
项目:ctrlli
protected function createElement(Element $element, $attr = array())
{
$tmpAttr = $element->getAttributes();
$element->setAttributes($this->_getElementAttr($element, $attr));
$html = $this->_getElementRenderer($element->getAttribute('type'))->render($element);
$element->setAttributes($tmpAttr);
return $html;
}
作者:haoyanfe
项目:zf
public function testRendersNestedMessageSetsAsAFlatList()
{
$messages = array(array('First validator message'), array('Second validator first message', 'Second validator second message'));
$element = new Element('foo');
$element->setMessages($messages);
$markup = $this->helper->render($element, array('class' => 'error'));
$this->assertRegexp('#<ul class="error">\\s*<li>First validator message</li>\\s*<li>Second validator first message</li>\\s*<li>Second validator second message</li>\\s*</ul>#s', $markup);
}
作者:zourc
项目:zourc
public function __invoke(Element $element)
{
$description = $element->getOption('description');
if (!$description) {
return '';
}
return sprintf('<div class="zui-description">%s</div>', $this->getView()->translate($description));
}
作者:siad00
项目:ctrlli
public function createElement(Element $form, $attr = array())
{
$tmpAttr = $form->getAttributes();
$form->setAttributes($this->_getElementAttr($form, $attr));
$html = $this->view->form()->openTag($form);
$form->setAttributes($tmpAttr);
return $html;
}
作者:navassouz
项目:zf
public function testSetUseHiddenElementAttributeDoesNotRenderHiddenInput()
{
$element = new Element('foo');
$element->setAttribute('useHiddenElement', false);
$markup = $this->helper->render($element);
$this->assertRegexp('#type="checkbox"\\s+value="1"#', $markup);
$this->assertNotRegexp('#type="hidden"\\s+name="foo"\\s+value="0"#', $markup);
}