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);
 }
Exemple #2
0
 public function initialize($entity = null, $options = null)
 {
     if (isset($options['edit']) && $options['edit']) {
         $id = new Hidden('id');
     } else {
         $id = new Text('id');
     }
     $username = new Text('username', array('placeholder' => 'Tran Duy Thien'));
     //<input type="text" value="" id="fullName" name="fullName">
     $username->setLabel('Tên Tài Khoản');
     //<label for="fullName">fullName</label>
     $username->addValidators(array(new PresenceOf(array('message' => 'Tài khoản không được rỗng'))));
     $this->add($username);
     //Password
     $password = new Password('password');
     $password->setLabel('Mật Khẩu');
     $password->addValidators(array(new PresenceOf(array('message' => 'Mật khẩu không được rỗng')), new StringLength(array('min' => 8, 'messageMinimum' => 'Mật khẩu phải lớn hơn 8 ký tự')), new Confirmation(array('message' => 'Mật khẩu không khớp', 'with' => 'confirmPassword'))));
     $this->add($password);
     //Confirm Password
     $confirmPassword = new Password('confirmPassword');
     $confirmPassword->setLabel('Nhập lại mật khẩu');
     $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('Đồng ý với Điều khoản dịch vụ và chính sách bảo mật của chúng tôi');
     $terms->addValidator(new Identical(array('value' => 'yes', 'message' => 'Bạn chưa chọn')));
     $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('Sign Up', array('class' => 'btn btn-primary pull-right')));
 }
 function initialize($entity = null, $options = null)
 {
     $date = new Date('date');
     $date->setLabel('Input Date');
     $date->setFilters(array('striptags', 'string'));
     $date->setDefault(date('Y-m-d'));
     $date->addValidators(array(new PresenceOf(array('message' => 'Date is required'))));
     $this->add($date);
     $start_time = new Text('start_hour');
     $start_time->setLabel('Input Start Hour');
     $start_time->setFilters(array('striptags', 'string'));
     $start_time->addValidators(array(new PresenceOf(array('message' => 'Start Time is required'))));
     $this->add($start_time);
     $finish_time = new Text('finish_hour');
     $finish_time->setLabel('Input Finish Hour');
     $finish_time->setFilters(array('striptags', 'string'));
     $finish_time->addValidators(array(new PresenceOf(array('message' => 'Finish Time is required'))));
     $this->add($finish_time);
     $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
     $systemId->setLabel('Select System');
     $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required'))));
     if ($entity) {
         $systemId->setDefault(array($entity->system_id));
     }
     $this->add($systemId);
     $description = new TextArea('description');
     $description->setLabel('Input Description');
     $description->addValidators(array(new PresenceOf(array('message' => 'Description is required'))));
     $this->add($description);
     $hidden = new Hidden('id');
     if ($entity) {
         $hidden->setDefault(array($entity->id));
     }
     $this->add($hidden);
 }
	public function initialize($entity = null, $options = null)
    {		
    	$title = new Text('title');
		$title->setLabel('Название');
		$title->setFilters(array('striptags', 'string'));
		$this->add($title);
	}
Exemple #5
0
 public function initialize()
 {
     $email = new Text('email');
     $email->setLabel('Email');
     $email->addValidators([new PresenceOf(['message' => 'The email is required', 'cancelOnFail' => true]), new Email(['message' => 'Must be a valid email'])]);
     $this->add($email);
     $firstName = new Text('first-name');
     $firstName->setLabel('First Name');
     $firstName->addValidators([new PresenceOf(['message' => 'The first name is required', 'cancelOnFail' => true]), new StringLength(['min' => 3, 'max' => 40, 'messageMinimum' => 'The first name is too short. Minimum 3 characters', 'messageMaximum' => 'The first name is too long. Maximum 40 characters'])]);
     $this->add($firstName);
     $lastName = new Text('last-name');
     $lastName->setLabel('Last Name');
     $lastName->addValidators([new PresenceOf(['message' => 'The last name is required', 'cancelOnFail' => true]), new StringLength(['min' => 3, 'max' => 40, 'messageMinimum' => 'The last name is too short. Minimum 3 characters', 'messageMaximum' => 'The last name is too long. Maximum 40 characters'])]);
     $this->add($lastName);
     $middleName = new Text('middle-name');
     $middleName->setLabel('Middle Name');
     $middleName->addValidators([new StringLength(['max' => 40, 'messageMaximum' => 'The middle name is too long. Maximum 40 characters'])]);
     $this->add($middleName);
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators([new PresenceOf(['message' => 'The password is required', 'cancelOnFail' => true]), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')), new Regex(['pattern' => '/^(?=.*[A-Z])(?=.*[0-9])(?=.*[a-z]).*$/', 'message' => 'The password is not strong enough. It must contain both upper, lowercase characters and at least one digit']), new Confirmation(array('message' => 'The password does not match it\'s confirmation', 'with' => 'password-confirm'))]);
     $this->add($password);
     $confirm = new Password('password-confirm');
     $confirm->setLabel('Confirm password');
     $confirm->addValidators([new PresenceOf(['message' => 'The password confirmation is required'])]);
     $this->add($confirm);
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed')));
     $this->add($csrf);
 }
Exemple #6
0
 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('nickname');
     $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' => 'E-mail является обязательным параметром')), new Email(array('message' => 'E-mail не верный'))));
     $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);
 }
 /**
  * Add all fields to the form and set form specific attributes.
  */
 public function initialize()
 {
     $this->_action = 'general';
     $title = new Text('title');
     $title->setLabel('Title');
     $title->setFilters(array('striptags', 'string'));
     $title->setAttributes(array('class' => 'form-control'));
     $title->setDefault($this->_config->application->title);
     $title->addValidators(array(new PresenceOf(array())));
     $cryptKey = new Text('cryptkey');
     $cryptKey->setLabel('Cryptkey');
     $cryptKey->setFilters(array('striptags', 'string'));
     $cryptKey->setAttributes(array('class' => 'form-control'));
     $cryptKey->setDefault($this->_config->application->phalconCryptKey);
     $cryptKey->addValidators(array(new PresenceOf(array())));
     $bgcolor = new Select('bgcolor', array('blackbg' => 'Black', 'whitebg' => 'White'), array('useEmpty' => false));
     $bgcolor->setLabel('Background color');
     $bgcolor->setDefault($this->_config->application->background);
     $debug = new Check('debug');
     $debug->setLabel('debug');
     $debug->setAttributes(array('checked' => $this->_config->application->debug == '1' ? 'checked' : null));
     $this->add($title);
     $this->add($bgcolor);
     $this->add($cryptKey);
     $this->add($debug);
 }
 public function initialize()
 {
     $mobile = new Text('mobile');
     $mobile->setLabel('手机号码');
     $mobile->addValidators([new Regex(['pattern' => '/1[34578]{1}\\d{9}$/', 'message' => '手机号码格式错误', 'allowEmpty' => true])]);
     $this->add($mobile);
 }
Exemple #9
0
 /**
  * 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 ================================*/
 }
Exemple #10
0
 /**
  * @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()
 {
     //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()
 {
     $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()
 {
     $this->_action = 'devices_add';
     $name = new Text('name');
     $name->setLabel('Devicename');
     $name->setFilters(array('striptags', 'string'));
     $name->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $ip = new Text('ip');
     $ip->setLabel('IP');
     $ip->setFilters(array('striptags', 'string'));
     $ip->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $mac = new Text('mac');
     $mac->setLabel('MAC');
     $mac->setFilters(array('striptags', 'string'));
     $mac->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $webtemp = new Text('webtemp');
     $webtemp->setLabel('Webtemp path');
     $webtemp->setFilters(array('striptags', 'string'));
     $webtemp->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $shutdownMethod = new Select('shutdown_method', array('none' => 'None', 'rpc' => 'RPC'), array('useEmpty' => false));
     $shutdownMethod->setLabel('Shutdown method');
     $showDasboard = new Check('show_on_dashboard');
     $showDasboard->setLabel('Show on dashboard');
     $showDasboard->setAttributes(array('class' => 'form-control'));
     $this->add($name);
     $this->add($ip);
     $this->add($mac);
     $this->add($webtemp);
     $this->add($shutdownMethod);
     $this->add($showDasboard);
 }
 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);
 }
 /**
  * Initialize the products form
  */
 public function initialize($model = null, $options = array())
 {
     $session = $this->di->getShared('session');
     $nome = new Text("nome");
     $nome->setLabel('Nome');
     $nome->setAttribute('class', 'form-control');
     $nome->setAttribute('required', 'required');
     $nome->setAttribute('value', $session->get('nome'));
     $this->add($nome);
     $telefone = new Text("telefone");
     $telefone->setLabel('Telefone');
     $telefone->setAttribute('class', 'form-control');
     $telefone->setAttribute('required', 'required');
     $telefone->setAttribute('data-mask', '(99)9999-9999');
     $this->add($telefone);
     $celular = new Text("celular");
     $celular->setLabel('Celular');
     $celular->setAttribute('class', 'form-control ');
     $celular->setAttribute('required', 'required');
     $celular->setAttribute('data-mask', '(99)9999-9999');
     $this->add($celular);
     $documento = new Text("documento");
     $documento->setLabel('CPF');
     $documento->setAttribute('class', 'form-control ');
     $documento->setAttribute('required', 'required');
     $documento->setAttribute('data-mask', '999.999.999-99');
     $this->add($documento);
 }
 public function initialize()
 {
     //username
     $username = new Text('login');
     $username->setLabel('Login');
     $username->addValidator(new PresenceOf(array("message" => "Login required")));
     $username->setAttributes(array('id' => 'login-username', 'class' => 'form-control', 'placeholder' => 'username'));
     $this->add($username);
     //password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidator(new PresenceOf(array("message" => "Password required")));
     $password->setAttributes(array('id' => 'login-password', 'class' => 'form-control', 'placeholder' => 'password'));
     $password->clear();
     $this->add($password);
     //remember me
     $remember = new Check('remember', array("value" => '1', "id" => "login-remember"));
     $remember->setLabel('Remember me');
     $this->add($remember);
     //CSRF
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical([$this->security->checkToken() => true, 'message' => 'This request was aborted because it appears to be forged']));
     $this->add($csrf);
     //Submit
     $this->add(new Submit('Sign In', array('class' => 'btn btn-success', 'id' => 'btn-login')));
 }
 /**
  * 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);
 }
 /**
  * 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);
 }
Exemple #19
0
 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);
 }
Exemple #20
0
 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'));
 }
 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')));
 }
Exemple #22
0
 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);
 }
Exemple #23
0
 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()
 {
     $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
     $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);
 }
Exemple #26
0
 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);
 }
 public function initialize($entity = null, $options = null)
 {
     // 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);
 }
 public function initialize($config)
 {
     $title = new Text('title');
     $title->setLabel('Title');
     $title->setFilters(array('striptags', 'string'));
     $title->setAttributes(array('class' => 'form-control'));
     $title->setDefault($config->application->title);
     $this->add($title);
 }
Exemple #30
0
 /**
  * @param Phalcon\Mvc\ModelInstance $entity
  * @param array $options
  */
 public function initialize($entity = null, $options = null)
 {
     if (!isset($options['edit']) && !isset($options['create'])) {
         $id = new Text('id');
         $id->setLabel('Id');
         $this->add($id);
     }
     $category = new Select('categoriesId', Categories::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...'));
     $category->setLabel('Category');
     $category->addValidator(new PresenceOf(array('message' => 'Category is mandatory')));
     $category->setUserOption('searcheable', true);
     $category->setUserOption('browseable', true);
     $category->setUserOption('relation', 'category');
     $this->add($category);
     $icon = new Text('icon', array('placeholder' => 'Enter a css-icon class name'));
     $icon->setLabel('Icon');
     $icon->addValidator(new PresenceOf(array('message' => 'Icon is mandatory')));
     $this->add($icon);
     $code = new Text('code', array('maxlength' => 10));
     $code->setLabel('Code');
     $code->setUserOption('searcheable', true);
     $code->setUserOption('browseable', true);
     $code->addValidator(new PresenceOf(array('message' => 'Code is mandatory')));
     $this->add($code);
     $name = new Text('name', array('maxlength' => 64));
     $name->setLabel('Name');
     $name->setUserOption('searcheable', true);
     $name->setUserOption('browseable', true);
     $name->addValidator(new PresenceOf(array('message' => 'Name is mandatory')));
     $this->add($name);
     $description = new TextArea('description');
     $description->setLabel('Description');
     $description->addValidator(new PresenceOf(array('message' => 'Description is mandatory')));
     $this->add($description);
     $price = new Text('price');
     $price->setLabel('Price');
     $price->setUserOption('searcheable', true);
     $price->setUserOption('browseable', true);
     $price->addValidator(new PresenceOf(array('message' => 'Price is mandatory')));
     $price->addValidator(new Numericality(array('message' => 'Price must be a number')));
     $this->add($price);
     $stock = new Text('stock');
     $stock->setLabel('Stock');
     $stock->setUserOption('browseable', true);
     $stock->addValidator(new PresenceOf(array('message' => 'Current stock is mandatory')));
     $stock->addValidator(new Numericality(array('message' => 'Current stock must be a number')));
     $this->add($stock);
     if (isset($options['edit'])) {
         $createdAt = new Date('created', array('readonly' => 'readonly'));
         $createdAt->setLabel('Created At');
         if ($entity->createdAt) {
             $entity->created = date('Y-m-d', $entity->createdAt);
         }
         $this->add($createdAt);
     }
 }