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);
 }
Esempio n. 2
0
 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);
     $username = new Text('username', array('placeholder' => 'Username'));
     $username->addValidators(array(new PresenceOf(array('message' => 'Username is required'))));
     $this->add($username);
     $first_name = new Text('first_name', array('placeholder' => 'First name'));
     $first_name->addValidators(array(new PresenceOf(array('message' => 'First name is required'))));
     $this->add($first_name);
     $last_name = new Text('last_name', array('placeholder' => 'Last name'));
     $last_name->addValidators(array(new PresenceOf(array('message' => 'Last name is required'))));
     $this->add($last_name);
     $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 Select('profilesId', Profiles::find(array(array('active' => 'Y'))), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...', 'emptyValue' => '')));
     $this->add(new Select('banned', array('Y' => 'Yes', 'N' => 'No')));
     $this->add(new Select('suspended', array('Y' => 'Yes', 'N' => 'No')));
     $this->add(new Select('active', array('Y' => 'Yes', 'N' => 'No')));
 }
Esempio n. 3
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);
 }
Esempio n. 4
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);
 }
Esempio n. 6
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')));
 }
Esempio n. 7
0
 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()
 {
     $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')));
 }
Esempio n. 9
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')));
 }
Esempio n. 10
0
 public function initialize()
 {
     $email = new Text('email', array('placeholder' => 'Ваша почта'));
     $email->addValidators(array(new PresenceOf(array('message' => 'Поле почты обязательно для заполнения')), new Email(array('message' => 'Не верно написан адерес почты'))));
     $this->add($email);
     $this->add(new Submit('Отправить', array('class' => 'btn btn-primary')));
 }
Esempio n. 11
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);
 }
 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')));
 }
Esempio n. 13
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'));
 }
Esempio n. 14
0
 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')));
 }
Esempio n. 15
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);
 }
Esempio n. 16
0
 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()
 {
     $mobile = new Text('mobile');
     $mobile->setLabel('手机号码');
     $mobile->addValidators([new Regex(['pattern' => '/1[34578]{1}\\d{9}$/', 'message' => '手机号码格式错误', 'allowEmpty' => true])]);
     $this->add($mobile);
 }
Esempio n. 18
0
 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')));
 }
Esempio n. 19
0
 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);
 }
Esempio n. 20
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')));
 }
Esempio n. 21
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 ================================*/
 }
Esempio n. 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);
 }
 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);
 }
Esempio n. 24
0
 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);
 }
Esempio n. 25
0
 public function initialize()
 {
     $name = new Text('name', array('placeholder' => 'Name', 'class' => 'form-control'));
     $name->addValidators(array(new PresenceOf(array('message' => 'The name is required'))));
     $this->add($name);
     $password = new Password('password', array('placeholder' => 'Password', 'class' => 'form-control'));
     $password->addValidator(new PresenceOf(array('message' => 'The password is required')));
     $this->add($password);
     $this->add(new Submit('log in', array('class' => 'btn btn-success')));
 }
Esempio n. 26
0
 /**
  * Form configuration
  */
 public function initialize()
 {
     $t = $this->getDI()->get('translate');
     // Email
     $email = new Text('email', ['placeholder' => $t->gettext('Email')]);
     $email->setLabel($t->gettext('Email'));
     $email->addValidators([new PresenceOf(['message' => $t->gettext('Email is required')]), new Email(['message' => $t->gettext('Email is not valid')])]);
     $this->add($email);
     $this->add(new Submit($t->gettext('send'), ['class' => 'btn btn-primary']));
 }
Esempio n. 27
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);
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => 'CSRF validation failed')));
     $this->add($csrf);
 }
Esempio n. 28
0
 public function initialize($entity = null, $options = null)
 {
     $name = new Text('identify');
     $name->addValidators(array(new PresenceOf(array('message' => 'Please input username or email'))));
     $this->add($name);
     // Password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 6, 'max' => 26, 'messageMinimum' => 'Password is too short. Minimum 6 characters', 'messageMaximum' => 'Password is too long. Maximum 26 characters'))));
     $this->add($password);
 }
Esempio n. 29
0
 public function initialize($entity = null, $options = null)
 {
     $hashtag_name = new Text('hashtag_name', array('placeholder' => 'Name'));
     $hashtag_name->addValidators(array(new PresenceOf(array('message' => 'Name is required'))));
     $this->add($hashtag_name);
     //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-lg btn-primary btn-block')));
 }
Esempio n. 30
0
 public function initialize($entity = null, $options = array())
 {
     $name = new Text('name', array('placeholder' => 'Name'));
     $name->setLabel('Name');
     $name->addValidators(array(new PresenceOf(array('message' => 'Please enter your name')), new StringLength(array('max' => 50, 'min' => 2, 'messageMaximum' => 'Name must have at most 50 characters', 'messageMinimum' => 'Name must have at least 2 characters'))));
     $this->add($name);
     $description = new TextArea('description', array('placeholder' => 'Description'));
     $description->setLabel('Description');
     $description->addValidators(array(new PresenceOf(array('message' => 'Please enter your description')), new StringLength(array('max' => 1000, 'min' => 5, 'messageMaximum' => 'Description must have at most 1000 characters', 'messageMinimum' => 'Name must have at least 5 characters'))));
     $this->add($description);
 }