Example #1
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;
 }
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->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 #3
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 #4
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 #5
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 #6
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');
 }
 /**
  * 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;
 }
Example #9
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;
 }
Example #10
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;
 }
Example #11
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 #13
0
 /**
  * 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;
 }