public function initialize() { $this->_action = 'menuitem_add'; $name = new Text('name'); $name->setFilters(array('striptags', 'string')); $name->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off', 'id' => 'menuitem_name')); $name->setLabel('Name'); $url = new Text('url'); $url->setFilters(array('striptags', 'string')); $url->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off')); $url->setLabel('URL'); $icon = new Text('icon'); $icon->setFilters(array('striptags', 'string')); $icon->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off')); $icon->setLabel('Icon'); $device = new Select('device_id', Devices::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => 'None', 'emptyValue' => 0)); $device->setLabel('Device'); $menuId = new Hidden('menu_id'); $menuId->setDefault(1); $this->add($name); $this->add($url); $this->add($icon); $this->add($device); $this->add($menuId); }
public function initialize() { //Firstname $firstName = new Text('firstname', ['placeholder' => 'Firstname', 'required' => 'true', 'autofocus' => 'true', 'class' => 'text-box']); $firstName->addValidators([new PresenceOf(['message' => 'Firstname is required.'])]); $this->add($firstName); //Lastname $lastName = new Text('lastname', ['placeholder' => 'Lastname', 'autofocus' => 'true']); // $lastName->addValidators([ // new PresenceOf([ // 'message' => 'Lastname is required.' // ]) // ]); $this->add($lastName); //$username $username = new Text('username', ['placeholder' => t('Username'), 'required' => 'true', 'autofocus' => 'true', 'class' => 'text-box']); $username->addValidators([new PresenceOf(['message' => t('Username is required.')])]); $this->add($username); //Email $email = new Text('email', ['placeholder' => 'Email', 'required' => 'true', 'class' => 'text-box']); $email->addValidators([new PresenceOf(['message' => 'The e-mail is required']), new Email(['message' => 'The e-mail is not valid'])]); $this->add($email); //Phone // $phone = new Text('phone', [ // 'placeholder' => 'Phone', // 'required' => 'true' // ]); /*$phone->addValidators([ new PresenceOf([ 'message' => 'Phone numer is required.' ]), new Phone(array( 'message' => 'Phone number is invalid and it needs to be in format 0722000777', )) ]);*/ //$this->add($phone); //@TODO : remove this when they fix radio button bug in Phalcon /*if (!empty($entity) && $entity->getGender() == User::GENDER_MALE || $this->request->getPost('gender') == User::GENDER_MALE) { $this->add(new Radio('genderMale', ['value' => User::GENDER_MALE,'checked' => 'checked', 'name' => 'gender', 'label' => 'Male'])); } else { $this->add(new Radio('genderMale', ['value' => User::GENDER_MALE, 'name' => 'gender', 'label' => 'Male'])); } if (!empty($entity) && $entity->getGender() == User::GENDER_FEMALE || $this->request->getPost('gender') == User::GENDER_FEMALE) { $this->add(new Radio('genderFemale', ['value' => User::GENDER_FEMALE,'checked' => 'checked', 'name' => 'gender', 'label' => 'Female'])); } else { $this->add(new Radio('genderFemale', ['value' => User::GENDER_FEMALE, 'name' => 'gender'])); }*/ // CSRF // $csrf = new Hidden('csrf'); // $csrf->addValidator( // new Identical(array( // 'value' => $this->security->getSessionToken(), // 'message' => t('CSRF validation failed') // )) // ); // $this->add($csrf); //Submit $this->add(new Submit('signup', ['value' => 'Sign in', 'class' => 'submit-button-signup'])); }
public function initialize($entity = null) { // In edit page the id is hidden if (!is_null($entity)) { $this->add(new Hidden('id')); } //title $title = new Text('title', array('placeholder' => t('Title'), 'class' => 'form-control', 'required' => true)); $title->addValidator(new PresenceOf(array('message' => t('The title is required.')))); $this->add($title); // In edit page the id is hidden if (!empty($entity)) { $checked = null; $this->add(new Radio('locked', ['value' => 'Y', 'checked' => $checked, 'name' => 'locked'])); if ($entity->getLocked() == 'N') { $checked = 'checked'; } $this->add(new Radio('unLocked', ['value' => 'N', 'checked' => $checked, 'name' => 'locked'])); } else { $this->add(new Radio('locked', ['value' => 'Y', 'name' => 'locked'])); $this->add(new Radio('unLocked', ['value' => 'N', 'name' => 'locked'])); } //content $content = new Textarea('content', array('placeholder' => t('Please be sure to answer the question. Provide details and share your research!'), 'class' => 'wmd-input', 'id' => 'wmd-input', 'required' => true, 'rows' => 10)); $content->addValidator(new PresenceOf(array('message' => t('content is required.')))); $this->add($content); $this->add(new Hidden('object')); // To compare the post is question or tip $this->add(new Hidden('type')); // CSRF $csrf = new Hidden('csrf'); $this->add($csrf); $this->add(new Submit('save', array('class' => 'btn btn-sm btn-success', 'value' => t('Submit Post')))); }
public function initialize($entity = null) { // In edit page the id is hidden if (!is_null($entity)) { $this->add(new Hidden('id')); } //title $title = new Text('title', array('placeholder' => t('title'), 'class' => 'form-control', 'required' => true)); $title->addValidator(new PresenceOf(array('message' => t('The title is required.')))); $this->add($title); $tags = new Hidden('tags', array('required' => true)); $tags->addValidator(new PresenceOf(array('message' => t('The title is required.')))); $this->add($tags); //content $content = new Textarea('content', array('placeholder' => t('Please be sure to answer the question. Provide details and share your research!'), 'class' => 'wmd-input', 'id' => 'wmd-input', 'required' => true, 'rows' => 10)); $content->addValidator(new PresenceOf(array('message' => t('content is required.')))); $this->add($content); $this->add(new Hidden('object')); // To compare the post is question or tip $this->add(new Hidden('type')); // CSRF $csrf = new Hidden('csrf'); $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed'))); $this->add($csrf); $this->add(new Submit('save', array('class' => 'btn btn-sm btn-success', 'value' => t('Submit Post')))); }
public function initialize() { // Username $username = new Text('username', ['placeholder' => 'Username']); $username->addValidator(new PresenceOf(['message' => 'The username is required'])); $this->add($username); // Password $password = new Password('password', ['placeholder' => 'Password']); $password->addValidator(new PresenceOf(['message' => 'The password is required'])); $this->add($password); // Remember $remember = new Check('remember', ['value' => 'yes']); $remember->setLabel('Remember me'); $this->add($remember); /*// CSRF $csrf = new Hidden('csrf'); $csrf->addValidator(new Identical(array( 'value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed' ))); $this->add($csrf); $this->add(new Submit('go', array( 'class' => 'btn btn-success' )));*/ }
public function initialize() { $this->add(new Text("firstname")); $lastname = new Text("lastname"); $this->add($lastname); $username = new Text("username"); $username->setFilters(array('striptags', 'string')); $username->addValidators(array(new PresenceOf())); $this->add($username); // password $password = new Password('password'); $password->addValidator(new PresenceOf(array('message' => 'password'))); $this->add($password); $this->add(new Text("avatar")); $email = new Text("email"); $email->addValidators(array(new PresenceOf(), new Email())); $this->add($email); $this->add(new Select('gender', array('0' => 'Nữ', '1' => 'Nam'))); $this->add(new Text("birthday")); $this->add(new Text("address")); $this->add(new Text("phone")); $this->add(new Select('gender', array('0' => 'Không', '1' => 'Có'))); $this->add(new Select('status', array('0' => 'Không', '1' => 'Có'), array('class' => 'medium'))); $department_id = new Select('department_id', \Modules\Backend\Models\Member_department::find(), array('using' => array('id', 'name'), 'class' => 'medium')); $this->add($department_id); $group_id = new Select('group_id', \Modules\Backend\Models\Permission_group::find(), array('using' => array('id', 'name'), 'class' => 'medium')); $this->add($group_id); }
/** * Initialize the products form */ public function initialize($entity = null, $options = array()) { /*======================= usuario_id ================================*/ if (!isset($options['edit'])) { $element = new Text("usuario_id"); $this->add($element->setLabel("Id")); } else { $this->add(new Hidden("usuario_id")); } /*======================= usuario_nick ================================*/ $name = new Text("name"); $name->setLabel("Name"); $name->setFilters(array('striptags', 'string')); $name->addValidators(array(new PresenceOf(array('message' => 'Name is required')))); $this->add($name); /*======================= usuario_nombreCompleto ================================*/ $type = new Select('product_types_id', ProductTypes::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...', 'emptyValue' => '')); $type->setLabel('Type'); $this->add($type); /*======================= usuario_contrasenia ================================*/ $price = new Text("price"); $price->setLabel("Price"); $price->setFilters(array('float')); $price->addValidators(array(new PresenceOf(array('message' => 'Price is required')), new Numericality(array('message' => 'Price is required')))); $this->add($price); /*======================= usuario_sector ================================*/ /*======================= usuario_email ================================*/ /*======================= usuario_activo ================================*/ /*======================= usuario_fechaCreacion ================================*/ /*======================= usuario_imagen ================================*/ }
public function initialize() { $type = new Select('type', Publication::$types, array()); $type->setLabel('Тип пубикации'); $this->add($type); $title = new Text('title', array('required' => true)); $title->setLabel('Название'); $this->add($title); $slug = new Text('slug'); $slug->setLabel('Транслитерация'); $this->add($slug); $date = new Text('date'); $date->setLabel('Дата публикации'); $this->add($date); $text = new TextArea('text'); $text->setLabel('Текст'); $this->add($text); $meta_title = new Text('meta_title', array('required' => true)); $meta_title->setLabel('meta-title'); $this->add($meta_title); $meta_description = new TextArea('meta_description'); $meta_description->setLabel('meta-description'); $this->add($meta_description); $meta_keywords = new TextArea('meta_keywords'); $meta_keywords->setLabel('meta-keywords'); $this->add($meta_keywords); $preview_inner = new Check('preview_inner'); $preview_inner->setLabel('Превью внутри публикации'); $preview_inner->setDefault(1); $this->add($preview_inner); $image = new File('image'); $image->setLabel('Загрузить превью'); $this->add($image); }
public function initialize() { //añadimos el campo username $username = new Text('username'); //añadimos la validación para un campo de tipo username y como campo requerido $username->addValidators(array(new PresenceOf(array('message' => 'El username es requerido')))); //label para el username $username->setLabel('Username'); //hacemos que se pueda llamar a nuestro campo username $this->add($username); //añadimos el campo password $password = new Password('password'); //añadimos la validación como campo requerido al password $password->addValidator(new PresenceOf(array('message' => 'El password es requerido'))); //label para el Password $password->setLabel('Password'); //hacemos que se pueda llamar a nuestro campo password $this->add($password); //prevención de ataques csrf, genera un campo de este tipo //<input value="dcf7192995748a80780b9cc99a530b58" name="csrf" id="csrf" type="hidden" /> $randomsting = new Hidden('randomsting'); //añadimos la validación para prevenir csrf /*$csrf->addValidator( new Identical(array( 'value' => $this->security->getSessionToken(), 'message' => '¡La validación CSRF ha fallado! '.$this->security->getSessionToken() )) ); */ //hacemos que se pueda llamar a nuestro campo csrf $this->add($randomsting); //añadimos un botón de tipo submit $submit = $this->add(new Submit('Login', array('class' => 'button primary'))); }
public function initialize($entity = null, $options = null) { $city = new Select('cityid', City::find(), array('using' => array('id', 'city'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione una Ciudad'))); $city->setLabel('Ciudad'); $this->add($city); $township = new Text('township'); $township->setLabel('Sector'); $this->add($township); $countryvalue = ""; $statevalue = ""; $city = ""; if (isset($entity)) { if ($entity->getCity()) { $countryvalue = $entity->getCity()->getCountry()->getCountry(); $statevalue = $entity->getCity()->getState()->getState(); } } $country = new Text('country'); $country->setLabel('País'); $country->setDefault($countryvalue); $this->add($country); $state = new Text('state'); $state->setDefault($statevalue); $state->setLabel('Estado'); $this->add($state); }
public function initialize() { $name = new Text("name"); $name->setLabel('Name'); $name->addValidator(new PresenceOf(['message' => '<strong>Name</strong> is required.'])); $this->add($name); $adapter = new Select("adapter", ['Mysql' => 'MySQL']); $adapter->setLabel('DB type'); $this->add($adapter); $host = new Text("host"); $host->setLabel('DB host'); $host->addValidator(new PresenceOf(['message' => '<strong>DB host</strong> is required.'])); $this->add($host); $user = new Text("username"); $user->setLabel('DB user'); $user->addValidator(new PresenceOf(array('message' => '<strong>DB user</strong> is required.'))); $this->add($user); $pass = new Text("password"); $pass->setLabel('DB pass'); $this->add($pass); $dbname = new Text("dbname"); $dbname->setLabel('DB name'); $dbname->addValidator(new PresenceOf(array('message' => '<strong>DB name</strong> is required.'))); $this->add($dbname); //$this->setCsrf(); }
public function initialize() { $login = new Text('login'); $login->addValidator(new PresenceOf(array('message' => $this->helper->translate('Login is required')))); $password = new Password('password'); $password->addValidator(new PresenceOf(array('message' => $this->helper->translate('Password is required')))); }
public function initialize($model, $menu_id = null) { $system = new \Modules\Library\System(); // Main tab $name = new Text("name"); $name->addValidator(new PresenceOf(array('message' => 'name'))); $this->add($name); $this->add(new Text("code")); $link = new Text("link"); $link->addValidator(new PresenceOf(array('message' => 'link'))); $this->add($link); // parents menu item $result = \Modules\Backend\Models\Menu_item::findByMenu_id($menu_id); $result = $system->convert_object_to_array($result); $data = null; $system->recursive($result, 0, 1, $data); $data = $system->getListTreeCategory($data, 'name'); $parents = new Select('parents', $data); $this->add($parents); $tbl_menu = \Modules\Backend\Models\Menu::find(); $menu = new Select('menu_id', $tbl_menu, array('using' => array('id', 'name'))); $menu->setDefault($menu_id); $this->add($menu); $status = new Select('status', array('0' => 'Không', '1' => 'Có')); $status->setDefault('1'); $this->add($status); $target = new Select('target', array('0' => 'Bình thường', '1' => 'Mở tab mới')); $this->add($target); $this->add(new Text("image")); $this->add(new Text("position")); }
public function initialize($entity = null, $options = null) { // In edition the id is hidden if (isset($options['edit']) && $options['edit']) { $id = new Hidden('id'); } else { $id = new Text('id'); } $this->add($id); $brand = new Text('brand', array('placeholder' => 'Brand')); $brand->addValidators(array(new PresenceOf(array('message' => 'The brand is required')))); $this->add($brand); $model = new Text('model', array('placeholder' => 'Model')); $model->addValidators(array(new PresenceOf(array('message' => 'The model is required')))); $this->add($model); $cc = new Text('cc', array('placeholder' => 'CC')); $this->add($cc); $color = new Text('color', array('placeholder' => 'Color')); $color->addValidators(array(new StringLength(array('max' => 50, 'messageMaximum' => 'Color is too long. Miximum 50 characters')))); $this->add($color); $weight = new Text('weight', array('placeholder' => 'Weight')); $this->add($weight); $price = new Text('price', array('placeholder' => 'Price')); $price->addValidators(array(new PresenceOf(array('message' => 'The price is required')))); $this->add($price); $image = new File('image', array('placeholder' => 'Image')); $this->add($image); // CSRF $csrf = new Hidden('csrf'); $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed'))); $this->add($csrf); // Add button $this->add(new Submit('Add', array('class' => 'btn btn-success'))); }
public function initialize() { $email = new Text('email', array('placeholder' => 'Email')); $email->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required')), new Email(array('message' => 'The e-mail is not valid')))); $this->add($email); $this->add(new Submit('Send', array('class' => 'btn btn-primary'))); }
/** * attach the username field with validators */ protected function attachUsername() { $username = new Text('username'); $username->addValidator(new PresenceOf(['message' => 'The username is required'])); $this->username = $username; $this->formElements['username'] = $username; }
public function testArrayedValues() { $model = new FakeModel(); $values = array('integer' => '3 14', 'test1' => array(2 => 'foo', 3 => 'bar'), 'test2' => array('en' => 'baz', 'nl' => 123.4), 'test3' => array(array(0 => 'doubleArrayed', 1 => array(0 => 'tripleArrayed'))), 'not_in_form' => array('some_value')); $form = new Form(); $text = new Text('integer'); $text->addFilter('int'); $form->add($text); $form->add(new Text('test1[]')); $form->add(new Text('test1[]')); $text = new Text('test2[en]'); $text->addValidator(new PresenceOf()); $form->add($text); $text = new Text('test2[nl]'); $text->addFilter('int'); $form->add($text); $form->add(new Text('test3[0][]')); $form->add(new Text('test3[0][1][]')); $form->bind($values, $model); $this->assertTrue($form->isValid()); $this->assertTrue(!isset($model->not_in_form)); $this->assertEquals('3 14', $form->getValue('integer')); $this->assertEquals(314, $model->integer); $this->assertEquals($model->test1[0], $form->getValue('test1[2]')); $this->assertEquals($model->test1[1], $form->getValue('test1[3]')); $this->assertNull($form->getValue('test1[]')); $this->assertNull($form->getValue('test1[1]')); $this->assertEquals($model->test2['en'], $form->getValue('test2[en]')); $this->assertEquals(123.4, $form->getValue('test2[nl]')); $this->assertEquals(1234, $model->test2['nl']); $this->assertNull($form->getValue('test2[en][notexsiting]')); $this->assertEquals($model->test3[0][0], $form->getValue('test3[0][0]')); $this->assertEquals($model->test3[0][1][0], $form->getValue('test3[0][1][0]')); }
/** * Initialize the companies form */ public function initialize($entity = null, $options = array()) { if (!isset($options['edit'])) { $element = new Text("id"); $this->add($element->setLabel("Id")); } else { $this->add(new Hidden("id")); } $name = new Text("name"); $name->setLabel("Name"); $name->setFilters(array('striptags', 'string')); $name->addValidators(array(new PresenceOf(array('message' => 'Name is required')))); $this->add($name); $telephone = new Text("telephone"); $telephone->setLabel("Telephone"); $telephone->setFilters(array('striptags', 'string')); $telephone->addValidators(array(new PresenceOf(array('message' => 'Telephone is required')))); $this->add($telephone); $address = new Text("address"); $address->setLabel("address"); $address->setFilters(array('striptags', 'string')); $address->addValidators(array(new PresenceOf(array('message' => 'Address is required')))); $this->add($address); $city = new Text("city"); $city->setLabel("city"); $city->setFilters(array('striptags', 'string')); $city->addValidators(array(new PresenceOf(array('message' => 'City is required')))); $this->add($city); }
/** * @param object $entity * @param array $options */ public function initialize($entity = null, $options = null) { //Name $name = new Text('name', array('placeholder' => 'Full name')); $name->setLabel('Name'); $name->addValidators(array(new PresenceOf(array('message' => 'The name is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Name is too short. Minimum 8 characters')))); $this->add($name); //Username $username = new Text('login', array('placeholder' => 'Username')); $username->addValidators(array(new PresenceOf(array('message' => 'The username is required', 'cancelOnFail' => true)), new StringLength(array('min' => 5, 'messageMinimum' => 'Username is too short. Minimum 5 characters')))); $this->add($username); //Password $password = new Password('password', array('placeholder' => 'Password')); $password->addValidators(array(new PresenceOf(array('message' => 'The password is required', 'cancelOnFail' => true)), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')), new Confirmation(array('message' => 'Password doesn\'t match confirmation', 'with' => 'confirmPassword')))); $this->add($password); //Confirm Password $confirmPassword = new Password('confirmPassword', array('placeholder' => 'Confirm Password', 'cancelOnFail' => true)); $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required')))); $this->add($confirmPassword); //Remember $terms = new Check('terms', array('value' => 'yes')); $terms->setLabel('Accept terms and conditions'); $terms->addValidator(new Identical(array('value' => 'yes', 'message' => 'Terms and conditions must be accepted'))); $this->add($terms); //Sign Up $this->add(new Submit('Sign Up', array('class' => 'btn btn-success'))); }
public function initialize($entity = null, $options = null) { parent::initialize(); // In edition the id is hidden if (isset($options['edit']) && $options['edit']) { $id = new Hidden('id'); $id->addValidators(array(new PresenceOf(array('message' => 'ID missing')))); $this->add($id); } else { // Password $password = new Password('password', array('placeholder' => 'Password')); $password->setLabel('Password'); $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')))); $this->add($password); } $name = new Text('name', array('placeholder' => 'Name')); $name->setLabel('Name'); $name->addValidators(array(new PresenceOf(array('message' => 'The name is required')))); $this->add($name); $email = new Text('email', array('placeholder' => 'Email')); $email->setLabel('Email'); $email->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required')), new Email(array('message' => 'The e-mail is not valid')))); $this->add($email); $this->add(new Select('validated', array('1' => 'Yes', '0' => 'No'))); $this->add(new Select('active', array('1' => 'Yes', '0' => 'No'))); $this->add(new Submit('Save')); }
/** * Initialize the products form */ public function initialize($entity = null, $options = array()) { $titulo = new Text("titulo"); $titulo->setAttribute('class', 'form-control '); $this->add($titulo); $email = new Text("email"); $email->setAttribute('class', 'form-control '); $this->add($email); $telefone = new Text("telefone"); $telefone->setAttribute('class', 'form-control '); $this->add($telefone); $endereco = new Text("endereco"); $endereco->setAttribute('class', 'form-control '); $this->add($endereco); $cep = new Text("cep"); $cep->setLabel('CEP'); $cep->setAttribute('data-mask', '99999-999'); $cep->setAttribute('class', 'form-control '); $this->add($cep); $descricao = new TextArea("descricao"); $descricao->setLabel('Descrição da loja'); $descricao->setAttribute('class', 'form-control '); $descricao->setAttribute('rows', '5'); $this->add($descricao); $produtos_por_pagina = new Numeric("produtos_por_pagina"); $produtos_por_pagina->setLabel('Produtos por pagina'); $produtos_por_pagina->setAttribute('class', 'form-control'); $this->add($produtos_por_pagina); $produtos_destaque_quantidade = new Numeric("produtos_destaque"); $produtos_destaque_quantidade->setLabel('Produtos destaques'); $produtos_destaque_quantidade->setAttribute('class', 'form-control'); $this->add($produtos_destaque_quantidade); }
public function initialize($entity = null, $options = array()) { /*Si el form es de creacion, los campos seran required. Viceversa.*/ $required['clave'] = ""; $required['valor'] = ""; if (isset($options['required'])) { $required['clave'] = "required"; $required['valor'] = "true"; } /*=========================== ID =====================================*/ if (!isset($options['edit'])) { $element = new Text("yacimiento_id"); $this->add($element->setLabel("ID")); } else { $this->add(new Hidden("yacimiento_id")); } /*=========================== Destino =====================================*/ $elemento = new Text('yacimiento_destino', array('maxlength' => 60, 'class' => 'form-control', $required['clave'] => $required['valor'])); $elemento->setLabel('Destino'); $elemento->setFilters(array('striptags', 'string')); $elemento->addValidators(array(new PresenceOf(array('message' => 'El destino es requerido')))); $this->add($elemento); /*=========================== Operadoras =====================================*/ $elemento = new Select('operadora_yacimientoId', Operadora::find(array('operadora_habilitado=1 AND operadora_yacimientoId=NULL', 'order' => 'operadora_nombre')), array('using' => array('operadora_id', 'operadora_nombre'), 'useEmpty' => true, 'emptyText' => 'SELECCIONE LAS OPERADORAS', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', 'multiple' => 'multiple', $required['clave'] => $required['valor'])); $elemento->setLabel('Operadoras'); $this->add($elemento); /*=========================== EquipoPozo =====================================*/ $elemento = new Select('equipoPozo_yacimientoId', Equipopozo::find(array('equipoPozo_habilitado=1 AND equipoPozo_yacimientoId=NULL', 'order' => 'equipoPozo_nombre')), array('using' => array('equipoPozo_id', 'equipoPozo_nombre'), 'useEmpty' => true, 'emptyText' => 'SELECCIONE LOS EQUIPOS/POZOS', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', 'multiple' => 'multiple', $required['clave'] => $required['valor'])); $elemento->setLabel('Equipos/Pozos'); $this->add($elemento); }
public function initialize($entity = null, $options = null) { // Name $name = new Text('name'); $name->setLabel('Your Full Name'); $name->setFilters(array('striptags', 'string')); $name->addValidators(array(new PresenceOf(array('message' => 'Name is required')))); $this->add($name); // Name $name = new Text('username'); $name->setLabel('Username'); $name->setFilters(array('alpha')); $name->addValidators(array(new PresenceOf(array('message' => 'Please enter your desired user name')))); $this->add($name); // Email $email = new Text('email'); $email->setLabel('E-Mail'); $email->setFilters('email'); $email->addValidators(array(new PresenceOf(array('message' => 'E-mail is required')), new Email(array('message' => 'E-mail is not valid')))); $this->add($email); // Password $password = new Password('password'); $password->setLabel('Password'); $password->addValidators(array(new PresenceOf(array('message' => 'Password is required')))); $this->add($password); // Confirm Password $repeatPassword = new Password('repeatPassword'); $repeatPassword->setLabel('Repeat Password'); $repeatPassword->addValidators(array(new PresenceOf(array('message' => 'Confirmation password is required')))); $this->add($repeatPassword); }
public function initialize() { $type = new Select('type_id', Type::cachedListArray(['key' => 'id'])); $type->setLabel('Type of Publication'); $this->add($type); $title = new Text('title', ['required' => true]); $title->addValidator(new PresenceOf(['message' => 'Title can not be empty'])); $title->setLabel('Title'); $this->add($title); $slug = new Text('slug'); $slug->setLabel('Slug'); $this->add($slug); $date = new Text('date'); $date->setLabel('Publication Date'); $this->add($date); $text = new TextArea('text'); $text->setLabel('Text'); $this->add($text); $meta_title = new Text('meta_title', ['required' => true]); $meta_title->setLabel('meta-title'); $this->add($meta_title); $meta_description = new TextArea('meta_description', ['style' => 'height:4em; min-height: inherit']); $meta_description->setLabel('meta-description'); $this->add($meta_description); $meta_keywords = new TextArea('meta_keywords', ['style' => 'height:4em; min-height: inherit']); $meta_keywords->setLabel('meta-keywords'); $this->add($meta_keywords); $preview_inner = new Check('preview_inner'); $preview_inner->setLabel('Show preview image inside publication'); $this->add($preview_inner); $image = new Image('preview_src'); $image->setLabel('Thumbnail Image'); $this->add($image); }
public function initialize($entity = null, $options = null) { $name = new Text('name'); $name->setLabel('Name'); $name->addValidators(array(new PresenceOf(array('message' => 'The name is required')))); $this->add($name); //Email $email = new Text('email'); $email->setLabel('E-Mail'); $email->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required')), new Email(array('message' => 'The e-mail is not valid')))); $this->add($email); //Password $password = new Password('password'); $password->setLabel('Password'); $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')), new Confirmation(array('message' => 'Password does not match confirmation', 'with' => 'confirmPassword')))); $this->add($password); //Confirm Password $confirmPassword = new Password('confirmPassword'); $confirmPassword->setLabel('Confirm Password'); $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required')))); $this->add($confirmPassword); //Remember $terms = new Check('terms', array('value' => 'yes')); $terms->setLabel('Accept terms and conditions'); $terms->addValidator(new Identical(array('value' => 'yes', 'message' => 'Terms and conditions must be accepted'))); $this->add($terms); //CSRF $csrf = new Hidden('csrf'); $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed'))); $this->add($csrf); //Sign Up $this->add(new Submit('Register', array('class' => 'btn btn-success'))); }
public function initialize($entity = null) { // In edit page the id is hidden if (!is_null($entity)) { $this->add(new Hidden('id')); } //title $title = new Text('title', array('placeholder' => t('title'), 'class' => 'form-control', 'required' => true)); $title->addValidator(new PresenceOf(array('message' => t('The title is required.')))); $this->add($title); //title $link = new Text('link', array('class' => 'form-control', 'required' => true)); $link->addValidator(new PresenceOf(array('message' => t('The link is required.')))); $this->add($link); //content $content = new Textarea('content', array('placeholder' => t('Adding information for link your submit!'), 'class' => 'wmd-input', 'id' => 'wmd-input', 'required' => true, 'rows' => 10)); $content->addValidator(new PresenceOf(array('message' => t('content is required.')))); $this->add($content); $this->add(new Hidden('object')); // To compare the post is question or tip $this->add(new Hidden('type')); // CSRF $csrf = new Hidden('csrf'); $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed'))); $this->add($csrf); $this->add(new Submit('save', array('class' => 'btn btn-sm btn-success', 'value' => t('Submit Link')))); }
public function initialize($entity = null, $options = null) { // Name $name = new Text('name'); $name->setLabel('Полное имя'); $name->setFilters(array('striptags', 'string')); $name->addValidators(array(new PresenceOf(array('message' => 'Имя вводить обязательно')))); $this->add($name); // Name $name = new Text('username'); $name->setLabel('Имя пользователя'); $name->setFilters(array('alpha')); $name->addValidators(array(new PresenceOf(array('message' => 'Это обязательное поле')))); $this->add($name); // Email $email = new Text('email'); $email->setLabel('E-Mail'); $email->setFilters('email'); $email->addValidators(array(new PresenceOf(array('message' => 'Без email вы не зарегестрируетесь нигде')), new Email(array('message' => 'Это не настоящий email')))); $this->add($email); // Password $password = new Password('password'); $password->setLabel('Пароль'); $password->addValidators(array(new PresenceOf(array('message' => 'Придумайте пароль')))); $this->add($password); // Confirm Password $repeatPassword = new Password('repeatPassword'); $repeatPassword->setLabel('Повторите пароль'); $repeatPassword->addValidators(array(new PresenceOf(array('message' => 'Подтвердите свой пароль')))); $this->add($repeatPassword); }
public function initialize($entity = null, $options = null) { //name $name = new Text('name'); $name->setLabel('Представьтесь или напишите название Вашего приюта:'); $name->addValidators(array(new PresenceOf(array('message' => 'Обязательное поле')))); $this->add($name); //email $email = new Text('email'); $email->setLabel('Введите Ваш E-mail:'); $email->addValidators(array(new PresenceOf(array('message' => 'Обязательное поле')), new Email(array('message' => 'Введите правильный E-mail')))); $this->add($email); //Phone $number = new Text('number'); $number->setLabel('Напишите телефон, по которому с Вами можно связаться:'); $number->addValidators(array(new PresenceOf(array('message' => 'Обязательное поле')))); $this->add($number); //password $password = new Password('password'); $password->setLabel('Придумайте пароль:'); $password->addValidators(array(new PresenceOf(array('message' => 'Обязательно поле')), new StringLength(array('min' => 8, 'messageMinimum' => 'Слишком короткий, минимум - 8 символов')), new Confirmation(array('message' => 'Пароль не подтвержден', 'with' => 'confirmPassword')))); $this->add($password); // Confirm Password $confirmPassword = new Password('confirmPassword'); $confirmPassword->setLabel('Подтвердите пароль:'); $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required')))); $this->add($confirmPassword); // CSRF $csrf = new Hidden('csrf'); $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed'))); $this->add($csrf); // Sign Up $this->add(new Submit('Sign Up', array('class' => 'btn btn-success'))); }
public function initialize($entity = null, $options = null) { //姓名 $name = new Text('name'); $name->setLabel('姓 名'); $name->setFilters(array('striptags', 'string')); $name->addValidators(array(new PresenceOf(array('message' => '请输入用户的姓名')))); $this->add($name); //用户名 $name = new Text('username'); $name->setLabel('用户名'); $name->setFilters(array('alpha')); $name->addValidators(array(new PresenceOf(array('message' => '请输入用户名')))); $this->add($name); //邮箱 $email = new Text('email'); $email->setLabel('邮 箱'); $email->setFilters('email'); $email->addValidators(array(new PresenceOf(array('message' => '请输入邮箱')), new Email(array('message' => '不是有效的邮箱')))); $this->add($email); //密码 $password = new Password('password'); $password->setLabel('密 码'); $password->addValidators(array(new PresenceOf(array('message' => '请输入密码')))); $this->add($password); //确认密码 $repeatPassword = new Password('repeatPassword'); $repeatPassword->setLabel('二次密码'); $repeatPassword->addValidators(array(new PresenceOf(array('message' => '请再次输入密码')))); $this->add($repeatPassword); }
/** * Init user form * * @param \ZCMS\Core\Models\Users $data */ public function initialize($data = null) { //Add first name $firstName = new Text('first_name', ['maxlength' => '32']); $firstName->addValidator(new PresenceOf()); $this->add($firstName); //Add last name $lastName = new Text('last_name', ['maxlength' => '32']); $lastName->addValidator(new PresenceOf()); $this->add($lastName); //Add email if ($data = null) { $email = new Email('email', ['maxlength' => '128', 'readonly' => 'readonly']); } else { $email = new Email('email', ['maxlength' => '128']); } $this->add($email); //Add active $is_active = new Select('is_active', ['1' => __('gb_yes'), '0' => __('gb_no')]); $this->add($is_active); //Add password confirmation $password_confirmation = new Password('password_confirmation', ['maxlength' => '32']); $password_confirmation->addValidator(new StringLength(['min' => 6])); $this->add($password_confirmation); //Add password $password = new Password('password', ['maxlength' => '32']); $password->addValidator(new StringLength(['min' => 6])); $password->addValidator(new Confirmation(['message' => 'm_system_user_message_password_does_not_match_confirmation', 'with' => 'password_confirmation'])); $this->add($password); //Add role $dbRoles = UserRoles::find(['conditions' => 'is_super_admin = 0', 'order' => 'is_default DESC']); $role = new Select('role_id', $dbRoles, ['using' => ['role_id', 'name']]); $role->addValidator(new InclusionIn(['message' => 'm_system_user_message_please_choose_role', 'domain' => array_column($dbRoles->toArray(), 'role_id')])); $this->add($role); }