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 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 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 createComponentFormEditPermissions($name) { $form = new \Tatami\Forms\AjaxForm($this, $name); $form->addHidden('roleId', $this->roleId); $permissions = $this->context->moduleManager->getPermissions(); $permissionsContainer = $form->addContainer('permissions'); foreach ($permissions as $module => $permissionsArray) { foreach ($permissionsArray as $resource => $privileges) { $container = $permissionsContainer->addContainer($resource); foreach ($privileges as $privilege => $privilegeDescription) { $container->addCheckbox($privilege, $privilegeDescription); } } } $rolePermissions = $this->em->getRepository('UserRole')->getPermissionsForRole($this->roleId); $form->setDefaults(array('permissions' => $rolePermissions)); $form->addSubmit('btnSubmit', 'Save'); $form->onSuccess[] = callback($this, 'formEditPermissionsSubmitted'); }
public function createComponentFormInstall($name) { $form = new \Tatami\Forms\AjaxForm($this, $name); $form->addSubmit('btnPrevious', 'Previous')->setValidationScope(false)->onClick[] = callback($this, 'goToPreviousStep'); $form->addSubmit('btnInstall', 'Install')->onClick[] = callback($this, 'install'); }
public function createComponentFormChangePassword($name) { $form = new \Tatami\Forms\AjaxForm($this, $name); $form->addHidden('userId', $this->token->getUser()->getId()); $form->addProtection('Time limit 30min has expired. Send the form again', 1800); $form->addPassword('password', 'New password')->setRequired('Fill your new password'); $form->addSubmit('btnSubmit', 'Save'); $form->onSuccess[] = callback($this, 'formChangePasswordSubmitted'); }