public function createComponentToolsForm() { $form = new \soundake\helpers\MyForm(); $form->setTranslator($this->presenter->translator); $form->addCheckbox('approved', 'Approved')->setDefaultValue(1); $form->addCheckbox('visible', 'Visible')->setDefaultValue(1); $form->addCheckbox('reviewed', 'Reviewed')->setDefaultValue(1); $form->addCheckbox('prefered', 'Prefered')->setDefaultValue(0); $form->addTextArea('notes', 'Notes'); $form->addSelect('user_id', 'Owner', $this->context->createServiceUsers()->fetchPairs('id', 'email'))->setPrompt('---')->setAttribute('class', 'input-xxlarge chzn'); $form->addSubmit('save', 'Save')->onClick[] = $this->saveEvent; $form->addHidden('id'); return $form; }
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; }
public function createComponentCategories() { $form = new \soundake\helpers\MyForm(); $form->renderStyle = 'bootstrap'; $form->getElementPrototype()->class('form-inline'); $form->setTranslator($this->translator); $categories = $this->context->createServiceCategories()->select('category.*, COUNT(DISTINCT :event_x_category.event_id) AS catCount')->where('category.visible', '1')->group('category.id')->having('COUNT(:event_x_category.category_id) > 0')->order('category.shift, category.name'); if ($this->shire != '') { $categories->where(':event_x_category.event.shire.code', $this->shire); } $cat = $form->addContainer('categories'); //$cat->addCheckbox('all', 'all')->setAttribute('onchange', 'submit()'); foreach ($categories as $category) { $cat->addCheckbox($category->id, $category->name)->setAttribute('onchange', 'submit()'); //->setOption('description', \Nette\Utils\Html::el("span")->class('help-inline')->setHtml("(" . $category->catCount . ")")); if (isset($this->categories[$category->id])) { $form['categories'][$category->id]->setValue($this->categories[$category->id]); } } $form->addHidden('blabla')->setValue(1); $form->onSuccess[] = array($this, 'setCategory'); return $form; }
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; }
protected function createComponentFileUploadForm() { $form = new \soundake\helpers\MyForm(); $form->renderStyle = 'bootstrap'; $form->setTranslator($this->translator); $form->getElementPrototype()->addAttributes(array('class' => 'form form-inline')); $form->addUpload("image", "Choose image(s)", true)->setRequired()->addRule(Form::IMAGE, "You can choose images only!")->addRule(Form::MAX_FILE_SIZE, 'File is too big! Please, choose smaller one. It could be 3 megs large.', 3 * 1024 * 1024)->setOption('description', \Nette\Utils\Html::el('div class="alert alert-info"')->setHtml('Minimální velikost obrázku <strong>440 x 440 px</strong>, maximální velikost souboru <strong>3 MB</strong>. Formát obrázků <strong>jpg</strong>, <strong>gif</strong> a <strong>png</strong>.')); $form->addHidden('event_id'); $form->addSubmit('send', 'Upload image(s)')->getControlPrototype()->class('btn btn-primary'); $form->addSubmit('cancel', 'Přeskočit nahrávání obrázků')->setValidationScope(FALSE)->onClick[] = array($this, 'cancelClicked'); $form['cancel']->getControlPrototype()->class('btn btn-grey btn-small'); $form->onSuccess[] = callback($this, 'fileUploadSuccess'); return $form; }
protected function createComponentTermsForm() { $form = new \soundake\helpers\MyForm(); $form->renderStyle = 'semantic'; $form->setTranslator($this->translator); $form->getElementPrototype()->addAttributes(array('class' => '')); $terms = $form->addDynamic('terms', function (Container $term) { $term->addHidden('time_id'); $term->addDatepicker('date_from', 'Datum počátku')->setAttribute('class', 'form_date')->setAttribute('novalidate')->addRule(Form::FILLED, 'Date is required')->setRequired(); $term->addTimePicker('time_from', 'Čas začátku (např. 12:00)')->setAttribute('class', 'form_time'); $term->addDatepicker('date_to', 'Datum konce')->setAttribute('class', 'form_date'); $term->addTimePicker('time_to', 'Čas konce')->setAttribute('class', 'form_time'); $term->addCheckbox('visible', 'Viditelné v přehledech akcí na PeknyDen.cz')->setValue(TRUE); $term->addSubmit('remove', 'Smazat')->setValidationScope(FALSE)->addRemoveOnClick(function (\Kdyby\Replicator\Container $replicator, Container $term) { })->getControlPrototype()->class('btn'); $term->addCheckbox('repeat', 'Opakující se akce - v daném období se koná pravidelně každý týden v těchto dnech:')->setDefaultValue(FALSE)->addCondition(Form::EQUAL, TRUE)->toggle("every"); $term->addCheckbox('every_monday', 'pondělí'); $term->addCheckbox('every_tuesday', 'úterý'); $term->addCheckbox('every_wednesday', 'středa'); $term->addCheckbox('every_thursday', 'čtvrtek'); $term->addCheckbox('every_friday', 'pátek'); $term->addCheckbox('every_saturday', 'sobota'); $term->addCheckbox('every_sunday', 'neděle'); }, 1); $terms->addSubmit('add', 'Přidej další termín akce')->setValidationScope(FALSE)->addCreateOnClick(TRUE, function (\Kdyby\Replicator\Container $replicator, Container $term) { })->getControlPrototype(); $form->addHidden('event_id'); if ($this->user->isInRole('administrator')) { $form->addCheckbox('forceRegenerate', 'Přegeneruj všechny termíny'); } $form->addSubmit('save', 'Uložit termíny a přejít na fotky')->setAttribute('class', 'large green')->onClick[] = $this->saveTerms; $form->addSubmit('send', 'Uložit termíny')->onClick[] = $this->saveTerms; $form->addSubmit('sendBack', 'Uložit a zpět na akci')->onClick[] = $this->saveTerms; $form->addSubmit('saveAndJump', 'Uložit termíny a přeskočit ke kontrole')->onClick[] = $this->saveTerms; return $form; }