public function create() { $form = new \Natsu\Forms\BaseForm(); $form->addHidden("id"); $form->addHidden("contentId")->setDefaultValue($this->contentId); $form->addSelect("componentId", "Komponenta")->setItems($this->components)->setRequired(); $form->addText("params", "Parametry"); $form->addSubmit("save", "Uložit"); $form->onSuccess[] = array($this, 'formSucceeded'); if ($this->contentComponent) { $form->setDefaults($this->contentComponent); } return $form; }
public function create() { $form = new \Natsu\Forms\BaseForm(); $form->addHidden("id")->setDefaultValue("0"); $form->addHidden("contentId")->setDefaultValue($this->contentId); $form->addSelect("mime", "Typ", array("IMAGE" => "OBRAZEK (ALESPON 640x480)", "HEADIMAGE" => "HLAVNI OBRAZEK (100x700)", "YOUTUBE" => "YOUTUBE ODKAZ")); $form->addUpload("file", "Soubor (Pro typ obrázek:)"); $form->addText("title", "Název"); $form->addText("url", "Odkaz"); $form->addSubmit("save", "Uložit"); $form->onSuccess[] = array($this, 'formSucceeded'); if ($this->attachment) { $form->setDefaults($this->attachment); } return $form; }
/** * @return BaseForm */ public function create() { // echo $this->code; exit; $form = new \Natsu\Forms\BaseForm(); $form->addHidden("code", $this->code); $form->addPassword('password', 'Heslo:')->setRequired('Zadej nové heslo.'); $form->addPassword('confirm_password', 'Potvrzení hesla:')->setRequired('Zadej nové heslo znovu.'); $form->addSubmit('send', 'Uložit nové heslo'); $form->onSuccess[] = array($this, 'formSucceeded'); return $form; }
/** * @return BaseForm */ public function createAdmin() { $form = new \Natsu\Forms\BaseForm(); $form->addHidden("userId")->setDefaultValue($this->userId); $form->addSelect("roleId", "Role")->setItems(\Natsu\Model\PermissionModel::getRoleIds()); $form->addSelect("statusId", "Status")->setItems(\Natsu\Model\PermissionModel::getStatusIds()); $form->addText('fullname', 'Celé jméno:')->setRequired('Zadejte jméno a přijmení'); $form->addText('nickname', 'Přezdívka:'); $form->addText('email', 'E-mailová adresa:')->setRequired("Zadejte e-mailovou adresu"); $form->addText('phone', 'Telefon:'); $form->addText('skype', 'Skype:'); $form->addText('FB', 'Facebook:'); $form->addText('age', 'Věk:'); $details = $this->userManager->getAccount($this->userId); $form->setDefaults($details); $form->addSubmit('submit', 'Změnit'); $form->onSuccess[] = array($this, 'formAdminSucceeded'); return $form; }
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; }
public function createComponentForm() { $form = new BaseForm(); $form->getElementPrototype()->addAttributes(['class' => 'program-edit-form', 'enctype' => 'multipart/form-data', 'id' => null]); $form->addText('contentTitle', 'Název')->setRequired(); $form->addSelect('typeId', 'Druh programu', $this->programModel->getTypesPairs()); $form->addSelect('genreId', 'Sekce', $this->programModel->getGenresPairs()); $form->addSelect('roomId', 'Místnost', $this->programModel->getRoomsPairs('1,2,3,4,5')); $form->addText('author', 'Autor'); $form->addCheckbox('isSticky', 'Zobrazit na Homepage (pokud má obrázek)')->setDefaultValue(FALSE); $form->addTextArea('contentText', 'Anotace')->setAttribute('class', 'wysiwyg'); //anotace $timeFromInput = $form->addText('timeFrom', 'Začátek'); $timeFromInput->getControlPrototype()->addAttributes(['class' => 'js-period-start', 'data' => ['timeFrom' => $this->timeFrom->format('Y-m-d H:i:s')]]); $timeFromInput->setDefaultValue($this->timeFrom->format('Y-m-d H:i:s')); $timeToInput = $form->addText('timeTo', 'Konec'); $timeToInput->getControlPrototype()->addAttributes(['class' => 'js-period-end', 'data' => ['timeTo' => $this->timeTo->format('Y-m-d H:i:s')]]); $timeToInput->setDefaultValue($this->timeTo->format('Y-m-d H:i:s')); $form->addCheckbox('isDraft', 'Draft')->setDefaultValue(TRUE); $form->addSubmit('submit', 'Odeslat')->getControlPrototype()->addAttributes(['class' => 'btn']); $form->addHidden('id', NULL); $form->getElementPrototype()->class = $form->getElementPrototype()->class . ' js-program-edit-form'; if ($this->programId) { $formDefaults = $this->getFormDefaults(); $form->setDefaults($formDefaults); $form->getComponent('id')->setValue($this->programId); } $form->onValidate[] = callback($this, 'formValidate'); $form->onSuccess[] = callback($this, 'formSuccessful'); return $form; }