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; }
/** * * @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; }
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 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; }
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; }
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; }
/** * 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; }
public function createComponentDistricts() { $form = new Nette\Application\UI\Form(); $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; $districts = $this->context->createServiceLocalities()->select('locality.*, COUNT(DISTINCT :subject.id) AS catCount')->where('shire.code', $this->shire)->group('locality.id')->having('COUNT(:subject.locality_id) > 0')->order('shift DESC, locality.name'); // $cat = $form->addContainer('districts'); // foreach ($districts as $district) { // $cat->addCheckbox($district->id, $district->name)->setAttribute('onchange', 'submit()')->setOption('description', \Nette\Utils\Html::el("span")->class('help-inline')->setHtml("(" . $district->catCount . ")")); // if (isset($this->districts[$district->id])) { // $form['districts'][$district->id]->setValue($this->districts[$district->id]); // } // } // $cat->addCheckbox('all', 'all')->setAttribute('onchange', 'submit()'); $form->addSelect('locality_code', 'Lokalita:', $districts->fetchPairs('code', 'name'))->setAttribute('onchange', 'submit()')->setPrompt('Vše'); try { $form['locality_code']->setValue($this->locality); } catch (Exception $e) { $this->flashMessage('Vyhledávaná lokalita nepatří do tohoto kraje.'); } $form->addHidden('blabla')->setValue(1); $form->onSuccess[] = array($this, 'setDistrict'); return $form; }
/** * factory to change password form * @return \Nette\Application\UI\Form */ public function createComponentChangePassword() { $form = new \Nette\Application\UI\Form(); $form->addHidden("id", $this->id); $form->addPassword("newPassword", _("New Password:"******"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; }
/** * @return \Nette\Application\UI\Form */ protected function createComponentSetNewPassword() { $form = new \Nette\Application\UI\Form(); $form->addHidden("key", ""); $form->addHidden("id", 0); $form->addPassword("password", $this->t("forms.forgot-password.labels.password"))->setRequired($this->t("forms.forgot-password.rules.req-password")); $form->addPassword("passwordControl", $this->t("forms.forgot-password.labels.password-control"))->setRequired($this->t("forms.forgot-password.rules.req-password-control"))->addRule($form::EQUAL, $this->t("forms.forgot-password.rules.eq-password"), $form["password"]); $form["password"]->addRule($form::EQUAL, $this->t("forms.forgot-password.rules.eq-password"), $form["passwordControl"]); $form->addSubmit("send", $this->t("forms.forgot-password.labels.change")); $form->onSuccess[] = $this->setNewPassword; if (!is_null($this->actionKey)) { $form->setDefaults(array("key" => $this->actionKey->getKey(), "id" => $this->actionKey->getUserId())); } return $form; }
/** * factory to create send form * @return \Nette\Application\UI\Form */ public function createComponentSendForm() { $remoteNodes = $this->remoteNodes->getTable(); $result = []; foreach ($remoteNodes as $node) { $result[$node["aet"]] = " " . $node["name"] . "(" . $node["aet"] . ")"; } $form = new \Nette\Application\UI\Form(); $form->addHidden("StudyInstanceUID", $this->sendStudyFormValue); $form->addSelect("remoteAet", _("Destination node"), $result); $form->addSubmit('send', _('Send study'))->setHtmlId("sendSubmitForm"); $form->onSuccess[] = array($this, 'processSendStudy'); $this->setFromBootstrap($form); 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; }