示例#1
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post')->setAttribute('action', '/user/register')->setAttribute('id', 'user-register-form');
     $email = new Email();
     $email->setName('email')->setLabel('Email Address');
     $userName = new Text();
     $userName->setName('userName')->setLabel('Username');
     $password = new Password();
     $password->setName('password')->setLabel('Password');
     $firstName = new Text();
     $firstName->setName('firstName')->setLabel('First Name');
     $lastName = new Text();
     $lastName->setName('lastName')->setLabel('Last Name');
     $csrf = new Csrf();
     $csrf->setName('prev');
     $submit = new Submit();
     $submit->setName('submit')->setValue('Register');
     $this->add($email)->add($userName)->add($password)->add($firstName)->add($lastName)->add($csrf)->add($submit);
     foreach ($this->elements as $element) {
         if (!$element instanceof Submit) {
             $element->setAttribute('class', 'form-control');
         }
     }
 }
示例#2
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '/user/login');
     $this->setAttribute('class', 'form');
     $this->setAttribute('id', 'userLoginForm');
     $this->setAttribute('role', 'form');
     $email = new Email();
     $email->setName('email')->setLabel('Email Address')->setAttribute('required', 'true');
     $password = new Password();
     $password->setName('password')->setLabel('Password')->setAttribute('required', 'true');
     $csrf = new Csrf();
     $csrf->setName('prev');
     $checkbox = new Checkbox();
     $checkbox->setName('remember-me');
     $checkbox->setOptions(['use_hidden_element' => false, 'required' => false]);
     $checkbox->setChecked("checked");
     $submit = new Submit();
     $submit->setName('submit')->setValue('Sign In');
     $this->add($email)->add($password)->add($checkbox)->add($csrf)->add($submit);
     foreach ($this->elements as $element) {
         if ($element instanceof Checkbox) {
             $element->setAttributes(['class' => 'custom-checkbox', 'data-toggle' => 'checkbox']);
         } else {
             if ($element instanceof Submit) {
                 $element->setAttributes(['class' => 'btn-inverse btn-large', 'id' => 'loginSubmit']);
             } else {
                 $element->setAttribute('class', 'form-control');
             }
         }
     }
 }
示例#3
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '/user/dashboard/post/create');
     $this->setAttribute('id', 'user-post-form');
     $title = new Text();
     $title->setName('title')->setLabel('Title')->setAttribute('required', 'true');
     $body = new Textarea();
     $body->setName('body')->setAttributes(array('placeholder' => 'Your post content...', 'rows' => 8, 'resizable' => 'false', 'required' => 'true'));
     $csrf = new Csrf();
     $csrf->setName('prev');
     $submit = new Submit();
     $submit->setName('submit')->setValue('Create')->setAttribute('class', 'btn btn-info');
     $this->add($title)->add($body)->add($csrf)->add($submit);
     foreach ($this->elements as $element) {
         if (!$element instanceof Submit) {
             $element->setAttribute('class', 'form-control');
         }
     }
 }
示例#4
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '/user/dashboard/messages/create');
     $this->setAttribute('class', 'form-horizontal');
     $this->setAttribute('id', 'user-message-form');
     $to = new Text();
     $to->setName('recipient')->setLabel('Recipients')->setAttribute('id', 'recipients');
     $subject = new Text();
     $subject->setName('subject')->setLabel('Subject');
     $body = new Textarea();
     $body->setName('body')->setAttributes(array('placeholder' => 'Your message...', 'rows' => 4));
     $csrf = new Csrf();
     $csrf->setName('prev');
     $submit = new Submit();
     $submit->setName('submit')->setValue('Send');
     $this->add($to)->add($subject)->add($body)->add($csrf)->add($submit);
     foreach ($this->elements as $element) {
         if (!$element instanceof Submit) {
             $element->setAttribute('class', 'form-control');
         }
     }
 }