Example #1
0
 public function createComponentForm()
 {
     $form = new \soundake\helpers\MyForm();
     $form->setTranslator($this->translator);
     $form->renderStyle = 'bootstrap';
     $form->addText('name', 'Event name')->setAttribute('class', 'input-xxlarge')->setOption('description', 'Název vaší akce. Ideální je kompletní název. Nepřidávejte žádné další údaje.')->setRequired('Prosím, vyplňte název akce.');
     $form->addTextArea('description', 'Event description', null, 10)->setAttribute('class', 'input-xxlarge')->setRequired('Prosím, popište o čem vaše akce je.');
     $form->addMultiSelect('categories', 'Categories', $this->context->createServiceCategories()->where('event', '1')->fetchPairs('id', 'name'))->setAttribute('class', 'input-xxlarge chzn')->setAttribute('placeholder', 'Prosím, vyberte kategorii')->setAttribute('data-placeholder', 'Prosím, vyberte kategorii')->setOption('description', 'Kategorie pomáhá uživatelům ve vyhledání vaší akce. Vyberte minálně jednu. Doporučujeme max. 3.')->setRequired('Kategorie musí být vyplněna, prosím vyberte minimálně jednu kategorii.');
     $form->addTextArea('notes', 'Times and Notes', null, 5)->setAttribute('class', 'input-xxlarge')->setOption('description', 'Zde vložte informaci, ve kterých dnech se akce koná, otevírací dobu a případné další poznámky k akci.')->setRequired('Prosím, doplňte datum konání či jiné poznámky.');
     $form->addText('subject_name', 'Event place')->setAttribute('class', 'input-xxlarge')->setRequired('Prosím, doplňte místo konání akce');
     $form->addText('subject_street', 'Street')->setAttribute('class', 'input-xxlarge');
     $form->addText('subject_city', 'City or village')->setAttribute('class', 'input-xxlarge');
     $form->addText('subject_zip', 'Zip')->setAttribute('class', 'input-xxlarge');
     $form->addSelect('shire_id', 'Shire', $this->context->createServiceShires()->fetchPairs('id', 'name'))->setAttribute('class', 'input-xxlarge')->setRequired('Prosím, doplňte prosím kraj, kde se akce koná');
     $form->addText('subject_gps', 'GPS')->setAttribute('class', 'input-xxlarge')->setOption('description', \Nette\Utils\Html::el('span')->addAttributes(array('class' => 'help-inline'))->setHtml('GPS souřadnice konání místa ve tvaru 50°3\'44.151"N, 14°26\'10.500"E (zjistíte např. na <a target="_blank" href="http://mapy.cz/">http://mapy.cz/</a>).'));
     $form->addText('subject_www', 'Web')->setAttribute('class', 'input-xxlarge');
     $form->addText('subject_email', 'E-mail')->setAttribute('class', 'input-xxlarge')->addCondition(Form::FILLED)->addRule(Form::EMAIL, 'E-mailová adresa nemá správný tvar. Zkonttrolujte prosím její zadání.');
     $form->addText('subject_phone', 'Phone number')->setAttribute('class', 'input-xxlarge');
     $form->addText('contact_email', 'Contact e-mail')->setRequired('Nechte nám prosím vaši kontaktní e-mailovou adresu.')->setAttribute('class', 'input-xxlarge')->setOption('description', 'Kontaktní e-mail pro případné doplnění informací a zaslání potvrzení o zveřejnění akce (nezveřejňuje se na PeknyDen.cz).')->addRule(Form::EMAIL, 'E-mailová adresa nemá správný tvar. Zkonttrolujte prosím její zadání.');
     $form->addCheckbox('agree', \Nette\Utils\Html::el()->setHtml('Souhlasím s <a href="/files/PD_podminky_pouzivani_2013.pdf" target="_blank">podmínkami používání PeknyDen.cz</a>.'))->setRequired('Pro všechny akce je nutné souhlas s podmínkami.');
     $form->addSubmit('save', 'Save')->setAttribute('class', 'btn btn-primary');
     $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->setAttribute('class', 'btn btn-grey btn-link');
     $form->onSuccess[] = callback($this, 'saveEvent');
     return $form;
 }
Example #2
0
 public function createComponentToolsForm()
 {
     $form = new \soundake\helpers\MyForm();
     $form->setTranslator($this->presenter->translator);
     $form->addCheckbox('visible', 'Visible')->setDefaultValue(1);
     $form->addCheckbox('approved', 'Approved')->setDefaultValue(1);
     $form->addCheckbox('reviewed', 'Reviewed')->setDefaultValue(1);
     $form->addCheckbox('show_in_catalogue', 'Show in catalogue')->setDefaultValue(1);
     $form->addCheckbox('show_in_calendar', 'Show in calendar')->setDefaultValue(1);
     $form->addCheckbox('ad', 'Recommended');
     $form->addCheckbox('ad_onhomepage', 'On homepage');
     $form->addText('ad_name', 'Alternative name (40 chars)');
     $form->addText('ad_description', 'Alternative description');
     $categories = new \Model\Categories('admintools');
     $form->addSelect('ad_category', 'Only in category', $categories->getGlobalCategoriesArray('subject', null, false))->setPrompt('---')->setAttribute('class', 'input-xxlarge chzn');
     $form->addSelect('ad_shire', 'Only in shire', $this->context->createServiceShires()->fetchPairs('id', 'name'))->setPrompt('---')->setAttribute('class', 'input-xxlarge chzn');
     $form->addSelect('user_id', 'Owner', $this->context->createServiceUsers()->fetchPairs('id', 'email'))->setPrompt('---')->setAttribute('class', 'input-xxlarge chzn');
     $form->addSubmit('save', 'Save')->onClick[] = $this->savePlace;
     $form->addHidden('id');
     return $form;
 }
Example #3
0
 public function createComponentRegenerateForm()
 {
     $form = new \soundake\helpers\MyForm();
     $form->setTranslator($this->translator);
     $renderer = $form->getRenderer();
     $renderer->wrappers['error']['container'] = 'ul class="alert alert-error"';
     $form->addText('username', 'Username')->setAttribute('readonly', 'readonly');
     $form->addText('password', 'New password')->setRequired('Password must be filled.');
     $form->addHidden('hash');
     $form->addHidden('id');
     $form->addSubmit('save', 'Set up new password')->getControlPrototype()->class('btn btn-primary');
     $form->onSuccess[] = array($this, 'regeneratePassword');
     return $form;
 }