Exemple #1
0
 public function __construct($name = null)
 {
     parent::__construct('users');
     $this->setAttribute('class', 'form-small');
     $this->setAttribute('method', 'post');
     $this->setAttribute('novalidate', true);
     $csrf = new Element\Csrf('csrf');
     $csrf_options = array('csrf_options' => array('timeout' => 1000));
     $csrf->setAttribute('id', 'csrf');
     $csrf->setOptions($csrf_options);
     $email = new Element\Email('email');
     $email->setLabel('Email')->setAttribute('id', 'email')->setAttribute('class', 'form-control')->setAttribute('maxlength', '200')->setAttribute('required', true)->setAttribute('placeholder', 'Email address');
     $password = new Element\Password('password');
     $password->setLabel('Password')->setAttribute('id', 'password')->setAttribute('class', 'form-control')->setAttribute('maxlength', '200')->setAttribute('required', true)->setAttribute('placeholder', 'Password');
     //        $rememberme = new Element\Checkbox('rememberme');
     //        $rememberme->setLabel(' Remember me')
     //                ->setAttribute('id', 'rememberme')
     //                ->setAttribute('class', '')
     //                ->setValue('1');
     $submit = new Element\Submit('submit');
     $submit->setValue('Log in')->setAttribute('id', 'submit')->setAttribute('class', 'btn btn-lg btn-primary btn-block');
     $this->add($csrf);
     $this->add($email);
     $this->add($password);
     //        $this->add($rememberme);
     $this->add($submit);
 }
Exemple #2
0
 public function testAllowSettingCsrfOptions()
 {
     $element = new CsrfElement('foo');
     $element->setOptions(array('csrf_options' => array('timeout' => 777, 'salt' => 'MySalt')));
     $validator = $element->getCsrfValidator();
     $this->assertEquals('foo', $validator->getName());
     $this->assertEquals(777, $validator->getTimeOut());
     $this->assertEquals('MySalt', $validator->getSalt());
 }
 public function __construct($name = null)
 {
     parent::__construct('user_roles');
     $this->setAttribute('class', 'form-horizontal');
     $this->setAttribute('method', 'post');
     $id = new Element\Hidden('id');
     $id->setAttribute('class', 'primarykey');
     $csrf = new Element\Csrf('csrf');
     $csrf_options = array('csrf_options' => array('timeout' => 1000));
     $csrf->setOptions($csrf_options);
     $user_id = new Element\Text('user_id');
     $user_id->setLabel('User Id')->setAttribute('class', 'required form-control')->setAttribute('id', 'user_id')->setAttribute('placeholder', 'User Id');
     $role_id = new Element\Text('role_id');
     $role_id->setLabel('Role Id')->setAttribute('class', 'required form-control')->setAttribute('id', 'role_id')->setAttribute('placeholder', 'Role Id');
     $submit = new Element\Submit('submit');
     $submit->setValue('Submit')->setAttribute('class', 'btn btn-success');
     $this->add($id);
     $this->add($csrf);
     $this->add($user_id);
     $this->add($role_id);
 }
Exemple #4
0
 public function __construct($name = null)
 {
     parent::__construct('menus');
     $this->setAttribute('class', 'form-horizontal');
     $this->setAttribute('method', 'post');
     $formValue = $this->formValue();
     $id = new Element\Hidden('id');
     $id->setAttribute('class', 'primarykey');
     $csrf = new Element\Csrf('csrf');
     $csrf_options = array('csrf_options' => array('timeout' => 1000));
     $csrf->setOptions($csrf_options);
     $name = new Element\Text('name');
     $name->setLabel('Name')->setAttribute('class', 'required form-control')->setAttribute('id', 'name')->setAttribute('placeholder', 'Name');
     $icon = new Element\Text('icon');
     $icon->setLabel('Icon')->setAttribute('class', 'form-control')->setAttribute('id', 'icon')->setAttribute('placeholder', 'Fa icon name');
     $type = new Element\Select('type');
     $type->setLabel('Type')->setAttribute('class', 'required form-control')->setValueOptions($formValue['type'])->setDisableInArrayValidator(true)->setAttribute('id', 'type')->setAttribute('placeholder', 'Type');
     $resource_id = new Element\Select('resource_id');
     $resource_id->setLabel('Resource')->setAttribute('class', 'required form-control')->setOptions(array())->setDisableInArrayValidator(true)->setAttribute('id', 'resource_id')->setAttribute('placeholder', 'Resource');
     $url = new Element\Text('url');
     $url->setLabel('Url')->setAttribute('class', 'required form-control')->setAttribute('id', 'url')->setAttribute('placeholder', 'Url');
     $target = new Element\Select('target');
     $target->setLabel('Target')->setAttribute('class', 'required form-control')->setValueOptions($formValue['target'])->setDisableInArrayValidator(true)->setAttribute('id', 'target')->setAttribute('placeholder', 'Target');
     $parent_id = new Element\Select('parent_id');
     $parent_id->setLabel('Parent')->setAttribute('class', 'required form-control')->setOptions(array())->setDisableInArrayValidator(true)->setAttribute('id', 'parent_id')->setAttribute('placeholder', 'Parent Id');
     $status = new Element\Select('status');
     $status->setLabel('Status')->setAttribute('class', 'required form-control')->setValueOptions($formValue['status'])->setDisableInArrayValidator(true)->setAttribute('id', 'status')->setAttribute('placeholder', 'Status');
     $submit = new Element\Submit('submit');
     $submit->setValue('Submit')->setAttribute('class', 'btn btn-primary');
     $this->add($id);
     $this->add($csrf);
     $this->add($name);
     $this->add($icon);
     $this->add($type);
     $this->add($resource_id);
     $this->add($url);
     $this->add($target);
     $this->add($parent_id);
     $this->add($status);
 }
Exemple #5
0
 public function __construct($name = null)
 {
     parent::__construct('users');
     $this->setAttribute('class', 'form-horizontal');
     $this->setAttribute('method', 'post');
     $id = new Element\Hidden('id');
     $id->setAttribute('class', 'primarykey');
     $csrf = new Element\Csrf('csrf');
     $csrf_options = array('csrf_options' => array('timeout' => 1000));
     $csrf->setOptions($csrf_options);
     $username = new Element\Text('username');
     $username->setLabel('Username')->setAttribute('class', 'required form-control')->setAttribute('id', 'username')->setAttribute('placeholder', 'Username');
     $email = new Element\Text('email');
     $email->setLabel('Email')->setAttribute('class', 'required form-control')->setAttribute('id', 'email')->setAttribute('placeholder', 'Email');
     $password = new Element\Text('password');
     $password->setLabel('Password')->setAttribute('class', 'required form-control')->setAttribute('id', 'password')->setAttribute('placeholder', 'Password');
     $salt = new Element\Text('salt');
     $salt->setLabel('Salt')->setAttribute('class', 'required form-control')->setAttribute('id', 'salt')->setAttribute('placeholder', 'Salt');
     $email_check_code = new Element\Text('email_check_code');
     $email_check_code->setLabel('Email Check Code')->setAttribute('class', 'required form-control')->setAttribute('id', 'email_check_code')->setAttribute('placeholder', 'Email Check Code');
     $is_disabled = new Element\Text('is_disabled');
     $is_disabled->setLabel('Is Disabled')->setAttribute('class', 'required form-control')->setAttribute('id', 'is_disabled')->setAttribute('placeholder', 'Is Disabled');
     $created = new Element\Text('created');
     $created->setLabel('Created')->setAttribute('class', 'required form-control')->setAttribute('id', 'created')->setAttribute('placeholder', 'Created');
     $modified = new Element\Text('modified');
     $modified->setLabel('Modified')->setAttribute('class', 'required form-control')->setAttribute('id', 'modified')->setAttribute('placeholder', 'Modified');
     $submit = new Element\Submit('submit');
     $submit->setValue('Submit')->setAttribute('class', 'btn btn-success');
     $this->add($id);
     $this->add($csrf);
     $this->add($username);
     $this->add($email);
     $this->add($password);
     $this->add($salt);
     $this->add($email_check_code);
     $this->add($is_disabled);
     $this->add($created);
     $this->add($modified);
 }