コード例 #1
0
ファイル: SignPresenter.php プロジェクト: vitush93/kryo
 protected function createComponentSignForm()
 {
     $form = new Form();
     $form->addText('email', 'E-mail')->addRule(Form::EMAIL)->setRequired();
     $form->addPassword('password', 'Password')->setRequired();
     $form->addCheckbox('remember', 'Remember me')->setDefaultValue(true);
     $form->addSubmit('process', 'Login');
     $form->onSuccess[] = $this->signFormSucceeded;
     return BootstrapForm::makeBootstrap($form);
 }
コード例 #2
0
ファイル: AdminPresenter.php プロジェクト: vitush93/kryo
 protected function createComponentUserForm()
 {
     $form = new Form();
     $form->addText('email', 'E-mail')->addRule(Form::EMAIL)->setRequired();
     $form->addSelect('role', 'Role', [User::ROLE_USER => 'User', User::ROLE_KRYO => 'Kryo', User::ROLE_ADMIN => 'Admin'])->setRequired();
     $form->addPassword('password', 'Password')->addRule(Form::MIN_LENGTH, 'Password must be at least %d characters long.', 6)->setRequired();
     $form->addPassword('password2', 'Password again')->addRule(Form::EQUAL, 'Passwords are not the same.', $form['password'])->setOmitted();
     $form->addSubmit('process', 'Create a new user');
     $form->onSuccess[] = $this->userFormSucceeded;
     return BootstrapForm::makeBootstrap($form);
 }
コード例 #3
0
ファイル: HomepagePresenter.php プロジェクト: vitush93/kryo
 protected function createComponentAccountForm()
 {
     /** @var User $defaults */
     $defaults = $this->findUser();
     $form = new Form();
     $form->addText('email', 'E-mail')->setOption('description', 'This is your contact e-mail and your login.')->setDefaultValue($defaults->getEmail())->addRule(Form::EMAIL)->setRequired();
     $form->addText('phone', 'Phone')->setDefaultValue($defaults->getPhone());
     $form->addText('name', 'Name')->setDefaultValue($defaults->getName());
     $form->addText('password', 'Password')->setOption('description', 'Fill only if you want to change your current password.')->addCondition(Form::FILLED)->addRule(Form::MIN_LENGTH, 'Password must be at least %d characters long.', 6);
     $form->addTextArea('address', 'Address')->setDefaultValue($defaults->getAddress());
     $form->addText('business_name', 'Business name')->setDefaultValue($defaults->getBusinessName());
     $form->addText('ic', 'IC')->setDefaultValue($defaults->getIc());
     $form->addText('dic', 'DIC')->setDefaultValue($defaults->getDic());
     $form->addSubmit('process', 'Save');
     $form->onSuccess[] = $this->accountFormSucceeded;
     return BootstrapForm::makeBootstrap($form);
 }