示例#1
0
 protected function createComponentFormAddUser($name)
 {
     $form = new \Tatami\Forms\AjaxForm($this, $name);
     $form->addText('name', 'Name')->setRequired('Please fill %label.');
     $form->addText('email', 'E-mail')->setRequired('Please fill %label.');
     $userRoles = $this->em->getRepository('UserRole')->fetchPairs('id', 'name');
     $form->addSelect('role', 'Role', $userRoles);
     $form->addSubmit('btnSubmit', 'Create');
     $form->onSuccess[] = callback($this, 'formAddSubmitted');
 }
示例#2
0
 protected function createComponentFormRecoverPassword($name)
 {
     $form = new \Tatami\Forms\AjaxForm($this, $name);
     $form->addText('email', 'Email')->setOption('description', 'Enter your email')->setRequired('Please fill %name.')->addRule(\Nette\Forms\Form::EMAIL);
     $form->addSubmit('btnSubmit', 'Recover');
     $form->onSuccess[] = callback($this, 'formRecoverPasswordSubmitted');
 }
示例#3
0
文件: Shortcuts.php 项目: bazo/Tatami
 public function createComponentFormAddShortcut($name)
 {
     $form = new \Tatami\Forms\AjaxForm($this, $name);
     $form->addText('name', 'Name');
     $form->addSelect('module', 'Module', $this->shortcutsManager->getModules());
     $form->addSelect('presenter', 'Presenter', $this->shortcutsManager->getModules());
     $form->addSelect('action', 'Action', $this->shortcutsManager->getModules());
     $form->addSubmit('btnSave', 'OK')->onClick[] = callback($this, 'addShortcut');
 }
示例#4
0
 protected function createComponentFormTest($name)
 {
     $form = new \Tatami\Forms\AjaxForm($this, $name);
     $form->addHidden('id', $this->userId);
     $roles = $this->repository->getRolesTree();
     var_dump($roles);
     exit;
     $form->addText('test', 'Test');
     $form->addSubmit('btnSubmit', 'Submit')->onClick[] = callback($this, 'testFormSubmitted');
 }
示例#5
0
 public function createComponentFormAddUserRole($name)
 {
     $form = new \Tatami\Forms\AjaxForm($this, $name);
     $form->addText('name', 'Role name')->setRequired('Please fill in %label');
     $userRoles = $this->em->getRepository('UserRole')->fetchPairs('id', 'name');
     unset($userRoles[1]);
     $items = array(null => 'none') + $userRoles;
     $form->addSelect('template', 'Copy from', $items);
     $form->addSubmit('btnSubmit', 'Create');
     $form->onSuccess[] = callback($this, 'formAddUserRoleSubmitted');
 }
示例#6
0
 protected function createComponentFormUserAccount($name)
 {
     $form = new \Tatami\Forms\AjaxForm($this, $name);
     $form->addText('name', 'Name');
     $form->addText('password', 'Password');
     $form->addText('email', 'E-mail')->addRule(\Nette\Forms\Form::EMAIL, 'Please provide valid email address');
     $form->addSubmit('btnPrevious', 'Previous')->setValidationScope(false)->onClick[] = callback($this, 'goToPreviousStep');
     $form->addSubmit('btnNext', 'Next')->onClick[] = callback($this, 'formUserAccountSubmitted');
     if (isset($this->session->userAccount)) {
         $form->setDefaults($this->session->userAccount);
     }
 }