Exemplo n.º 1
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;
 }
Exemplo n.º 2
0
 public function save(Nette\Application\UI\Form $form)
 {
     $flag = $this->context->createServiceFlags();
     try {
         $vars = $form->getValues();
         if ($vars['www'] !== '') {
             $form->addError('Are you a spam robot, right?');
             throw new AuthorizationException('Are you a spam robot, right?');
         }
         unset($vars['www']);
         $flag->flag = $vars;
         $flag->save();
         $cache = new Nette\Caching\Cache($this->context->cacheStorage);
         $cache->clean(array('flags', 'flag'));
         $this->flashMessage('Děkujeme! Váš podnět k aktualizaci zpracujeme. Peknyden.cz.', 'success');
         $this->hide = true;
     } catch (AuthorizationException $e) {
         $this->flashMessage($e->getMessage(), 'error');
     } catch (Exception $e) {
         $this->flashMessage('There is error during saving flag! We know about this. Try it later, please.', 'error');
     }
     if ($this->parent->isAjax()) {
         $this->redrawControl('form');
     }
 }
 public function createComponentUploadForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->getElementPrototype()->addAttributes(["class" => "dropzone"]);
     $form->addUpload("file", NULL)->setHtmlId("fileUpload");
     $form->onSuccess[] = $this->process;
     return $form;
 }
 protected function createComponentRealDeploy()
 {
     $form = new Nette\Application\UI\Form();
     $form->addHidden('dirToDeploy', $this->dirToDeploy);
     $form->addSubmit('realDeploy', 'Real deploy of "' . $this->dirToDeploy . '"')->setAttribute('class', 'btn btn-danger fixed');
     $form->onSuccess[] = callback($this, 'processRealDeploy');
     return $form;
 }
Exemplo n.º 5
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;
 }
Exemplo n.º 6
0
 public function createComponentForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addTextArea('sql', $this->sql);
     $form->addSubmit('submit', 'getStitky');
     $form->onSuccess[] = callback($this, 'sendStitky');
     return $form;
 }
Exemplo n.º 7
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;
 }
Exemplo n.º 8
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;
 }
Exemplo n.º 9
0
 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;
 }
Exemplo n.º 10
0
 public function getForm()
 {
     if ($this->form) {
         return $this->form;
     }
     $form = new \Nette\Application\UI\Form();
     $form['upload'] = new \WebChemistry\Images\Controls\Upload();
     $form->addSubmit('submit');
     return $this->form = $form;
 }
Exemplo n.º 11
0
 public function commandFormSubmitted(Nette\Application\UI\Form $form)
 {
     $command = $form->getValues()->command;
     $this->serverCmd->issueCommand($command, $this->runtimeHash);
     //TODO make it less ugly and more reliable
     usleep(500000);
     if ($this->isAjax()) {
         $this->redrawControl();
     } else {
         $this->redirect('this');
     }
 }
Exemplo n.º 12
0
 public function login(Nette\Application\UI\Form $form)
 {
     $values = $form->getValues();
     try {
         //$this->context->user->setExpiration('+ 14 days', FALSE);
         $this->context->user->login($values->username, $values->password);
         if ($this->parent->isAjax()) {
             $this->invalidateControl('body');
             $this->invalidateControl('login');
         } else {
             $this->parent->redirect("this");
         }
     } catch (Nette\Security\AuthenticationException $e) {
         $this->flashMessage("Špatné jméno nebo heslo. Zkus to znovu.", "error");
         if ($this->parent->isAjax()) {
             $this->invalidateControl('loginForm');
         }
     }
 }
Exemplo n.º 13
0
 /**
  * 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;
 }
Exemplo n.º 14
0
 /**
  * Form for changing password
  *
  * @Action("default")
  * @Privilege("default")
  */
 protected function createComponentChangePasswordForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addPassword('oldpassword', 'Současné heslo:')->setRequired('Zadejte současné heslo');
     $form->addPassword('password', 'Nové heslo:')->setRequired('Zvolte si heslo')->addRule(\Nette\Application\UI\Form::MIN_LENGTH, 'Heslo musí mít alespoň %d znaků', 6);
     $form->addPassword('passwordVerify', 'Heslo pro kontrolu:')->setRequired('Zadejte prosím heslo ještě jednou pro kontrolu')->addRule(\Nette\Application\UI\Form::EQUAL, 'Hesla se neshodují', $form['password']);
     $form->addSubmit('send', 'Změnit');
     $form->onSuccess[] = $this->changePasswordSucceded;
     return $form;
 }
Exemplo n.º 15
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;
 }
Exemplo n.º 16
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;
 }
Exemplo n.º 17
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;
 }
Exemplo n.º 18
0
 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentLoadBackup()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addUpload('upload', 'Zip archiv se zálohou:')->addRule(\Nette\Application\UI\Form::MIME_TYPE, "Soubor musí být zip archiv", "application/zip");
     $form->addSubmit('send', 'Nahrát');
     $form->onSuccess[] = $this->loadBackupSubmitted;
     $form->onError[] = function ($form) {
         foreach ($form->errors as $er) {
             $form->getPresenter()->flashMessage($er, 'error');
         }
         $form->cleanErrors();
     };
     return $form;
 }
Exemplo n.º 19
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;
 }
Exemplo n.º 20
0
 /**
  * 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;
 }
Exemplo n.º 22
0
 public function createComponentOrderby()
 {
     $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('orderby', 'Order by:', array('name' => 'Sort Alpabeticaly', 'created DESC' => 'Recent first', 'recommended' => 'Tips', 'likes' => 'Recommendations'))->setValue($this->order)->setAttribute('onchange', 'submit()');
     $form->onSuccess[] = array($this, 'setOrder');
     return $form;
 }
Exemplo n.º 23
0
 /**
  * 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;
 }
Exemplo n.º 24
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;
 }
Exemplo n.º 25
0
 /**
  * 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;
 }
Exemplo n.º 26
0
 public function createComponentOrderby()
 {
     $form = new \Nette\Application\UI\Form();
     $form->getElementPrototype()->class('form-inline');
     $form->setTranslator($this->translator);
     $form->addSelect('orderby', 'Order by:', array('date_from' => 'Start date', 'created DESC' => 'Recent first'))->setValue($this->order)->setAttribute('onchange', 'submit()');
     $form->onSuccess[] = array($this, 'setOrder');
     return $form;
 }
Exemplo n.º 27
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;
 }
Exemplo n.º 29
0
 protected function createComponentForm($name)
 {
     $form = new \Nette\Application\UI\Form($this, $name);
     $form->setTranslator($this->getTranslator());
     $form->setMethod($form::GET);
     $buttons = $form->addContainer(self::BUTTONS);
     $buttons->addSubmit('search', 'Grido.Search')->onClick[] = [$this, 'handleFilter'];
     $buttons->addSubmit('reset', 'Grido.Reset')->onClick[] = [$this, 'handleReset'];
     $buttons->addSubmit('perPage', 'Grido.ItemsPerPage')->onClick[] = [$this, 'handlePerPage'];
     $form->addSelect('count', 'Count', $this->getItemsForCountSelect())->setTranslator(NULL)->controlPrototype->attrs['title'] = $this->getTranslator()->translate('Grido.ItemsPerPage');
 }
Exemplo n.º 30
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;
 }