/** * Edit event */ function createComponentEditEventForm() { $page = $this->database->table("pages")->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->addHidden('event_id'); $form->addText('date_event', 'dictionary.main.DateEventStarted')->setAttribute("class", "form-control datepicker")->setAttribute("style", "width: 110px; display: inline;")->setHtmlId("event_start"); $form->addSelect("hour_event")->setAttribute("class", "form-control text-right")->setAttribute("style", "width: 80px; display: inline;")->setHtmlId("event_hour")->setTranslator(null); $form->addSelect("minute_event")->setAttribute("class", "form-control text-right")->setAttribute("style", "width: 80px; display: inline;")->setHtmlId("event_minute")->setTranslator(null); $form->addText('date_event_end', 'dictionary.main.DateEventEnded')->setAttribute("class", "form-control datepicker")->setAttribute("style", "width: 110px; display: inline;")->setHtmlId("event_end_date"); $form->addSelect("hour_event_end")->setAttribute("class", "form-control text-right")->setAttribute("style", "width: 80px; display: inline;")->setHtmlId("event_end_hour")->setTranslator(null); $form->addSelect("minute_event_end")->setAttribute("class", "form-control text-right")->setAttribute("style", "width: 80px; display: inline;")->setHtmlId("event_end_minute")->setTranslator(null); $form->addText('price', 'dictionary.main.Price')->setAttribute("class", "form-control"); $form->addText('contact', 'dictionary.main.Place')->setAttribute("class", "form-control"); $form->addText('time_range', 'Rozsah')->setAttribute("class", "form-control"); $form->addCheckbox("allday", "dictionary.main.AllDayEvent"); $form->addText('capacity', 'Kapacita')->setAttribute("class", "form-control"); $form->addText('capacity_start', 'Kapacita (přidat)')->setAttribute("class", "form-control"); $form->addSubmit('submitm', 'dictionary.main.Save')->setAttribute("class", "btn btn-success btn"); $form->setDefaults(array("id" => $page->id)); $form->onSuccess[] = $this->editEventFormSucceeded; return $form; }
/** * Insert event */ function createComponentInsertEventForm() { $hours = array("00" => "00", "01" => "01", "02" => "02", "03" => "03", "04" => "04", "05" => "05", "06" => "06", "07" => "07", "08" => "08", "09" => "09", "10" => "10", "11" => "11", "12" => "12", "13" => "13", "14" => "14", "15" => "15", "16" => "16", "17" => "17", "18" => "18", "19" => "19", "20" => "20", "21" => "21", "22" => "22", "23" => "23"); $minutes = array("00" => "00", "05" => "05", "10" => "10", "15" => "15", "20" => "20", "25" => "25", "30" => "30", "40" => "40", "45" => "45", "50" => "50", "55" => "55"); $contacts = $this->database->table("contacts")->where("categories_id", 22)->fetchPairs('id', 'company'); $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->addHidden('event_id'); $form->addText('date_event', 'dictionary.main.DateEventStarted')->setAttribute("class", "form-control datepicker")->setHtmlId("event_start"); $form->addSelect("hour_event", "", $hours)->setAttribute("class", "form-control text-right")->setHtmlId("event_hour")->setTranslator(null); $form->addSelect("minute_event", "", $minutes)->setAttribute("class", "form-control text-right")->setHtmlId("event_minute")->setTranslator(null); $form->addText('date_event_end', 'dictionary.main.DateEventEnded')->setAttribute("class", "form-control datepicker")->setHtmlId("event_end_date"); $form->addSelect("hour_event_end", "", $hours)->setAttribute("class", "form-control text-right")->setHtmlId("event_end_hour")->setTranslator(null); $form->addSelect("minute_event_end", "", $minutes)->setAttribute("class", "form-control text-right")->setHtmlId("event_end_minute")->setTranslator(null); $form->addText('price', 'dictionary.main.Price')->setAttribute("class", "form-control"); $form->addSelect('contact', 'dictionary.main.Place', $contacts)->setAttribute("class", "form-control"); $form->addText('time_range', 'Rozsah')->setAttribute("class", "form-control"); $form->addText('capacity', 'Kapacita')->setAttribute("class", "form-control"); $form->addText('capacity_start', 'Kapacita (přidat)')->setAttribute("class", "form-control"); $form->addCheckbox("allday", "dictionary.main.AllDayEvent"); $form->setDefaults(array("event_id" => $this->presenter->getParameter("id"), "capacity_start" => 0)); $form->addSubmit('submitm', 'dictionary.main.Save')->setAttribute("class", "btn btn-success btn"); $form->onSuccess[] = $this->insertEventFormSucceeded; return $form; }
public function createComponentSignUpForm() { $form = new \Nette\Forms\BootstrapUIForm(); $form->setTranslator($this->presenter->translator); $form->getElementPrototype()->class = "form-horizontal"; $form->getElementPrototype()->role = 'form'; $form->getElementPrototype()->autocomplete = 'off'; $form->addGroup("Uživatelské informace"); $form->addText("email", "E-mail")->addRule(\Nette\Forms\Form::EMAIL, 'Zadejte platný email.')->setRequired('Vložte e-mail.'); $form->addText("username", "Uživatelské jméno")->setOption('description', (string) "Povoleny jsou pouze znaky a-z, 0-9 (pouze malá písmena)")->setRequired('Zvolte si uživatelské jméno')->addRule(\Nette\Forms\Form::PATTERN, 'Uživatelské jméno může obsahovat pouze znaky a-z, 0-9 (pouze malá písmena)', '[a-z0-9-]+')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zvolte uživatelské jméno s alespoň %d znaky', 5)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zvolte uživatelské jméno s nejvýše %d znaky', 40); if ($this->presenter->template->settings['members:groups:enabled']) { $groups = $this->database->table("categories")->where("parent_id", $this->presenter->template->settings['members:group:categoryId'])->fetchPairs("id", "title"); $form->addSelect("group", "Skupina", $groups)->setAttribute("class", "form-control"); } $form->addPassword("pwd", "dictionary.main.Password")->setOption('description', (string) "6 - 40 znaků")->setRequired('Zvolte si heslo')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zvolte heslo s alespoň %d znaky', 6)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zvolte heslo s nejvýše %d znaky', 40); $form->addPassword("pwd2", "Zopakovat heslo")->setRequired('Zadejte prosím heslo ještě jednou pro kontrolu')->addRule(\Nette\Forms\Form::EQUAL, 'Hesla se neshodují', $form['pwd']); if ($this->presenter->template->settings['members:signup:contactEnabled']) { $form->addGroup("Kontaktní údaje"); $form->addText("name", "Jméno a příjmení")->setRequired('Zadejte jméno')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zadejte jméno', 3)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zadejte jméno', 200); $form->addText("street", "dictionary.main.Street")->setRequired('Zadejte ulici')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zadejte ulici', 3)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zadejte ulici', 200)->setAttribute("class", "smartform-street-and-number"); $form->addText("zip", "PSČ")->setRequired('Zadejte PSČ')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zadejte PSČ', 3)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zadejte PSČ', 20)->setAttribute("class", "smartform-city"); $form->addText("city", "Město")->setRequired('Zadejte město')->addRule(\Nette\Forms\Form::MIN_LENGTH, 'Zadejte město', 1)->addRule(\Nette\Forms\Form::MAX_LENGTH, 'Zadejte město', 80)->setAttribute("class", "smartform-zip"); } if ($this->presenter->template->settings['members:signup:contactEnabled']) { $form->addGroup("Firemní informace"); $form->addText("company", "dictionary.main.Company"); $form->addText("vatin", "dictionary.main.VatIn"); $form->addText("vatid", "dictionary.main.VatId"); } $form->addCheckbox("newsletter", " " . "Chci odebírat zprávy?")->setDefaultValue(TRUE); $form->addCheckbox("confirmation", " " . "Souhlasím s podmínkami")->setRequired('Pro pokračování zaškrtněte Souhlasím s podmínkami'); $form->setDefaults(array("username" => $this->presenter->getParameter("user"), "email" => $this->presenter->getParameter("email"), "newsletter" => $this->presenter->getParameter("newsletter"), "name" => $this->presenter->getParameter("name"), "street" => $this->presenter->getParameter("street"), "city" => $this->presenter->getParameter("city"), "zip" => $this->presenter->getParameter("zip"))); $form->addSubmit("submit", "Registrovat se")->setAttribute("class", "btn-lg btn-cart-in"); $form->setDefaults(array("email" => $this->getParameter("email"), "username" => $this->getParameter("username"), "newsletter" => $this->getParameter("newsletter"))); $form->onSuccess[] = $this->signUpFormSucceeded; $form->onValidate[] = $this->signUpFormValidated; return $form; }
/** * Send member login information */ function createComponentSendLoginForm() { $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("contact_id"); $form->addCheckbox("sendmail", " " . "Odeslat e-mail s přihlašovacími informacemi")->setValue(0); $form->setDefaults(array("contact_id" => $this->presenter->getParameter('id'))); $form->addSubmit('submitm', 'Zaslat uživateli')->setAttribute("class", "btn btn-success"); $form->onSuccess[] = $this->sendLoginFormSucceeded; 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 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("image")); $form->addHidden("image_id"); $form->addHidden("page_id"); $form->addHidden("name"); $form->addCheckbox("detail_view", " Zobrazovat v galerii produktů"); $form->addTextarea("description", "dictionary.main.Description")->setAttribute("class", "form-control"); $form->addSubmit('send', 'dictionary.main.Save'); $form->setDefaults(array("image_id" => $this->presenter->getParameter("image"), "page_id" => $this->presenter->getParameter("id"), "name" => $this->presenter->getParameter("name"), "detail_view" => $image->detail_view, "description" => $image->description)); $form->onSuccess[] = $this->editFormSucceeded; return $form; }
/** * Edit category */ protected function createComponentEditForm() { $carousel = $this->database->table("carousel")->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('carousel_id'); $form->addText('title', 'dictionary.main.Title'); $form->addTextArea('description', 'dictionary.main.Description')->setAttribute("class", "form-control")->setAttribute("style", "max-height: 150px;"); $form->addText('uri', 'dictionary.main.URL'); $form->addCheckbox("visible", "dictionary.main.Show"); $form->addUpload('the_file', 'dictionary.main.Icon'); $form->addSubmit('submitm', 'dictionary.main.Save'); $arr = array("carousel_id" => $carousel->id, "title" => $carousel->title, "description" => $carousel->description, "visible" => $carousel->visible, "uri" => $carousel->uri); $form->setDefaults(array_filter($arr)); $form->onSuccess[] = $this->editFormSucceeded; return $form; }