Example #1
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 #2
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 #3
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;
 }
 /**
  * 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;
 }
Example #5
0
 public function createComponentParams()
 {
     $form = new \Nette\Application\UI\Form();
     $form->getElementPrototype()->class('form-inline');
     $form->setTranslator($this->translator);
     $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->addSelect('kids', 'Kids:', array('0' => 'Všechny děti', '1' => 'Děti do 3 let', '2' => 'Děti 3 - 6 let', '3' => 'Nad 6 let'))->setValue($this->kids)->setAttribute('onchange', 'submit()')->setAttribute('style', 'width: auto;');
     $form->addCheckbox('stroller', 'Entry with stroller')->setValue($this->stroller)->setAttribute('onchange', 'submit()');
     $form->addCheckbox('nonsmoking', 'Nekuřácké')->setValue($this->nonsmoking)->setAttribute('onchange', 'submit()');
     $form->addCheckbox('wheelchair_access', 'Bezbariérový přístup')->setValue($this->wheelchair_access)->setAttribute('onchange', 'submit()');
     $form->onSuccess[] = array($this, 'setParams');
     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;
 }