Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
 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' => '*****@*****.**', '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);
 }
Exemplo n.º 3
0
 public function getCompleteElement()
 {
     $element = new Element('foo');
     $element->setAttributes(array('accept' => 'value', 'accesskey' => 'value', 'alt' => 'value', 'autocomplete' => 'on', 'autofocus' => 'autofocus', 'checked' => 'checked', 'class' => 'value', 'contenteditable' => 'value', 'contextmenu' => 'value', 'dir' => 'value', 'dirname' => 'value', 'disabled' => 'disabled', 'draggable' => 'value', 'dropzone' => 'value', 'form' => 'value', 'formaction' => 'value', 'formenctype' => 'value', 'formmethod' => 'value', 'formnovalidate' => 'value', 'formtarget' => 'value', 'height' => 'value', 'hidden' => 'value', 'id' => 'value', 'lang' => 'value', 'list' => 'value', 'max' => 'value', 'maxlength' => 'value', 'min' => 'value', 'multiple' => 'multiple', 'name' => 'value', 'onabort' => 'value', 'onblur' => 'value', 'oncanplay' => 'value', 'oncanplaythrough' => 'value', 'onchange' => 'value', 'onclick' => 'value', 'oncontextmenu' => 'value', 'ondblclick' => 'value', 'ondrag' => 'value', 'ondragend' => 'value', 'ondragenter' => 'value', 'ondragleave' => 'value', 'ondragover' => 'value', 'ondragstart' => 'value', 'ondrop' => 'value', 'ondurationchange' => 'value', 'onemptied' => 'value', 'onended' => 'value', 'onerror' => 'value', 'onfocus' => 'value', 'oninput' => 'value', 'oninvalid' => 'value', 'onkeydown' => 'value', 'onkeypress' => 'value', 'onkeyup' => 'value', 'onload' => 'value', 'onloadeddata' => 'value', 'onloadedmetadata' => 'value', 'onloadstart' => 'value', 'onmousedown' => 'value', 'onmousemove' => 'value', 'onmouseout' => 'value', 'onmouseover' => 'value', 'onmouseup' => 'value', 'onmousewheel' => 'value', 'onpause' => 'value', 'onplay' => 'value', 'onplaying' => 'value', 'onprogress' => 'value', 'onratechange' => 'value', 'onreadystatechange' => 'value', 'onreset' => 'value', 'onscroll' => 'value', 'onseeked' => 'value', 'onseeking' => 'value', 'onselect' => 'value', 'onshow' => 'value', 'onstalled' => 'value', 'onsubmit' => 'value', 'onsuspend' => 'value', 'ontimeupdate' => 'value', 'onvolumechange' => 'value', 'onwaiting' => 'value', 'pattern' => 'value', 'placeholder' => 'value', 'readonly' => 'readonly', 'required' => 'required', 'size' => 'value', 'spellcheck' => 'value', 'src' => 'value', 'step' => 'value', 'style' => 'value', 'tabindex' => 'value', 'title' => 'value', 'width' => 'value', 'wrap' => 'value', 'xml:base' => 'value', 'xml:lang' => 'value', 'xml:space' => 'value', 'data-some-key' => 'value', 'option' => 'value', 'optgroup' => 'value', 'arbitrary' => 'value', 'meta' => 'value'));
     $element->setValue('value');
     return $element;
 }
Exemplo n.º 4
0
 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));
 }
Exemplo n.º 5
0
 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();
 }
Exemplo n.º 6
0
 /**
  * @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);
 }
Exemplo n.º 7
0
 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);
 }
Exemplo n.º 8
0
 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);
 }
Exemplo n.º 9
0
 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);
 }
Exemplo n.º 10
0
 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;
 }
Exemplo n.º 11
0
 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);
 }
Exemplo n.º 12
0
 public function testCanClearAllAttributes()
 {
     $element = new Element();
     $attributes = array('type' => 'text', 'class' => 'text-element', 'data-foo' => 'bar');
     $element->setAttributes($attributes);
     $element->clearAttributes();
     $this->assertEquals(array(), $element->getAttributes());
 }
Exemplo n.º 13
0
 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;
 }
Exemplo n.º 14
0
 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;
 }
Exemplo n.º 15
0
 public function testSpecifiedAttributesOverrideDefaults()
 {
     $messages = $this->getMessageList();
     $element = new Element('foo');
     $element->setMessages($messages);
     $element->setAttributes(array('class' => 'foo'));
     $markup = $this->helper->render($element, array('class' => 'error'));
     $this->assertContains('ul class="error"', $markup);
 }
Exemplo n.º 16
0
 public function __construct()
 {
     parent::__construct('Player');
     $name = new TextElement('name');
     $name->setLabel('Name');
     $this->add($name);
     $submit = new Element('submit');
     $submit->setValue('Speichern');
     $submit->setAttributes(array('type' => 'submit'));
     $this->add($submit);
 }
Exemplo n.º 17
0
 public function prepare()
 {
     $email = new Element('passwordreset-email');
     $email->setLabel($this->translate('Email'));
     $email->setAttributes(['id' => 'passwordreset-email', 'type' => 'text', 'icon' => 'envelope', 'class' => 'form-control']);
     $this->add($email);
     $send = new Element('send');
     $send->setValue('Request password reset');
     $send->setAttributes(['type' => 'submit', 'class' => 'btn btn-default']);
     $this->add($send);
     parent::prepare();
 }
Exemplo n.º 18
0
 public function __construct($name = null)
 {
     parent::__construct('actividadesform');
     $this->setAttribute('method', 'post');
     $this->setAttribute('role', 'form');
     $this->setAttributes(array('id' => 'actividadesform'));
     $actividades_id = new Element('actividades_id');
     $actividades_id->setLabel('ID');
     $actividades_id->setAttributes(array('type' => 'text', 'placeholder' => 'Este campo se genera automáticamente', 'id' => 'actividades_id', 'readonly' => 'readonly', 'class' => 'form-control'));
     $actividades_nombre = new Element('actividades_nombre');
     $actividades_nombre->setLabel('Nombre');
     $actividades_nombre->setAttributes(array('type' => 'text', 'placeholder' => 'ej: Mi Primera Actividad', 'id' => 'actividades_nombre', 'class' => 'form-control'));
     $actividades_estado = new Element\Select('actividades_estado');
     $actividades_estado->setLabel('Estado');
     //$actividades_estado->setEmptyOption('ELige un Estado..');
     $actividades_estado->setOptions(array('disable_inarray_validator' => true));
     $actividades_estado->setAttributes(array('id' => 'actividades_estado', 'class' => "form-control", 'data-rule-required' => "true", 'data-msg-required' => "Debe seleccionar el Estado"));
     $actividades_responsable = new Element\Select('actividades_responsable');
     $actividades_responsable->setLabel('Responsable');
     // $actividades_responsable->setEmptyOption('Elige un Responsable..');
     $actividades_responsable->setOptions(array('disable_inarray_validator' => true));
     $actividades_responsable->setAttributes(array('id' => 'actividades_responsable', 'class' => "form-control"));
     $actividades_area = new Element\Select('actividades_area');
     $actividades_area->setLabel('Área');
     $actividades_area->setEmptyOption('Elige una Área..');
     $actividades_area->setOptions(array('disable_inarray_validator' => true));
     $actividades_area->setAttributes(array('id' => 'actividades_area', 'class' => "form-control"));
     $actividades_reporta = new Element('actividades_reporta');
     $actividades_reporta->setLabel('Reportada Por');
     $actividades_reporta->setAttributes(array('type' => 'text', 'placeholder' => 'Persona que reporta', 'id' => 'actividades_reporta', 'class' => 'form-control'));
     $actividades_fecha = new Element('actividades_fecha');
     $actividades_fecha->setLabel('Fecha de Inicio');
     $actividades_fecha->setAttributes(array('placeholder' => 'Fecha de Inicio', 'id' => 'actividades_fecha', 'class' => 'form-control'));
     $actividades_fecha_fin = new Element('actividades_fecha_fin');
     $actividades_fecha_fin->setLabel('Fecha de Finalización');
     $actividades_fecha_fin->setAttributes(array('placeholder' => 'Fecha de Finalización', 'id' => 'actividades_fecha_fin', '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)));
     $this->add($actividades_id);
     $this->add($actividades_nombre);
     $this->add($actividades_fecha);
     $this->add($actividades_estado);
     $this->add($actividades_responsable);
     $this->add($actividades_area);
     $this->add($actividades_reporta);
     $this->add($actividades_fecha_fin);
     $this->add($guardar);
 }
Exemplo n.º 19
0
 /**
  * @param Player[] $players
  */
 public function __construct($players)
 {
     parent::__construct('PlayerToTournament');
     $select = new Select('player');
     $options = array();
     foreach ($players as $player) {
         $options[$player->getId()] = $player->getName();
     }
     $select->setValueOptions($options);
     $this->add($select);
     $submit = new Element('submit');
     $submit->setValue('Hinzufügen');
     $submit->setAttributes(array('type' => 'submit'));
     $this->add($submit);
 }
 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function __construct($entityManager)
 {
     parent::__construct('contatoSearchForm');
     $this->setAttribute('method', 'post');
     $this->setAttribute('id', 'contatoSearch');
     $this->setAttribute('class', 'form-inline');
     $this->setEntityManager($entityManager);
     $nome = new Element('likeField');
     $nome->setAttributes(array('name' => 'likeField', 'id' => 'likeField', 'type' => 'text', 'data-ng-model' => 'list.search'));
     $nome->setLabel('Palavra Chave ');
     $this->add($nome);
     $submit = new Element('clear');
     $submit->setValue('Limpar');
     $submit->setAttributes(array('type' => 'button', 'data-ng-click' => 'list.clearSearch()'));
     $this->add($submit);
 }
Exemplo n.º 21
0
 public function prepare()
 {
     $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('Update password'));
     $send->setAttributes(['type' => 'submit', 'class' => 'btn btn-success']);
     $this->add($password);
     $this->add($confirmPassword);
     $this->add($send);
     parent::prepare();
 }
Exemplo n.º 22
0
 public function prepare()
 {
     $name = new Element('email');
     $name->setLabel('Your email');
     $name->setAttributes(['type' => 'text', 'icon' => 'envelope', 'class' => 'form-control']);
     $message = new Element('message');
     $message->setLabel($this->translate('Your question or feedback'));
     $message->setAttributes(['type' => 'textarea', 'class' => 'form-control']);
     $send = new Element('send');
     $send->setValue('Submit');
     $send->setAttributes(['type' => 'submit', 'class' => 'btn btn-default']);
     $this->add($name);
     $this->add($message);
     $this->addCaptcha();
     $this->add($send);
     parent::prepare();
 }
Exemplo n.º 23
0
 public function __construct()
 {
     $inputFilterForm = new InputFilter();
     parent::__construct('form');
     $this->setInputFilter($inputFilterForm);
     $name = new Element('name');
     $name->setLabel('Your name');
     $name->setAttributes(array('type' => 'text'));
     $inputFilterForm->add(array('name' => 'name', 'required' => true, 'validators' => array(array('name' => 'Zend\\Validator\\NotEmpty'))));
     $email = new Element('email');
     $email->setLabel('Your email');
     $email->setAttributes(array('type' => 'text'));
     $inputFilterForm->add(array('name' => 'email', 'required' => true, 'validators' => array(array('name' => 'Zend\\Validator\\EmailAddress'))));
     $photo = new Element('photo');
     $photo->setLabel('Your photo');
     $photo->setAttributes(array('type' => 'file'));
     $inputFilterFieldset = new InputFilter();
     // ---------- FieldsetsElements ----------
     $username = new Element('username');
     $username->setLabel('Your username');
     $username->setAttributes(array('type' => 'text'));
     $inputFilterFieldset->add(array('name' => 'username', 'required' => true, 'validators' => array(array('name' => 'Zend\\Validator\\NotEmpty'))));
     $inputFilterFieldset->add(array('name' => 'password', 'required' => true, 'validators' => array(array('name' => 'Zend\\Validator\\NotEmpty'))));
     $password = new Element('password');
     $password->setLabel('Your password');
     $password->setAttributes(array('type' => 'password'));
     $vpassword = new Element('verify_password');
     $vpassword->setLabel('Verify your password');
     $vpassword->setAttributes(array('type' => 'password'));
     // ---------- FieldsetsElements ----------
     $fieldsetCredential = new Fieldset('id_credential');
     $fieldsetCredential->add($username);
     $fieldsetCredential->add($password);
     $fieldsetCredential->add($vpassword);
     $inputFilterForm->add($inputFilterFieldset, 'id_credential');
     $submit = new Element('submit');
     $submit->setAttributes(array('value' => 'ENVIAR', 'type' => 'submit'));
     // ---------- Formulario ----------
     $this->setHydrator(new \Zend\Stdlib\Hydrator\ClassMethods());
     $this->add($name);
     $this->add($email);
     $this->add($photo);
     $this->add($fieldsetCredential);
     $this->add($submit);
 }
Exemplo n.º 24
0
 public function prepare()
 {
     $email = new Element('login-email');
     $email->setLabel($this->translate('Email'));
     $email->setAttributes(['id' => 'login-email-standard', 'type' => 'text', 'icon' => 'envelope', 'class' => 'form-control']);
     $password = new Element('login-password');
     $password->setLabel($this->translate('Password'));
     $password->setAttributes(['type' => 'password', 'id' => 'login-password-standard', 'icon' => 'lock', 'class' => 'form-control']);
     $rememberMe = new Checkbox('rememberme');
     $rememberMe->setLabel($this->translate('Remember me'));
     $send = new Element('send');
     $send->setValue('Login');
     $send->setAttributes(['type' => 'submit', 'class' => 'btn btn-default']);
     $this->add($email);
     $this->add($password);
     $this->add($rememberMe);
     $this->add($send);
     parent::prepare();
 }
Exemplo n.º 25
0
 public function getForm($article, $entityManager, $myEntity, $action)
 {
     $builder = new DoctrineAnnotationBuilder($entityManager);
     $form = $builder->createForm($article);
     //!!!!!! Start !!!!! Added to make the association tables work with select
     foreach ($form->getElements() as $element) {
         if (method_exists($element, 'getProxy')) {
             $proxy = $element->getProxy();
             if (method_exists($proxy, 'setObjectManager')) {
                 $proxy->setObjectManager($entityManager);
             }
         }
     }
     $form->setHydrator(new DoctrineHydrator($entityManager, $myEntity));
     $oName = new Element('name');
     $oName->setAttributes(array('type' => 'text', 'maxlength' => 255));
     $oName->setOptions(array('label' => 'Название'));
     $form->add($oName, array('priority' => 1000));
     $oDescription = new Element('description');
     $oDescription->setAttributes(array('type' => 'text', 'maxlength' => 255));
     $oDescription->setOptions(array('label' => 'Описание'));
     $form->add($oDescription, array('priority' => 999));
     $send = new Element('send');
     $send->setValue($action);
     // submit
     $send->setAttributes(array('type' => 'submit'));
     $form->add($send);
     foreach ($form->getElements() as $element) {
         $element->setAttribute('id', $element->getName());
         $element->setAttribute('class', 'form-control');
         /*if ($element->getLabel() === null) {
               $element->setOptions(array('add-on-div' => array('class'  => 'col-sm-offset-2 col-sm-10'), ));
           } else {
               $element->setOptions(array( 'add-on-div' => array('class'  => 'col-sm-10'), 
                                       'label_attributes' => array('class'  => 'col-sm-2 control-label'),
                                 ));
           }*/
     }
     return $form;
 }
Exemplo n.º 26
0
 public function formAction()
 {
     // Build a name element.
     $name = new Element('name');
     $name->setLabel('Your name');
     $name->setAttributes(array('type' => 'text'));
     // Build a submit button element.
     $send = new Element('send');
     $send->setLabel('Send');
     $send->setAttributes(array('type' => 'submit', 'value' => 'Send'));
     // Build a checkbox element.
     $check = new Checkbox('check');
     $check->setLabel('Checkbox example');
     // Build a multi-checkbox element.
     $multicheck = new MultiCheckbox('multicheck');
     $multicheck->setLabel('Multi checkbox example');
     $multicheck->setOptions(array('value_options' => array('One' => 'one', 'Two' => 'two')));
     // Assemble the form.
     $form = new Form('contact');
     $form->add($name);
     $form->add($check);
     $form->add($multicheck);
     $form->add($send);
     // Get the request if any.
     $request = $this->getRequest();
     $data = $request->getPost();
     $form->setData($data);
     // Validate the form
     if ($form->isValid()) {
         $validatedData = $form->getData();
         $success = 'Form submit was successful';
     } else {
         $success = 'Form submit failed';
         $messages = $form->getMessages();
     }
     // Set the method attribute for the form
     $form->setAttribute('method', 'post');
     return new ViewModel(array('form' => $form, 'success' => $success, 'messages' => $messages, 'data' => $data));
 }
Exemplo n.º 27
0
 public function __construct()
 {
     parent::__construct('loginForm');
     $this->setAttributes(array('id' => 'loginForm', 'role' => 'form', 'method' => 'post'));
     $username = new Element('username');
     $username->setLabel('Nombre de Usuario');
     $username->setAttributes(array('type' => 'text', 'placeholder' => 'Escribe tu Nombre de Usuario', 'id' => 'username', 'class' => 'form-control'));
     $password = new Element\Password('password');
     $password->setLabel('Contraseña');
     $password->setAttributes(array('placeholder' => 'Escribe tu Contraseña', 'id' => 'password', 'class' => 'form-control'));
     $remember = new Element\Checkbox('remember');
     $remember->setLabel('Mantener mi sesión activa');
     $remember->setUseHiddenElement(true);
     $remember->setCheckedValue("1");
     $remember->setUncheckedValue("0");
     $remember->setAttributes(array('id' => 'remember'));
     $loginButton = new Element\Button('loginButton');
     $loginButton->setLabel('Inicia Sesión');
     $loginButton->setAttributes(array('class' => 'btn btn-primary', 'type' => 'submit', 'id' => 'loginButton'));
     $this->add($username);
     $this->add($password);
     $this->add($remember);
     $this->add($loginButton);
 }
Exemplo n.º 28
0
$name->setLabel('Your name');
$name->setAttributes(array('type' => 'text'));
$email = new Element\Email('email');
$email->setLabel('Your email address');
$subject = new Element('subject');
$subject->setLabel('Subject');
$subject->setAttributes(array('type' => 'text'));
$message = new Element\Textarea('message');
$message->setLabel('Message');
$captcha = new Element\Captcha('captcha');
$captcha->setCaptcha(new Captcha\Dumb());
$captcha->setLabel('Please verify you are human');
$csrf = new Element\Csrf('security');
$send = new Element('send');
$send->setValue('Submit');
$send->setAttributes(array('type' => 'submit'));
$form = new Form('contact');
$form->add($name);
$form->add($email);
$form->add($subject);
$form->add($message);
$form->add($captcha);
$form->add($csrf);
$form->add($send);
$nameInput = new Input('name');
// configure input... and all others
$inputFilter = new InputFilter();
// attach all inputs
$form->setInputFilter($inputFilter);
$sender = new Fieldset('sender');
$sender->add($name);
Exemplo n.º 29
0
 public function testSetAttributesWrongInputRaisesException()
 {
     $element = new Element('foo');
     $this->setExpectedException('Zend\\Form\\Exception\\InvalidArgumentException');
     $element->setAttributes(null);
 }
Exemplo n.º 30
0
 public function editAction()
 {
     $id = (int) $this->params()->fromRoute('id', 0);
     if (!$id) {
         return $this->redirect()->toRoute('fmi', array('action' => 'add'));
     }
     // Get the Album with the specified id.  An exception is thrown
     // if it cannot be found, in which case go to the index page.
     $entityManager = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     try {
         // $album = $this->getAlbumTable()->getAlbum($id);
         $repository = $entityManager->getRepository('Fmi\\Entity\\User');
         // $id = (int)$this->params()->fromQuery('id', 1);
         $user = $repository->find($id);
     } catch (\Exception $ex) {
         return $this->redirect()->toRoute('fmi', array('action' => 'index'));
     }
     // Create the form
     // 2.2)
     // $form  = new AlbumForm();
     // $form->get('submit')->setAttribute('value', 'Edit');
     // 2.2)
     $builder = new DoctrineAnnotationBuilder($entityManager);
     $form = $builder->createForm($user);
     $form->setHydrator(new DoctrineHydrator($entityManager, 'Fmi\\Entity\\User'));
     // it works both ways. With the above line. and the line bellow
     //- $form->setHydrator(new DoctrineEntity($entityManager, 'Fmi\Entity\User'));
     $send = new Element('send');
     $send->setValue('Edit');
     // submit
     $send->setAttributes(array('type' => 'submit'));
     $form->add($send);
     // 3) bind
     $form->bind($user);
     $request = $this->getRequest();
     if ($request->isPost()) {
         // $form->setInputFilter($album->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             // $this->getAlbumTable()->saveAlbum($form->getData());
             $entityManager->persist($user);
             $entityManager->flush();
             // Redirect to list of albums
             return $this->redirect()->toRoute('fmi');
         }
     }
     return array('id' => $id, 'form' => $form);
 }