Example #1
0
 public function createComponentContentForm()
 {
     $form = new BaseForm();
     $form->addHidden("id");
     $form->addHidden("userId")->setDefaultValue($this->getUser()->id);
     $form->addText("sectionId", "Sekce")->setDefaultValue($this->sectionId);
     $form->addText("title", "Název")->setRequired();
     $form->addText("author", "Autor");
     $form->addText("pageTitle", "Název stránky");
     $form->addText("anotation", "Krátký text");
     $form->addTextArea("text", "Dlouhý text")->setAttribute('class', 'wysiwyg');
     $form->addDateTimePicker("activeFrom", "Aktivní od:")->setDefaultValue(date('Y-m-d G:i', time()));
     $form->addDateTimePicker("activeUntil", "Aktivní do:");
     $form->addCheckbox("isDraft", "Draft")->setDefaultValue(1);
     $form->addCheckbox("isNews", "Novinka");
     $form->addCheckbox("isSticky", "Sticky bit");
     if ($this->user->getIdentity()->roleId == 1 || $this->user->getIdentity()->roleId == 2) {
         $form->addText("routeUrl", "Routa");
     }
     $form->addSubmit("save", "Uložit");
     $form->onSuccess[] = $this->contentFormSucceeded;
     return $form;
 }