Example #1
2
 /**
  * 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;
 }
Example #2
1
 /**
  * factory to create form of new item
  * @return \Nette\Application\UI\Form
  */
 public function createComponentAddForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addTextArea("comment", _("Comment of item"), 60)->setRequired(_("You must enter comment"));
     $form->addText("item", _("Item key"), 60)->setRequired(_("You must enter item key"));
     $form->addText("value", _("Value"), 60)->setRequired(_("You must enter item value"));
     $groups = $this->groups;
     unset($groups[""]);
     $form->addSelect("group", _("Configuration group"), $groups);
     $form->addSubmit('save', _("Save"));
     $form->onSuccess[] = array($this, 'processAddForm');
     $this->setFromBootstrap($form);
     return $form;
 }
 /**
  * Creates Form for Opting in
  *
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentOptInForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addAntispam();
     $form->addText('name', 'Jméno a Příjmení:')->setRequired('Vložte jméno.');
     $form->addText('mail', 'E-mail:')->addRule(\Nette\Application\UI\Form::EMAIL, 'Musí se jednat o platný e-mail.')->setRequired('Vložte e-mail.');
     $form->addText('phone', 'Telefon:')->setRequired('Vložte telefonní číslo');
     $form->addText('school', 'Škola:');
     $form->addText('class', 'Třída:');
     $form->addSubmit('send', 'Nezávazně se přihlásit');
     $form->onSuccess[] = $this->optInFormSucceeded;
     return $form;
 }
Example #4
1
 /**
  * factory to create form of new item
  * @return \Nette\Application\UI\Form
  */
 public function createComponentAddForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText("name", _("Node name"), 50)->setRequired(_("You must enter name"));
     $form->addTextArea("comment", _("Comment"), 52)->setRequired(_("You must enter comment"));
     $form->addText("aet", _("AE title"), 16)->setRequired(_("You must enter AE title"))->addRule(\Nette\Application\UI\Form::PATTERN, _("Only letters, numbers and *,_,-,. characters allowed"), "([a-zA-Z0-9\\*\\.\\-\\_]*)")->addRule(\Nette\Application\UI\Form::MAX_LENGTH, _("Maximal length of AE title is 16 characters"), 16);
     $form->addText("ip_address", _("IP address"), 20)->setRequired(_("You must enter ip address"))->addRule(\Nette\Application\UI\Form::PATTERN, _("Format of IP address is not valid"), "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})");
     $form->addText("port", _("Port"), 5)->setRequired(_("You must enter port"))->addRule(\Nette\Application\UI\Form::INTEGER, _("Port must be a number"))->addRule(\Nette\Application\UI\Form::RANGE, _("Port must be between 1 and 65536"), 1, 65536);
     $form->addSelect("compression", _("Compression type"), $this->compressions);
     $groups = $this->groups;
     unset($groups[""]);
     $form->addSelect("group", _("Node group"), $groups);
     $form->addSubmit('save', _("Save"));
     $form->onSuccess[] = array($this, 'processAddForm');
     $this->setFromBootstrap($form);
     return $form;
 }
Example #5
0
 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentRegisterForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText("username", $this->t("forms.register.labels.username"))->setRequired($this->t("forms.register.rules.req-username"))->addRule($form::MAX_LENGTH, $this->t("forms.register.rules.max-username", array("length" => 64)), 64);
     $form->addPassword("password", $this->t("forms.register.labels.password"))->setRequired($this->t("forms.register.rules.req-password"));
     $form->addPassword("passwordControl", $this->t("forms.register.labels.password-control"))->setRequired($this->t("forms.register.rules.req-password-control"))->addRule($form::EQUAL, $this->t("forms.register.rules.eq-password"), $form["password"]);
     $form["password"]->addRule($form::EQUAL, $this->t("forms.register.rules.eq-password"), $form["passwordControl"]);
     $form->addText("email", $this->t("forms.register.labels.email"))->setRequired($this->t("forms.register.rules.req-email"))->addRule($form::EMAIL, $this->t("forms.register.rules.email-email"))->addRule($form::MAX_LENGTH, $this->t("forms.register.rules.max-email", array("length" => 128)), 128);
     $form->addSubmit("send", $this->t("forms.register.labels.register"));
     $form->onSuccess[] = $this->processRegister;
     return $form;
 }
Example #6
0
 /**
  * factory to edit form
  * @return \Nette\Application\UI\Form
  */
 public function createComponentEditProfile()
 {
     $items = $this->translator->getLanguages();
     $data = $this->model->load();
     $form = new \Nette\Application\UI\Form();
     $form->addText('name', _("Your name:"), 30)->setValue($data->name)->setRequired(_("You must enter name !!"));
     $form->addText('refer_phys_key', _("Reference physician key:"), 30)->setValue($data->refer_phys_key);
     $form->addText('email', _("Email address:"), 30)->addRule(\Nette\Application\UI\Form::EMAIL, _("Valid email address must be filled"))->setValue($data->email);
     $form->addSelect("lang", _("User language:"), $items)->setValue($data->lang);
     $form->addSubmit('save', _("Save changes"));
     $form->onSuccess[] = array($this, 'processEditProfile');
     $this->setFromBootstrap($form);
     return $form;
 }
Example #7
0
 public function createComponentForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->setTranslator($this->translator);
     $form->addHidden('id');
     $form->addText('title', 'Title');
     $form->addText('description', 'Description');
     $form->addText('link', 'Link URL');
     $form->addText('link_text', 'Link Text');
     $form->addSelect('file_id', 'File', $this->context->createServiceFiles()->where('isImage', '1')->where('isnull(deleted)')->fetchPairs('id', 'name'))->setPrompt('Choose image');
     $form->onSuccess[] = callback($this, 'onSuccess');
     $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
     $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = callback($this, 'onCancel');
     $form['cancel']->getControlPrototype()->class('cancel');
     return $form;
 }
Example #8
0
 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentForgotPassword()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText("email", $this->t("forms.forgot-password.labels.email"))->setRequired($this->t("forms.forgot-password.rules.req-email"))->addRule($form::EMAIL, $this->t("forms.forgot-password.rules.email-email"));
     $form->addSubmit("send", $this->t("forms.forgot-password.labels.send"));
     $form->onSuccess[] = $this->processForm;
     return $form;
 }
Example #9
0
 /**
  * 
  * @param int $idTaskGroup
  */
 public function createComponentTaskFilterForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('filter_task_text', 'Zadejte název tasku');
     $form->addHidden('filter_task_group_id', $this->idTaskGroup);
     $form->addSubmit('filter_task_submit', 'Filtruj');
     return $form;
 }
Example #10
0
 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentCommandForm()
 {
     $form = new Nette\Application\UI\Form();
     $form->addText('command', 'Příkaz');
     $form->addSubmit('send', 'Zadat');
     $form->onSuccess[] = $this->commandFormSubmitted;
     return $form;
 }
Example #11
0
 public function createComponentLoginForm()
 {
     $form = new \Nette\Application\UI\Form($this, 'loginForm');
     $form->addText('login', 'Uživatelské jméno:')->addRule(\Nette\Application\UI\Form::FILLED, 'Musíte vyplnit uživatelské jméno!');
     $form->addPassword('password', 'Heslo:')->addRule(\Nette\Application\UI\Form::FILLED, 'Musíte vyplnit heslo!');
     $form->addSubmit('doLogin', 'Přihlásit se');
     $form->onSuccess[] = array($this, 'loginFormSubmitted');
     return $form;
 }
Example #12
0
 public function createComponentPaginatorForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('page', 'Přejít na stranu:')->setRequired('Prosím vyplň stranu na kterou chceš přejít.')->setAttribute('placeholder', 'Stránka');
     $form->addHidden('maxPage');
     $form->addSubmit('goto', 'Přejít');
     $form->onSuccess[] = $this->paginatorFormSuccess;
     return $form;
 }
 public function createComponentAddToChangelog()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('description', 'Short description')->setRequired('Write short description what you are changing');
     $form->addTextArea('queries', 'SQL queries', 60, 20)->setRequired('Huh?')->getControlPrototype()->class('long');
     $form->addSubmit('send', 'Save')->getControlPrototype()->class('btn btn-primary')->style("padding: 4px 25px;");
     $form->onSuccess[] = callback($this, 'addToChangelog');
     return $form;
 }
Example #14
0
 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentSignForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText("username", $this->t("forms.sign.labels.username"))->setRequired($this->t("forms.sign.rules.req-username"));
     $form->addPassword("password", $this->t("forms.sign.labels.password"))->setRequired($this->t("forms.sign.rules.req-password"));
     $form->addCheckbox("remember", $this->t("forms.sign.labels.remember"));
     $form->addSubmit("send", $this->t("forms.sign.labels.login"));
     $form->onSuccess[] = $this->processForm;
     $this->setDefaults($form);
     return $form;
 }
Example #15
0
 /**
  * Sign-in form factory.
  * @author Petr Besir Horacek <*****@*****.**>
  * @return Nette\Application\UI\Form
  */
 protected function createComponentSignInForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('username', 'Username:'******'Please enter your username.');
     $form->addPassword('password', 'Password:'******'Please enter your password.');
     $form->addCheckbox('remember', 'Keep me signed in');
     $form->addSubmit('send', 'Sign in');
     // call method signInFormSucceeded() on success
     $form->onSuccess[] = $this->signInFormSucceeded;
     return $form;
 }
Example #16
0
 /**
  * Sign-in form factory.
  * @return \Nette\Application\UI\Form
  */
 public function createComponentSignUpForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addGroup('');
     //$em = $this->em;
     $form->addText('username', 'Username')->setRequired('Username is required');
     /*
     			->addCondition(Form::FILLED)
     				->addRule(function($control) use($em) {
     					$value = $control->value;
     					return $em->getRepository('User')->findOneByUsername($value) === NULL;
     				}, 'This username is already taken');
     * 
     */
     $password1 = $form->addPassword('password', 'Password')->setRequired('Fill in the password');
     $password2 = $form->addPassword('password2', 'Password (verify)')->addConditionOn($password1, Form::FILLED)->addRule(Form::FILLED, 'Fill in the password again');
     $password2->addCondition(Form::FILLED)->addRule(Form::EQUAL, 'Passwords do not match', $password1);
     $form->addText('captcha', 'Who you gonna call!? (v108b)')->setRequired('Answer to the security question is required')->addRule(Form::EQUAL, 'Bad answer', 'v108b');
     $form->addSubmit('submit', 'Register me!');
     $form->onSuccess[] = $this->signUpSuccess;
     return $form;
 }
Example #17
0
 public function createComponentForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->setTranslator($this->translator);
     $form->addHidden('id');
     $form->addText('name', 'Title');
     $form->addText('term', 'Term')->setOption('description', 'Termin kdy se akce kona.');
     $form->addText('published', 'Published')->setRequired('Date of publication is required!')->setDefaultValue(new \DibiDateTime());
     $form->addTextArea('perex', 'Perex')->addRule(\Nette\Application\UI\Form::FILLED, 'Perex must be filled')->getControlPrototype()->class('texyla');
     foreach ($this->context->createServiceFiles()->where('isImage', '1')->where('isnull(deleted)')->where('visible', '1')->limit(500)->order('created DESC') as $item) {
         $el = \Nette\Utils\Html::el('option')->value($item->id)->setText('' . $item->name . '       __      ' . $this->presenter->getHttpRequest()->url->baseUrl . 'image/crop-100x100/' . $item->code);
         $arr[$item->id] = $el;
     }
     foreach ($this->context->createServiceFiles()->where('id', $this->event->file_id) as $item) {
         $el = \Nette\Utils\Html::el('option')->value($item->id)->setText($this->presenter->getHttpRequest()->url->baseUrl . 'image/crop-100x100/' . $item->code);
         $arr[$item->id] = $el;
     }
     $form->addSelect('file_id', 'File:', $arr)->setPrompt('Choose image')->setAttribute('class', 'egg');
     //		foreach ($this->context->createServiceFiles()->where('isImage', '1')->where('isnull(deleted)')->where('visible','1')->limit(100)->order('created DESC') as $item) {
     //			$el = \Nette\Utils\Html::el('option')->value($item->id)->setText($item->name)->data(array('imagesrc' => $this->presenter->getHttpRequest()->url->baseUrl . 'image/crop-40x40/' . $item->code, 'description' => $item->description));
     //			//if($key == $data->doprava_id)
     //			//$el->selected(TRUE);
     //			$arr[$item->id] = $el;
     //		}
     //
     //		$form->addSelect('file_id', 'File:', $arr)
     //			->setPrompt('Choose image')->setAttribute('class', 'ddslick');
     //		$form->addSelect('file_id', 'File', $this->context->createServiceFiles()->where('isImage','1')->where('isnull(deleted)')->fetchPairs('id', 'name'))->setPrompt('Choose image');
     $form->addTextArea('description', 'Description')->addRule(\Nette\Application\UI\Form::FILLED, 'Body must be filled')->getControlPrototype()->class('texyla');
     $form->addTextArea('results', 'Results')->getControlPrototype()->class('texyla');
     $form->addTextArea('notes', 'Notes');
     $form->addCheckbox('visible', 'Visible')->setDefaultValue(1);
     $form->addCheckbox('ad', 'Recommended');
     $form->onSuccess[] = callback($this, 'onSuccess');
     $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
     $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = callback($this, 'onCancel');
     $form['cancel']->getControlPrototype()->class('cancel');
     return $form;
 }
Example #18
0
 public function createComponentLoginForm()
 {
     $form = new Nette\Application\UI\Form();
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'div class="control-group"';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = 'div class="controls"';
     $form->setTranslator($this->parent->translator);
     $form->getElementPrototype()->setClass("ajax");
     // ajax
     $form->addText('username', 'Username')->setRequired()->getLabelPrototype()->setClass('control-label');
     $form['username']->getControlPrototype()->setClass(' input-block-level');
     $form->addPassword('password', 'Password')->setRequired()->getLabelPrototype()->setClass('control-label');
     $form['password']->getControlPrototype()->setClass(' input-block-level');
     $form->addSubmit('login', 'Log in')->setAttribute("class", "btn");
     $form->onSuccess[] = callback($this, "login");
     return $form;
 }
Example #19
0
 public function createComponentForm()
 {
     $form = new \Nette\Application\UI\Form();
     //$form->getElementPrototype()->class('form-horizontal');
     $form->setTranslator($this->parent->translator);
     $form->getElementPrototype()->setClass("ajax");
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class="control-group"';
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = NULL;
     $form->addTextArea('text', 'Sdělte nám prosím, co je potřeba upravit. Pokud chcete, abychom vám odpověděli, napište do zprávy svůj e-mail:')->setRequired('Text must be filled.')->getControlPrototype()->class('span12');
     $form->addHidden('id');
     $form->addHidden('subject_id');
     $form->addHidden('event_id');
     $form->addText('www')->setAttribute('class', 'hidden')->setDefaultValue('');
     $form->addSubmit('login', 'Send')->setAttribute("class", "btn");
     $form->onSuccess[] = array($this, 'save');
     return $form;
 }
Example #20
0
 /**
  * factory to create form of new item
  * @return \Nette\Application\UI\Form
  */
 public function createComponentAddForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText("name", _("SOP class name"), 40)->setRequired(_("You must enter name"));
     $form->addText("sop", _("SOP class ID"), 40)->setRequired(_("SOP class ID is required"))->addRule(\Nette\Application\UI\Form::PATTERN, _("Only numbers and dots allowed"), "([0-9\\.]*)");
     $form->addText("application", _("Application type"), 40)->setRequired(_("You must enter application type"));
     $form->addText("transfer", _("Transfer syntax (optionally)"), 40);
     $form->addSubmit('save', _("Save"));
     $form->onSuccess[] = array($this, 'processAddForm');
     $this->setFromBootstrap($form);
     return $form;
 }
 /**
  * Form for adding and editing News
  *
  * @Action('create', 'edit')
  * @Privilege('create', 'edit')
  */
 protected function createComponentEditNewsForm($name)
 {
     $form = new \Nette\Application\UI\Form($this, $name);
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addHidden('id');
     $form->addSelect('type', 'Typ aktuality:', ['Zpráva' => 'Zpráva'])->setRequired('Musíte vybrat typ aktuality');
     $form->addJDSelect('event_id', 'Vyberte akci:', $form['type'], array($this, "getValuesEventId"));
     $form->addText('heading', 'Nadpis:')->setRequired('Musíte vyplnit nadpis')->setAttribute('size', 60);
     $form->addTextarea('content', 'Text aktuality:')->setRequired('Musíte vyplnit text aktuality')->setAttribute('rows', 5)->setAttribute('cols', 60);
     if ($this->user->isAllowed('Admin:Default:News', 'show')) {
         $form->addCheckbox('show', 'Zobrazit aktualitu')->setDefaultValue(TRUE);
     }
     $form->addSubmit('send', 'Odeslat');
     $form->onSuccess[] = $this->editNewsFormSucceded;
     $form->getElementPrototype()->onsubmit('tinyMCE.triggerSave()');
     return $form;
 }
 /**
  * Form for editing a post
  *
  * @Privilege("edit")
  * @Action("edit")
  */
 protected function createComponentGuestbookForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addHidden('id');
     $members = $this->members->getAuthenticatedUsers()->fetchPairs('user_id', 'nickname');
     $user_id = $form->addSelect('user_id', 'Ověřený uživatel:', $members)->setPrompt('Vyberte uživatele');
     $form->addText('name', 'Jméno:')->setAttribute('size', 30)->addConditionOn($form['user_id'], ~\Nette\Application\UI\Form::FILLED)->addRule(\Nette\Application\UI\Form::FILLED, 'Musíte buď vybrat uživatele nebo zadat jméno pro příspěvek');
     $user_id->addConditionOn($form['name'], ~\Nette\Application\UI\Form::FILLED)->addRule(\Nette\Application\UI\Form::FILLED, 'Musíte buď vybrat uživatele nebo zadat jméno pro příspěvek');
     $form->addDateTimePicker('time', 'Čas příspěvku')->setAttribute('size', 30);
     $form->addTextarea('post', 'Vzkaz:')->setAttribute('cols', 50)->setAttribute('rows', 5)->setRequired('Musíte zadat text vzkazu');
     $form->addText('mail', 'E-mail:')->setAttribute('size', 30)->addCondition(\Nette\Application\UI\Form::FILLED)->addRule(\Nette\Application\UI\Form::EMAIL, 'Musí se jednat o platný e-mail');
     $form->addText('web', 'Web:')->setAttribute('size', 30);
     $form->addSubmit('send', 'Změnit');
     $form->onSuccess[] = $this->guestFormSucceded;
     return $form;
 }
 /**
  * Sign-in form factory.
  *
  * @return Nette\Application\UI\Form
  */
 protected function createComponentSignInForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('username', 'Jméno:')->setRequired('Vložte přihlašovací jméno.');
     $form->addPassword('password', 'Heslo:')->setRequired('Vložte své heslo.');
     $form->addCheckbox('remember', 'Zůstat přihlášen');
     $form->addSubmit('send', 'Přihlásit');
     // form presentation
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = 'div';
     $form->onSuccess[] = $this->signInFormSucceeded;
     return $form;
 }
Example #24
0
 /**
  * Create filter form
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentFilterForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->setMethod(\Nette\Application\UI\Form::GET);
     foreach ($this->getColumns() as $column) {
         $name = $column->getColumn();
         $label = $column->labelPrototype->getText();
         if ($column instanceof Columns\OptionColumn && $column->options) {
             $form->addSelect($name, $label, $column->getOptions())->setPrompt($label);
         } else {
             $form->addText($name, $label);
         }
         $form[$name]->getControlPrototype()->placeholder = $label;
     }
     $form->setDefaults($this->filter);
     $form->addSubmit('filter', 'Filter');
     $form->addSubmit('reset', 'Reset')->onClick[] = $this->resetFilters;
     $form->onSuccess[] = $this->filterFormSubmitted;
     return $form;
 }
 /**
  * Registration form
  *
  * @Action("create", "edit")
  * @Privilege("create", "edit")
  */
 protected function createComponentRegistrationForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $members = $this->members->getMembersWithoutRegistration()->fetchPairs('nickname', 'nickname');
     $member_nickname = $form->addSelect('nickname', 'Členové bez registrace:', $members)->setPrompt('Vyberte člena');
     $form->addText('member_nickname', 'Přesdívka:')->addConditionOn($form['nickname'], ~\Nette\Application\UI\Form::FILLED)->addRule(\Nette\Application\UI\Form::FILLED, 'Musíte vybrat přezdívku');
     $member_nickname->addConditionOn($form['member_nickname'], ~\Nette\Application\UI\Form::FILLED)->addRule(\Nette\Application\UI\Form::FILLED, 'Musíte vybrat přezdívku');
     $form->addDatePicker('birth_date', 'Datum Narození:')->setRequired('Vyplňte datum narození');
     $form->addText('oddil', 'Oddíl:')->setType('number');
     $form->addTextarea('address', 'Adresa:')->setOption('description', \Nette\Utils\Html::el('td')->setText('Oddělujte novým řádkem'))->setAttribute('rows', 4)->setAttribute('cols', 30);
     $form->addText('mobile', 'Telefon:');
     $form->addText('registration_number', 'Registrační Číslo:')->setOption('description', \Nette\Utils\Html::el('td')->setText('To samé co v IS skautu'));
     $form->addSubmit('send', 'Přidat/Změnit');
     $form->onSuccess[] = $this->registrationFormSucceded;
     return $form;
 }
Example #26
0
 /**
  * factory to reset form
  * @return \Nette\Application\UI\Form
  */
 public function createComponentResetForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('username', _("Username:"******"Enter valid username !!"));
     $form->addText('email', _("Email:"))->addRule(\Nette\Application\UI\Form::EMAIL, _("Valid email address must be filled"));
     $form->addSubmit('login', _("Reset password"));
     $form->onSuccess[] = array($this, 'processResetForm');
     $this->setFromBootstrap($form);
     return $form;
 }
 /**
  * Form for creating or editing a history
  *
  * @Action("create", "edit")
  * @Privilege("create", "edit")
  */
 protected function createComponentHistoryForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addText('year', 'Ročník:')->setRequired('Musíte vyplnit rok')->setOption('description', \Nette\Utils\Html::el('td')->setText('(formát "rrrr - rrrr")'))->setAttribute('size', 40);
     $form->addText('game', 'Táborová hra:')->setDefaultValue('???')->setRequired('Musíte vyplnit táborovou hru')->setAttribute('size', 40);
     $form->addTextarea('leaders', 'Vedoucí:')->setRequired('Musíte vyplnit vedoucí oddílu')->setOption('description', \Nette\Utils\Html::el('td')->setText('(oddělujte čárkou)'))->setAttribute('rows', 4)->setAttribute('cols', 40);
     $form->addTextarea('deputies', 'Zástupci:')->setRequired('Musíte vyplnit zástupce vedoucího')->setOption('description', \Nette\Utils\Html::el('td')->setText('(oddělujte čárkou)'))->setAttribute('rows', 4)->setAttribute('cols', 40);
     $form->addTextarea('oldscouts', 'Oldskauti:')->setRequired('Musíte vyplnit olskauty')->setOption('description', \Nette\Utils\Html::el('td')->setText('(oddělujte čárkou)'))->setAttribute('rows', 4)->setAttribute('cols', 40);
     $form->addTextarea('rangers', 'Roveři:')->setRequired('Musíte vyplnit rovery')->setOption('description', \Nette\Utils\Html::el('td')->setText('(oddělujte čárkou)'))->setAttribute('rows', 4)->setAttribute('cols', 40);
     $form->addText('club', 'Klubovna:')->setRequired('Musíte vyplnit klubovny')->setAttribute('size', 40);
     $form->addText('camp', 'Tábor:')->setDefaultValue('???')->setRequired('Musíte vyplnit tábořiště')->setAttribute('size', 40);
     $form->addTextarea('mloci', 'Mloci:')->setOption('description', \Nette\Utils\Html::el('td')->setText('(nový člen na nový řádek)'))->setAttribute('rows', 4)->setAttribute('cols', 40);
     $form->addTextarea('tucnaci', 'Tučňáci:')->setOption('description', \Nette\Utils\Html::el('td')->setText('(nový člen na nový řádek)'))->setAttribute('rows', 4)->setAttribute('cols', 40);
     $form->addTextarea('jezevci', 'Jezevci:')->setOption('description', \Nette\Utils\Html::el('td')->setText('(nový člen na nový řádek)'))->setAttribute('rows', 4)->setAttribute('cols', 40);
     $form->addUpload('file', 'Náhled:')->addCondition(\Nette\Application\UI\Form::FILLED)->addRule(\Nette\Application\UI\Form::IMAGE, 'Náhled musí být JPEG, PNG nebo GIF.');
     $form->addSubmit('send', 'Přidat/Změnit');
     $form->onSuccess[] = $this->historyFormSucceded;
     return $form;
 }
 public function createComponentEditSongForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addHidden('id');
     $form->addText('name', 'Jméno písně:');
     $form->addText('artist', 'Interpret:');
     $form->addSelect('group', 'Skupina:', ['Oddílový' => 'Základní dětský', 'Táborový' => 'Rozšířený dětský', 'Střediskový' => 'Táborákové písně', 'Roverský' => 'Nevhodné pro bobany']);
     $form->addTextarea('lyrics', 'Text:', 50)->setAttribute('class', 'mceEditor');
     $form->addTextarea('notes', 'Poznámky:');
     $form->addSubmit('send', 'Odeslat');
     $form->getElementPrototype()->onsubmit('tinyMCE.triggerSave()');
     $form->onSuccess[] = $this->editSongFormSucceded;
     return $form;
 }