/** * new user form * @return \Nette\Application\UI\Form */ public function createComponentNewUser() { $form = new \Nette\Application\UI\Form(); $form->addText('username', _("Login name:"), 30)->setRequired(_("You must enter login name !!")); $form->addText('name', _("Whole name:"), 30)->setRequired(_("You must enter whole name !!")); $form->addPassword("password", _("New Password"), 30)->addRule(\Nette\Application\UI\Form::MIN_LENGTH, _("Password must have minimal 6 letters"), 6); $form->addPassword("repeatedPassword", _("New password repeated"), 30)->addRule(\Nette\Application\UI\Form::EQUAL, _("Repeated password is not same as new password."), $form->getComponent('password')); $form->addText('refer_phys_key', _("Reference physician key:"), 30); $form->addText('email', _("Email address:"), 30)->addRule(\Nette\Application\UI\Form::EMAIL, _("Valid email address must be filled")); $form->addRadioList("role", _("Role"), array("administrator" => _("Administrator"), "moderator" => _("Moderator"), "viewer" => _("Viewer"), "externist" => _("Externist")))->setRequired(); $form->addSubmit('save', _("Add user")); $form->onSuccess[] = array($this, 'processNewUser'); $this->setFromBootstrap($form); return $form; }
/** * factory to change password form * @return \Nette\Application\UI\Form */ public function createComponentChangePassword() { $form = new \Nette\Application\UI\Form(); $form->addPassword("oldPassword", _("Old password"), 30)->setRequired(_("You must enter old password")); $form->addPassword("newPassword", _("New Password"), 30)->addRule(\Nette\Application\UI\Form::MIN_LENGTH, _("Password must have minimal 6 letters"), 6); $form->addPassword("repeatedPassword", _("New password repeated"), 30)->addRule(\Nette\Application\UI\Form::EQUAL, _("Repeated password is not same as new password."), $form->getComponent('newPassword')); $form->addSubmit('save', _("Change password")); $form->onSuccess[] = array($this, 'processChangePassword'); $this->setFromBootstrap($form); return $form; }