public function createComponentLoginForm() { $form = new Nette\Application\UI\Form(); $form->addText("username", "Jméno")->addRule(Nette\Application\UI\Form::FILLED, "Jméno musí být vyplněno"); $form->addPassword("password", "Heslo")->addRule(Nette\Application\UI\Form::FILLED, "Heslo musí být vyplněno"); $form->addCheckBox("remember", "Zůstat přihlášen"); $form->addSubmit("submit", "Přihlásit se"); $form->onSuccess[] = $this->loginFormSucceeded; return $form; }
protected function createComponentSignInForm() { $form = new Form(); $form->getElementPrototype()->class('ajax'); $form->addText('email')->setAttribute('class', 'input')->setAttribute('placeholder', 'E-mail'); $form->addPassword('passwd')->setAttribute('class', 'input')->setAttribute('placeholder', 'Heslo'); $form->addSubmit('signInBut', 'Přihlásit')->setAttribute('class', 'submit_button'); $form->addCheckBox('stay_logged', 'Neodhlašovat'); $form->onSuccess[] = array($this, 'signInFormSucceeded'); return $form; }
public function createComponentEditGuestApplicationForm() { $token = $this->getParameter('token'); $guest = $this->guestModel->getGuestByToken($token); $application = $this->applicationModel->getApplicationByGuest($guest->id); $races_appl = $this->applicationModel->getApplicationRaces($application->id); $services_appl = $this->applicationModel->getApplicationServices($application->id); $event = $this->eventModel->getEvent($application->event); $races = $this->eventModel->getEventRaces($event->id); $services = $this->eventModel->getEventServices($event->id); $form = new Nette\Application\UI\Form(); $form->addText('name', 'Jméno závodníka')->addRule(Nette\Application\UI\Form::FILLED, 'Jméno závodníka musí být vyplněno')->setDefaultValue($guest->name); $form->addText('competitor_index', 'Index závodníka')->addRule(Nette\Application\UI\Form::FILLED, 'Index závodníka musí být vyplněn')->setDefaultValue($guest->competitor_index); $form->addText('sportident', 'Číslo čipu')->setDefaultValue($application->si); foreach ($races_appl as $key => $val) { $categories = $this->categoryModel->getRaceCategoriesArray($val->race); $raceInputName = 'race_' . $val->race; $categoryInputName = 'category_' . $val->race; $form->addCheckBox($raceInputName)->setDefaultValue($val->checked); $form->addSelect($categoryInputName, '', $categories)->setDefaultValue($val->category); } foreach ($services_appl as $key => $val) { $serviceInputName = 'service_' . $val->service; $form->addCheckBox($serviceInputName)->setDefaultValue($val->checked); } $form->addSubmit('submit', 'Upravit přihlášku'); $form->addProtection(); $form->onSuccess[] = $this->editGuestApplicationFormSucceeded; return $form; }