public function createComponentUpload()
 {
     $form = new Form();
     $form->addUpload('foto', 'Fotografie (max. 2 MB):')->addRule(Form::MAX_FILE_SIZE, 'Maximální velikost souboru je 2 MB.', 2 * 1024 * 1024);
     $form->addTextarea("alt", "Popis");
     $form->addTextarea("title", "Titulek");
     $form->addSubmit('submit', 'Nahrát');
     $form->onSuccess[] = callback($this, 'handleSavePhoto');
     return $form;
 }
 protected function createComponentFormExcelParser()
 {
     $form = new Form();
     $form->addTextarea('clipboard', 'Clipboard:');
     $form->addTextarea('template', 'Template:');
     $form->addSubmit('generate', 'Generate');
     $form->onSuccess[] = callback($this, 'excelParserFormSubmitted');
     $form->setDefaults(array('template' => '{{index}}: {{0}}'));
     return $form;
 }
 protected function createComponentNotesForm()
 {
     $form = new Form();
     $notesLabel = $this->translator->translate('messages.user.notes');
     $form->addTextarea('notes', $notesLabel, $this->enrollment->notes)->setValue($this->enrollment->notes);
     $hiddenNotesLabel = $this->translator->translate('messages.user.hiddenNotes');
     $form->addTextarea('hiddenNotes', $hiddenNotesLabel)->setValue($this->enrollment->hiddenNotes);
     $submitLabel = $this->translator->translate('messages.user.saveNotes');
     $form->addSubmit('submit', $submitLabel);
     $form->onSuccess[] = array($this, 'notesFormSucceeded');
     return $form;
 }
 /**
  * Contact form
  */
 protected function createComponentContactForm()
 {
     // vytvoříme element
     $products = array('Zakladni' => 'Základní', 'Pokrocile' => 'Pokročilé', 'NaMiru' => 'Na Míru', 'Ostatni' => 'Ostatní');
     $form = new Form();
     $form->addText('name', 'Jméno ')->addRule(Form::FILLED, 'Zadejte jméno');
     $form->addSelect('product', 'Produkt:', $products)->setRequired()->setDefaultValue('Zakladni');
     $form->addText('phone', 'Telefon ');
     $form->addText('email', 'Email')->addRule(Form::FILLED, 'Zadejte email')->addRule(Form::EMAIL, 'Email nemá správný formát');
     $form->addTextarea('message', 'Zpráva', 999, 5)->addRule(Form::FILLED, 'Zadejte zprávu');
     $form->addSubmit('send', 'Odeslat');
     // setup form rendering
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = 'div class=col-sm-12';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-12  text-center"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     // make form and controls compatible with Twitter Bootstrap
     $form->getElementPrototype()->class('form-horizontal');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-green btn-block btn-lg' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     $form->onSuccess[] = $this->processContactForm;
     return $form;
 }
Esempio n. 5
0
 protected function createComponentMessageForm()
 {
     $form = new Form();
     $form->addTextarea('message');
     $form->addSubmit('submit');
     $form->onSuccess[] = array($this, 'messageFormSucceeded');
     return $form;
 }
Esempio n. 6
0
 /**
  * Example form factory
  * @return Form
  */
 protected function createComponentExampleForm()
 {
     $form = new Form();
     $form->addTextarea("text", "Text", 110, 20)->getControlPrototype()->class("texyla");
     $form->addSubmit("s", "Submit");
     $form->onSuccess[] = callback($this, 'exampleFormSubmitted');
     return $form;
 }
 /**
  * @return Form
  */
 public function create()
 {
     $form = new Form();
     $form->addText('name', 'Jméno:')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Nevyplněno')->setRequired('Zadejte prosím jméno.');
     $form->addTextarea('comment', 'Komentář:')->setAttribute('class', 'form-control')->setAttribute('rows', 'auto')->setAttribute('placeholder', 'Nevyplněno')->setRequired('Komentář je prázdný.');
     $form->addSubmit('submit', 'Uložit')->setAttribute('class', 'btn btn-primary');
     $form->onSuccess[] = array($this, 'formSucceeded');
     return $form;
 }
Esempio n. 8
0
 /**
  * Contact form
  */
 protected function createComponentContactForm()
 {
     $form = new Form();
     $form->addText('name', 'Jméno:')->addRule(Form::FILLED, 'Zadejte jméno');
     $form->addText('email', 'Email:')->addRule(Form::FILLED, 'Zadejte email')->addRule(Form::EMAIL, 'Email nemá správný formát');
     $form->addTextarea('message', 'Zpráva:')->addRule(Form::FILLED, 'Zadejte zprávu');
     $form->addSubmit('send', 'Odeslat');
     $form->onSuccess[] = $this->processContactForm;
     return $form;
 }
Esempio n. 9
0
 public function createComponentTexyForm()
 {
     $form = new Form();
     $input = $form->addTextarea('content', "Content:")->getControlPrototype();
     $input->data('codemirror', 'init');
     $input->data('mode', 'texy');
     $input->data('image', $this->link('saveImage!'));
     $form->addSubmit('actionSend', 'Save');
     $form->onSuccess[] = array($this, 'texyFormSubmitted');
     return $form;
 }
Esempio n. 10
0
 function createComponentEmailForm()
 {
     $form = new Form();
     $form->addText('name')->setAttribute('id', 'name')->setAttribute('class', 'text')->addRule(Form::FILLED, 'Invalid Name!');
     $form->addText('email')->setAttribute('id', 'email')->setAttribute('class', 'text')->addRule(Form::FILLED, 'Invalid E-Mail!')->addRule(Form::EMAIL, 'Invalid E-Mail!');
     $form->addText('subject')->setAttribute('id', 'subject')->setAttribute('class', 'text')->addRule(Form::FILLED, 'Invalid Subject!');
     $form->addTextarea('message')->setAttribute('id', 'message')->setAttribute('class', 'text')->setAttribute('rows', '10')->setAttribute('cols', '50')->addRule(Form::FILLED, 'Invalid Text!');
     $form->addSubmit('send')->setAttribute('vale', 'Send')->setAttribute('class', 'sendit');
     $form->onSuccess[] = array($this, 'emailFormSucceeded');
     return $form;
 }
Esempio n. 11
0
 protected function createComponentContactForm()
 {
     $form = new Form();
     $rendered = new Bs3FormRenderer();
     $rendered->wrappers['control']['container'] = 'div class=col-sm-10';
     $rendered->wrappers['label']['container'] = 'div class="col-sm-2 control-label"';
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->setRenderer($rendered);
     $form->addText('name', 'Vaše jméno')->addRule(Form::FILLED, 'Vyplňte vaše jméno');
     $form->addText('email', 'Váš e-mail')->setEmptyValue('@')->addRule(Form::FILLED, 'Vyplňte váš e-mail')->addRule(Form::EMAIL, 'E-mail má nesprávný tvar');
     $form->addTextarea('text', 'Zpráva')->addRule(Form::FILLED, 'Vyplňte zprávu')->setAttribute('rows', 12);
     $form->addReCaptcha('captcha')->addRule(ReCaptchaControl::VALID, 'Zatrhněte, že nejste robot :)');
     $form->addSubmit('okSubmit', 'Odeslat');
     $form->onSuccess[] = [$this, 'contactFormSubmitted'];
     return $form;
 }
Esempio n. 12
0
 protected function createComponentDuplicateForm()
 {
     $form = new Nette\Application\UI\Form();
     $form->addText('rezervace_id');
     $form->addText('zakaznik');
     $form->addTextarea('poznamka');
     $form->addText('datum_od');
     $form->addText('datum_do');
     $form->addText('telefon');
     $form->addText('email');
     $model = $this->context->rezervace;
     $apartmany = $model->getApartments();
     $apartman[] = "";
     foreach ($apartmany as $zal) {
         $apartman[$zal->apartman_id] = $zal->nazev;
     }
     $form->addSelect('apartman_id', 'asdf', $apartman);
     $form->addSubmit('send', 'Přidat');
     $form->onSuccess[] = $this->duplicateFormSucceeded;
     return $form;
 }
Esempio n. 13
0
 public function createComponentMenu()
 {
     $form = new UI\Form();
     $this->database->table('master_menus')->order('name DESC');
     $menuList = array(0 => "No Parent");
     $menuList += $wings = $this->database->table('master_menus')->fetchPairs('id', 'name');
     $form->addHidden('created')->setValue(date('Y-m-d H:i:s'));
     $form->addHidden('modified')->setValue(date('Y-m-d H:i:s'));
     $form->addHidden('created_by')->setValue(1);
     $form->addHidden('modified_by')->setValue(1);
     $form->addText('name', 'Menu Name :')->setRequired("Please enter menu name");
     $form->addText('menu_url', 'Menu URL :')->setRequired("Please enter menu name");
     $form->addTextarea('description', 'Menu Description :')->setRequired("Please enter menu description");
     $form->addSelect('parent_id', 'Parent Menu Name :', $menuList);
     $form->addSubmit('save', 'Save');
     $form->onSuccess[] = array($this, 'menuSucceeded');
     return $form;
 }
Esempio n. 14
0
 /**
  * Form for editing the invitations to events
  *
  * @Action("edit")
  * @Privilege("edit")
  */
 protected function createComponentEditEventForm()
 {
     $form = new Form();
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addHidden('id');
     $form->addText('name', 'Název akce:')->setRequired('Vyplňte název akce');
     $form->addTextarea('text', 'Úvodní text lístečku:')->setRequired('Vyplňte text lístečku')->setAttribute('rows', 5);
     $form->addDynamic('event_meeting', function (Container $container) {
         $container->addText('comment', 'Typ srazu:');
         $container->addDateTimePicker('starttime', 'Datum a čas srazu:')->setRequired('Vyplňte čas srazu');
         $container->addText('startplace', 'Místo srazu:')->setRequired('Vyplňte místo srazu');
         $container->addDateTimePicker('endtime', 'Datum a čas návratu:')->setRequired('Vyplňte čas návratu');
         $container->addText('endplace', 'Místo návratu:')->setRequired('Vyplňte místo návratu');
         $container->addSubmit('remove', 'X')->setValidationScope(FALSE)->addRemoveOnClick();
         //intentional, delete after whole form submit
     }, 1)->addSubmit('add', 'Přidat sraz')->setValidationScope(FALSE)->addCreateOnClick(TRUE);
     $form->addTextarea('equipment', 'S sebou:')->setRequired('Vyplňte co si s sebou vzít na akci')->setAttribute('rows', 5);
     $form->addTextarea('morse', 'Morseovka:')->setAttribute('rows', 5);
     //contact person
     $contacts = $this->registrations->findBy(['member_nickname IS NOT NULL'])->fetchPairs('member_nickname', 'member_nickname');
     $form->addSelect('contactperson', 'Kontaktní osoba:', $contacts)->setRequired('Vyberte kontaktní osobu')->setPrompt('Kontaktní osoba');
     if ($this->user->isAllowed('Admin:Default:Event', 'show')) {
         $form->addCheckbox('showevent', 'Zobrazit lísteček')->setDefaultValue(TRUE);
     }
     $form->addSubmit('send', 'Změnit');
     $form->onSuccess[] = $this->editEventFormSucceded;
     return $form;
 }
 /**
  * Form for inputting information about the event to form chronicle
  * Can only be accessed by user with editing privileges and only in "edit" action
  *
  * @Privilege("edit")
  * @Action("edit")
  */
 protected function createComponentEditChronicleForm()
 {
     $form = new Form();
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addHidden('id');
     $form->addText('name', 'Název akce');
     $form->addTextarea('rangers', 'Vedení a roveři');
     $form->addTextarea('mloci', 'Mloci:');
     $form->addTextarea('tucnaci', 'Tučňáci:');
     $form->addTextarea('novacci', 'Nováčci:');
     $form->addTextarea('route', 'Trasa:');
     $form->addTextarea('content', 'Zápis do kroniky:');
     $writers = $this->members->findAll()->fetchPairs('nickname', 'nickname');
     $form->addSelect('chroniclewriter', 'Zapsal do kroniky:', $writers)->setRequired('Musíte vybrat, kdo zapsal akci do kroniky')->setPrompt('Vyberte člena');
     if ($this->user->isAllowed('Admin:Default:Chronicle', 'show')) {
         $form->addCheckbox('showchronicle', 'Zobrazit kroniku:')->setDefaultValue(TRUE);
     }
     $form->addSubmit('send', 'Upravit');
     $form->onSuccess[] = $this->editChronicleFormSucceded;
     return $form;
 }
 protected function createComponentReviewCommentForm()
 {
     $review = $this->courseRegistry->review;
     $viewerMadeSolution = $review->solution->user->id === $this->userInfo->id;
     $viewerWroteReview = $review->reviewed_by->id === $this->userInfo->id;
     if ($this->user->isAllowed('review', 'evaluateObjection') && !$viewerMadeSolution && $review->isObjected()) {
         $statuses = $this->getReviewCommentFormStatuses('objectionEvaluation');
     } elseif ($this->user->isAllowed('review', 'evaluateFix') && !$viewerMadeSolution && $review->isFixed()) {
         $statuses = $this->getReviewCommentFormStatuses('fixEvaluation');
     } elseif ($this->user->isAllowed('review', 'announceProblem') && !$viewerMadeSolution && $review->isOk()) {
         $statuses = $this->getReviewCommentFormStatuses('problemAnnouncing');
     } elseif ($review->isOk() && $viewerMadeSolution) {
         $statuses = $this->getReviewCommentFormStatuses('objectionRaisingOrCommenting');
     } elseif ($review->hasProblem() && $viewerWroteReview) {
         $statuses = $this->getReviewCommentFormStatuses('reviewFixing');
     } else {
         $statuses = $this->getReviewCommentFormStatuses($review->status);
     }
     $form = new Form();
     $form->addTextarea('comment', $this->translator->translate('messages.review.comments.label'));
     $form->addSelect('reviewStatus', $this->translator->translate('messages.review.status.title'), $statuses);
     $form->addSubmit('submit', $this->translator->translate('messages.review.comments.post'));
     $form->onSuccess[] = array($this, 'reviewCommentFormSucceeded');
     return $form;
 }
 /**
  * Form for organization member editation
  *
  * @Action("edit", "create")
  * @Privilege("edit", "create")
  */
 protected function createComponentOrganizationForm()
 {
     $form = new Form();
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $users = $this->users->getUnconnectedUsers()->fetchPairs('id', 'username');
     $form->addSelect('user_id', 'Uživatel:', $users)->setPrompt('Propojit s uživatelem');
     $form->addText('nickname', 'Přezdívka:')->setRequired('Musíte zadat přezdívku');
     $form->addText('title', 'Titul:')->setOption('description', \Nette\Utils\Html::el('td')->setText('Titul před jménem'));
     $form->addText('name', 'Křestní jméno:')->setRequired('Musíte zadat jméno');
     $form->addText('surname', 'Příjmení:')->setRequired('Musíte zadat příjmení');
     $form->addUpload('file', 'Profilová fotka:')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'Foto musí být JPEG, PNG nebo GIF.');
     $form->addText('group', 'Pozice:');
     $form->addSelect('stripe', 'Frčky:', ['vedouci.gif' => 'Vedoucí oddílu', 'zastupce.gif' => 'Zástupce vedoucího', 'radce_oddilu.gif' => 'Rádce oddílové družiny', 'rover.gif' => 'Rover', 'radce.gif' => 'Rádce', 'podradce.gif' => 'Podrádce'])->setPrompt('--Bez frček--')->setOption('description', \Nette\Utils\Html::el('td')->setText('Možnosti: Vedoucí oddílu, Zástupce vedoucího oddílu, Rover, Mlok, Tučňák, Nováček, Oldskaut, Rádce, Podrádce. Lze přidat více jak jednu možnost.'));
     $form->addDatePicker('entered', 'Vstup do oddílu:')->setRequired('Musíte vyplnit vstup do oddílu');
     $form->addTextarea('note', 'Osobní poznámka:')->setAttribute('rows', 4);
     $form->addSubmit('send', 'Přidat/Upravit');
     $form->onSuccess[] = $this->organizationFormSucceded;
     return $form;
 }