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'); }
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'); }
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'); }
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'); }
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'); }
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); } }