/** * 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; }