/** * Image Upload */ function createComponentUploadForm() { $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->class = "form-horizontal"; $form->getElementPrototype()->role = 'form'; $form->getElementPrototype()->autocomplete = 'off'; $imageTypes = array('image/png', 'image/jpeg', 'image/jpg', 'image/gif'); $form->addHidden("id"); $form->addUpload('the_file', 'dictionary.main.InsertImage')->addRule(\Nette\Forms\Form::MIME_TYPE, 'messages.error.invalidTypeOfMessage', $imageTypes); $form->addTextarea("description", "dictionary.main.Description")->setAttribute("class", "form-control"); $form->addSubmit('send', 'dictionary.main.Image'); $form->setDefaults(array("id" => $this->presenter->getParameter("id"))); $form->onSuccess[] = $this->uploadFormSucceeded; return $form; }
/** * Edit file information */ function createComponentEditForm() { $image = $this->database->table("media")->get($this->presenter->getParameter("id")); $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->class = "form-horizontal"; $form->getElementPrototype()->role = 'form'; $form->getElementPrototype()->autocomplete = 'off'; $form->addHidden('id'); $form->addText('title', 'dictionary.main.Title'); $form->addTextarea('description', "dictionary.main.Description")->setAttribute("style", "height: 200px;")->setAttribute("class", "form-control"); $form->setDefaults(array("id" => $image->id, "title" => $image->title, "description" => $image->description)); $form->addSubmit('send', 'dictionary.main.Save'); $form->onSuccess[] = $this->editFormSucceeded; return $form; }
/** * Image Upload */ function createComponentEditForm() { $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->class = "form-horizontal"; $form->getElementPrototype()->role = 'form'; $form->getElementPrototype()->autocomplete = 'off'; $imageTypes = array('image/png', 'image/jpeg', 'image/jpg', 'image/gif'); $image = $this->database->table("media")->get($this->presenter->getParameter("name")); $form->addHidden("id"); $form->addHidden("name"); $form->addTextarea("description", "dictionary.main.Description")->setAttribute("class", "form-control"); $form->addSubmit('send', 'dictionary.main.Insert'); $form->setDefaults(array("id" => $this->presenter->getParameter("id"), "name" => $this->presenter->getParameter("name"), "description" => $image->description)); $form->onSuccess[] = $this->editFormSucceeded; return $form; }
/** * Edit helpdesk */ function createComponentEditForm() { $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->class = "form-horizontal"; $form->getElementPrototype()->role = 'form'; $form->getElementPrototype()->autocomplete = 'off'; $form->addHidden("helpdesk_id"); $form->addText("title", "dictionary.main.Title"); $form->addTextarea("description", "dictionary.main.Description")->setAttribute("class", "form-control")->setAttribute("style", "height: 200px;"); $form->addCheckbox("fill_phone"); $helpdesk = $this->database->table("helpdesk")->get($this->presenter->getParameter("id")); $form->setDefaults(array("helpdesk_id" => $helpdesk->id, "title" => $helpdesk->title, "description" => $helpdesk->description, "fill_phone" => $helpdesk->fill_phone)); $form->addSubmit("submitm", "dictionary.main.Save"); $form->onSuccess[] = $this->editFormSucceeded; return $form; }
function createComponentInsertForm() { $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->class = "form-horizontal"; $form->getElementPrototype()->role = 'form'; $form->getElementPrototype()->autocomplete = 'off'; $form->addHidden('category'); $form->addHidden('type'); $form->addText('title', 'dictionary.main.Title'); $form->addTextarea("preview", "dictionary.main.Description")->setAttribute("class", "form-control"); if ($this->presenter->getParameter("type") == 6 && $this->presenter->getParameter('id') == false) { $category = 4; } elseif ($this->presenter->getParameter("type") == 8 && $this->presenter->getParameter('id') == false) { $category = 6; } else { $category = $this->presenter->getParameter('id'); } $form->setDefaults(array("category" => $category, "type" => $this->presenter->getParameter("type"))); $form->addSubmit('submitm', 'dictionary.main.Insert'); $form->onSuccess[] = $this->insertFormSucceeded; return $form; }
/** * Edit category */ protected function createComponentEditForm() { $pages = new \App\Model\Page($this->database); $categoryAll = new \App\Model\Menu($this->database); $category = $this->database->table("menu")->get($this->presenter->getParameter("id")); $categories = $categoryAll->getAll(); unset($categories[$category->id]); $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->class = "form-horizontal"; $form->getElementPrototype()->role = 'form'; $form->getElementPrototype()->autocomplete = 'off'; $form->addHidden('id'); $form->addText('title', 'dictionary.main.Title'); $form->addTextarea('description', 'dictionary.main.Description')->setAttribute("class", "form-control"); $form->addSelect('parent', 'Nadřazená kategorie', $categories)->setPrompt('admin.categories.NothingRelated')->setAttribute("class", "form-control"); $form->addSelect('page', 'admin.categories.SelectPage', $pages->getPageList())->setPrompt('admin.categories.PageSelectedManually')->setAttribute("class", "form-control"); $form->addText('url', 'dictionary.main.URL'); $form->addSubmit('submitm', 'dictionary.main.Save'); $arr = array("id" => $category->id, "title" => $category->title, "description" => $category->description, "page" => $category->pages_id, "parent" => $category->parent_id, "url" => $category->url); $form->setDefaults(array_filter($arr)); $form->onSuccess[] = $this->editFormSucceeded; return $form; }