/**
  * @return Form
  */
 public function create($kat = null, $page = null, $id_user = null)
 {
     // nastaveni paginatoru
     $paginator = new Nette\Utils\Paginator();
     $paginator->setItemsPerPage(6);
     // def počtu položek na stránce
     $paginator->setPage($page);
     // def stranky
     // selekce upozorneni
     $alerts = $this->database->findAll('alert')->where('id_user', $id_user);
     if ($kat == 'read') {
         // prectene
         $alerts = $alerts->where('visited', 1);
     } else {
         // neprectene
         $alerts = $alerts->where('visited', 0);
     }
     $alerts = $alerts->order('added DESC')->order('id DESC');
     // prideleni produktu na stranku
     $paginator->setItemCount($alerts->count('*'));
     $this->alerts = $alerts->limit($paginator->getLength(), $paginator->getOffset());
     $this->kat = $kat;
     // form
     $form = new Form();
     $form->getElementPrototype()->class('ajax form');
     foreach ($this->alerts as $alert) {
         $form->addCheckbox($alert->id);
     }
     $form->addSubmit('btndel', 'Smazat upozornění')->setAttribute('class', 'btn btn-primary');
     $form->addSubmit('btnvis', 'Označit jako přečtené')->setAttribute('class', 'btn btn-default');
     $form->onSuccess[] = array($this, 'formSucceeded');
     $form->onError[] = array($this, 'formNotSucceeded');
     return $form;
 }
Example #2
0
 /**
  * LogIn-in form factory.
  * @return Nette\Application\UI\Form
  */
 protected function createComponentLogInForm()
 {
     $form = new Nette\Application\UI\Form();
     $form->setTranslator($this->translator->domain('ui'));
     $form->addText('username', 'login-username')->setRequired('please-enter-your-username')->setAttribute('autofocus');
     $form->addPassword('password', 'login-password')->setRequired('');
     $form->addCheckbox('remember', 'keep-me-signed-in');
     $form->addSubmit('send', 'log-in');
     $form->onSuccess[] = $this->logInFormSucceeded;
     // setup form rendering for Twitter Bootstrap
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = 'div class=col-sm-3';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-3 control-label"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     // make form and controls compatible with Twitter Bootstrap
     $form->getElementPrototype()->class('form-horizontal');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     return $form;
 }
 /**
  * @return Form
  */
 public function create($role)
 {
     $rights = $this->database->table('rights')->fetchPairs('id', 'name');
     $form = new Form();
     $form->addHidden('id');
     $form->addText('username', 'uživatelské jméno: ')->addRule(Form::FILLED, 'Zadejte prosím jméno.');
     $form->addText('email', 'email: ')->addRule(Form::FILLED, 'Zadejte prosím email.')->addRule(Form::EMAIL, 'Email by měl mít platný formát');
     if (in_array("admin", $role)) {
         // editace prav jen adminem
         $form->addSelect('rights_id', 'level práv: ', $rights);
     }
     $form->addSubmit('submit', 'uložit');
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     //bootstrap vzhled
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = '';
     $renderer->wrappers['label']['container'] = 'div class="control-label col-sm-5"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $form->getElementPrototype()->class('form-horizontal col-sm-12');
     return $form;
 }
Example #4
0
 /**
  * Register form factory.
  * @return UI\Form
  */
 protected function createComponentSignUpForm()
 {
     $form = new UI\Form();
     $form->setTranslator($this->translator->domain('ui'));
     // 1. Antispam
     $form->addText(self::SPAM1)->setAttribute('style', 'display:none')->addRule(UI\Form::BLANK, 'this-field-should-be-blank');
     // 2. Antispam
     $form->addText(self::SPAM2, self::SPAM2)->setHtmlId('frm-signUpForm-antispam')->setAttribute('data-spam', self::SPAM2)->setRequired(self::SPAM2)->addRule(UI\Form::EQUAL, self::SPAM2, self::SPAM2);
     $form->addText('email2', 'your-email')->setType('email')->setAttribute('placeholder', 'e-g-email-example-com')->addRule(UI\Form::EMAIL, 'please-enter-your-a-valid-email-address-check-for-typos')->setRequired('please-enter-your-a-valid-email-address-check-for-typos')->setAttribute('autofocus');
     $form->addText('fullname', 'how-do-you-want-to-be-called')->setAttribute('placeholder', 'placeholder-fullname')->setRequired('please-choose-how-do-you-want-to-be-called-on-the-web');
     $form->addText('username', 'login-username')->setAttribute('placeholder', 'placeholder-username')->setRequired('please-choose-your-login-username');
     $form->addPassword('password', 'login-password')->setAttribute('placeholder', 'placeholder-password')->setRequired('please-choose-your-login-password')->addRule(UI\Form::MIN_LENGTH, 'please-enter-at-least-d-characters-for-your-password', 8);
     $form->addPassword('passwordVerify', 'confirm-password')->setAttribute('placeholder', 'placeholder-password')->setRequired('please-confirm-your-login-password')->addRule(UI\Form::EQUAL, 'please-check-your-different-password', $form['password']);
     $form->addSubmit('send', 'register');
     $form->onSuccess[] = $this->signUpFormSucceeded;
     $form->getElementPrototype()->role('form');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     return $form;
 }
 /**
  * Contact form
  */
 protected function createComponentContactForm()
 {
     // vytvoříme element
     $products = array('Zakladni' => 'Základní', 'Pokrocile' => 'Pokročilé', 'NaMiru' => 'Na Míru', 'Ostatni' => 'Ostatní');
     $form = new Form();
     $form->addText('name', 'Jméno ')->addRule(Form::FILLED, 'Zadejte jméno');
     $form->addSelect('product', 'Produkt:', $products)->setRequired()->setDefaultValue('Zakladni');
     $form->addText('phone', 'Telefon ');
     $form->addText('email', 'Email')->addRule(Form::FILLED, 'Zadejte email')->addRule(Form::EMAIL, 'Email nemá správný formát');
     $form->addTextarea('message', 'Zpráva', 999, 5)->addRule(Form::FILLED, 'Zadejte zprávu');
     $form->addSubmit('send', 'Odeslat');
     // setup form rendering
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = 'div class=col-sm-12';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-12  text-center"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     // make form and controls compatible with Twitter Bootstrap
     $form->getElementPrototype()->class('form-horizontal');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-green btn-block btn-lg' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     $form->onSuccess[] = $this->processContactForm;
     return $form;
 }
 public function create()
 {
     $form = new Form();
     $form->addText('workStart', 'Začátek', 3, 5)->setRequired('Vyplňte pole "Začátek prac. doby".')->setDefaultValue($this->defaultItemTime['workStart'])->setHtmlId('workStart')->setAttribute('class', 'input-time')->addRule(Form::PATTERN, 'Do pole "Začátek prac. doby" lze zadat pouze
                  čas v 24 hodinovém formátu po půlhodinách.', '([01]?[0-9]|2[0-3]):(0|3)0');
     $form->addText('workEnd', 'Konec', 3, 5)->setRequired('Vyplňte pole "Konec prac. doby".')->setDefaultValue($this->defaultItemTime['workEnd'])->setHtmlId('workEnd')->setAttribute('class', 'input-time')->addRule(Form::PATTERN, 'Do pole "Konec prac. doby" lze zadat pouze
                  čas v 24 hodinovém formátu po půlhodinách.', '([01]?[0-9]|2[0-3]):(0|3)0');
     $form->addText('lunch', 'Oběd', 3, 5)->setRequired('Vyplňte pole "Oběd".')->setDefaultValue($this->defaultItemTime['lunch'])->setHtmlId('lunch')->setAttribute('class', 'input-time')->addRule(Form::PATTERN, 'Do pole "Oběd" lze zadat pouze
                  čas v ve formátu s čárkou. (např. 1 nebo 1,5)', '^(0|[1-9]|1[0-9]|2[0-3])(,(0|5))?$');
     $form->addText('otherHours', 'Ostatní hod.')->setDefaultValue($this->defaultItemTime['otherHours'])->setHtmlId('otherHours')->setAttribute('class', 'input-time')->addCondition(Form::FILLED)->addRule(Form::PATTERN, 'Do pole "Ostaní hodiny" lze zadat pouze
                  čas ve formátu s čárkou.(např. 6 nebo 6,5)', '^(0|[1-9]|1[0-9]|2[0-3])(,(0|5))?$');
     $form->addText('locality', 'Místo pracoviště', 28, 40)->setRequired('Vyplňte pole "Místo pracoviště".')->setHtmlId('locality')->getControlPrototype()->class = 'item-text-input';
     $form->addText('description', 'Popis práce', 28, 30)->getControlPrototype()->class = 'item-text-input';
     $form->addText('descOtherHours', 'Komentář k ostat. hod. (např. svátek)', 28, 30)->addConditionOn($form['otherHours'], Form::FILLED)->addCondition(Form::FILLED)->addRule(function ($item, $arg) {
         return \InvoiceTime::processTime($arg) == '00:00:00' ? false : true;
     }, self::OTHER_HOURS_ZERO_TIME_ERROR_MSG, $form['otherHours']);
     $form['descOtherHours']->getControlPrototype()->class = 'item-text-input';
     // time control buttons
     $form->addButton('workStartAdd', '+')->setAttribute('class', self::BTN_TIME_ADD_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['workStart']->control->attrs['id'], 'slider' => 'slider_range', 'pos' => 0, 'val' => -30]));
     $form->addButton('workStartSub', '-')->setAttribute('class', self::BTN_TIME_SUB_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['workStart']->control->attrs['id'], 'slider' => 'slider_range', 'pos' => 0, 'val' => 30]));
     $form->addButton('workEndAdd', '+')->setAttribute('class', self::BTN_TIME_ADD_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['workEnd']->control->attrs['id'], 'slider' => 'slider_range', 'pos' => 1, 'val' => 30]));
     $form->addButton('workEndSub', '-')->setAttribute('class', self::BTN_TIME_SUB_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['workEnd']->control->attrs['id'], 'slider' => 'slider_range', 'pos' => 1, 'val' => -30]));
     $form->addButton('lunchAdd', '+')->setAttribute('class', self::BTN_TIME_ADD_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['lunch']->control->attrs['id'], 'slider' => 'slider_lunch', 'val' => -30]));
     $form->addButton('lunchSub', '-')->setAttribute('class', self::BTN_TIME_SUB_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['lunch']->control->attrs['id'], 'slider' => 'slider_lunch', 'val' => 30]));
     $form->addButton('otherHoursAdd', '+')->setAttribute('class', self::BTN_TIME_ADD_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['otherHours']->control->attrs['id'], 'slider' => 'slider_time_other', 'val' => 0]));
     $form->addButton('otherHoursSub', '-')->setAttribute('class', self::BTN_TIME_SUB_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['otherHours']->control->attrs['id'], 'slider' => 'slider_time_other', 'val' => 0]));
     $form->addSubmit('save', 'Uložit řádek');
     $form->getElementPrototype()->id = 'update-form';
     return $form;
 }
 protected function createComponentSignInForm()
 {
     $form = new Form();
     $form->addText('username', 'Uživatelské jméno:')->setRequired('Prosím vyplňte své uživatelské jméno.');
     $form->addPassword('password', 'Heslo:')->setRequired('Prosím vyplňte své heslo.');
     $form->addCheckbox('remember', 'Zůstat přihlášen');
     $form->addSubmit('send', 'Přihlásit');
     // setup form rendering
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = 'div class="col-sm-6"';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-3 control-label"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     // make form and controls compatible with Twitter Bootstrap
     $form->getElementPrototype()->class('form-horizontal');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     $form->onSuccess[] = array($this, 'signInFormSucceeded');
     return $form;
 }
Example #8
0
 public function create()
 {
     $form = new Form();
     $form->getElementPrototype()->addClass('form-horizontal');
     $form->setRenderer(new Bs3FormRenderer());
     return $form;
 }
Example #9
0
 protected function createComponentPageForm()
 {
     $form = new Form();
     $form->setTranslator($this->translator->domain('pageEditForm'));
     $form->getElementPrototype()->id = 'page-form';
     $form->addText('title', 'title.label', null, Page::LENGTH_TITLE)->setMaxLength(Page::LENGTH_TITLE)->setRequired('title.messages.required')->setAttribute('data-text-length', Page::LENGTH_TITLE)->addRule(Form::MAX_LENGTH, new Phrase('title.messages.maxLength', ['numChars' => Page::LENGTH_TITLE]), Page::LENGTH_TITLE);
     $form->addText('publishedAt', 'publishedAt.label', null, 16)->setHtmlId('datetimepicker')->setRequired('publishedAt.messages.required')->addCondition(Form::FILLED)->addRule(Form::MAX_LENGTH, new Phrase('publishedAt.messages.maxLength', ['numChars' => 16]), 16);
     $form->addTextArea('intro', 'intro.label', null, 7)->setMaxLength(Page::LENGTH_INTRO)->setRequired('intro.messages.required')->setAttribute('data-text-length', Page::LENGTH_INTRO)->addRule(Form::MAX_LENGTH, new Phrase('intro.messages.maxLength', ['numChars' => Page::LENGTH_INTRO]), Page::LENGTH_INTRO);
     $form->addTextArea('text', 'text.label', null, 25);
     //->setRequired('text.messages.required');
     $form->addText('url', 'url.label', null, 255);
     $form->addSelect('lang', 'lang.label')->setItems($this->availableLocales)->setDefaultValue($this->defaultLocale);
     if (isset($this->page)) {
         $form['lang']->setDisabled();
         //$form['lang']->setOmitted();
     }
     $form->addCheckbox('allowedComments', 'allowedComments.label')->setDefaultValue(true);
     $form->addText('keywords', 'keywords.label');
     $form->addText('description', 'description.label');
     $form->addSubmit('saveAndPublish', 'saveAndPublish.caption')->setAttribute('title', $this->translator->translate('pageEditForm.saveAndPublish.title'))->onClick[] = [$this, 'processPageSavingAndPublishing'];
     $form->addSubmit('saveAsDraft', 'saveAsDraft.caption')->setAttribute('title', $this->translator->translate('pageEditForm.saveAsDraft.title'))->onClick[] = [$this, 'processPageSavingAsDraft'];
     if (!$this->authorizator->isAllowed($this->user, 'page', 'create') or !$this->authorizator->isAllowed($this->user, 'page', 'edit')) {
         $form['saveAndPublish']->setDisabled();
         $form['saveAsDraft']->setDisabled();
     }
     $form->addProtection();
     return $form;
 }
 /**
  * @return \Nette\Forms\Form
  */
 public function createComponentDateForm()
 {
     $form = new Form();
     $form->getElementPrototype()->style = 'margin: 0;';
     $form->addDatePicker('paginatorDate')->addRule(Form::VALID, 'Entered date is not valid!')->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Entered date is not within allowed range.', array($this->getPaginator()->getOldestDate(), $this->getPaginator()->getNewestDate()));
     $form['paginatorDate']->setDefaultValue($this->getPaginator()->getDate());
     $form->onSuccess[] = callback($this, 'formSubmitted');
     return $form;
 }
 /**
  * @return Form
  */
 protected function createComponentForm()
 {
     $form = new Form();
     $form->getElementPrototype()->class('navbar-form navbar-right');
     $form->addText('text')->setAttribute('placeholder', 'Search project')->getControlPrototype()->class('form-control');
     $form->addSubmit('search', 'Search')->getControlPrototype()->class('btn btn-success');
     $form->onSuccess[] = $this->formSuccess;
     return $form;
 }
 protected function createComponentFormPasswordGenerator()
 {
     $form = new Form();
     $form->getElementPrototype()->name('settingsForNewPassword');
     $form->addText('password', 'New Password:'******'salt', 'Salt:');
     $form->addSubmit('generate', 'Generate');
     $form->onSuccess[] = [$this, 'passwordGeneratorFormSubmitted'];
     return $form;
 }
Example #13
0
 /**
  * Vytvori prihlasovaci formular
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentForm()
 {
     $form = new Form();
     $form->setTranslator($this->translator);
     $form->getElementPrototype()->id = 'loginform';
     $form->addText('login', NULL)->setAttribute('placeholder', 'Login')->setRequired('Zadejte prosím login.');
     $form->addPassword('password', NULL)->setAttribute('placeholder', 'Heslo')->setRequired('Zadejte prosím heslo.');
     $form->addSubmit('makeLogin', 'Přihlásit');
     return $form;
 }
Example #14
0
 /**
  * @return Form
  */
 protected function createComponentForm()
 {
     $form = new Form();
     $form->getElementPrototype()->class = 'sign-form';
     $form->addText('username', 'Login')->setRequired();
     $form->addPassword('password', 'Password')->setRequired();
     $form->addSubmit('submit', 'Sign in');
     $form->onSuccess[] = [$this, 'processForm'];
     return $form;
 }
Example #15
0
 protected function createComponentForm()
 {
     $form = new Form();
     $form->addSelect('year', '', TimeUtils::generateYearsForSelect());
     $form->addSelect('month', '', TimeUtils::getMonths())->setPrompt('Celý rok');
     $form->addSubmit('filter', 'Zobraz výčetky')->setOmitted();
     $form->getElementPrototype()->id = 'form-filter';
     $form->onSuccess[] = $this->processFilter;
     return $form;
 }
Example #16
0
 public function create()
 {
     $form = new Form();
     $form->setRenderer(new BootstrapVerticalRenderer());
     $form->getElementPrototype()->class("ajax");
     $form->addTextArea("content")->setAttribute("rows", 6)->setAttribute("cols", 7)->setRequired("Zadej prosím text komentáře.");
     $form->addSubmit("submit");
     $form->onSuccess[] = array($this, "addCommentFormSucceded");
     return $form;
 }
Example #17
0
 protected function createComponentSubscribeForm()
 {
     $form = new Form();
     $form->getElementPrototype()->setClass("ajax");
     // ajax
     $form->addText('email', 'E-mail')->setAttribute('type', 'email')->setAttribute('placeholder', 'Zadejte vaši e-mailovou adresu...')->setRequired()->addCondition(Form::FILLED)->addRule(Form::EMAIL, 'Zadejte správný tvar emailové adresy.');
     $form->addSubmit('send', 'Přihlásit se');
     $form->onSuccess[] = callback($this, "saveEmail");
     return $form;
 }
Example #18
0
 protected function createComponentFilter()
 {
     $form = new Form();
     $form->setTranslator($this->translator->domain('tags.filter.form'));
     $form->getElementPrototype()->class = 'ajax';
     $form->addText('name', 'name.label')->setDefaultValue($this->name);
     $form->addSubmit('filter', 'filter.label')->onClick[] = [$this, 'filterTags'];
     $form->addSubmit('reset', 'reset.label')->onClick[] = [$this, 'filterReset'];
     return $form;
 }
 /**
  * @return Form
  */
 public function create()
 {
     $form = new Form();
     $form->getElementPrototype()->enctype = 'multipart/form-data';
     $form->addHidden('galeries_id');
     $form->addUpload('files', '', true)->setAttribute('id', "files")->setAttribute('class', "btn btn-primary");
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addSubmit('submit', 'uložit')->setAttribute('class', "btn btn-primary btn-md")->setAttribute('id', "submit_files");
     //bootstrap vzhled
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'well well-sm';
     $renderer->wrappers['pair']['container'] = '';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = '';
     $renderer->wrappers['label']['container'] = 'div class=custom-label';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $form->getElementPrototype()->class('form-horizontal col-sm-12');
     return $form;
 }
Example #20
0
 public function create()
 {
     $form = new Form();
     $form->setRenderer(new BootstrapVerticalRenderer());
     $form->getElementPrototype()->class("ajax");
     $form->addTextArea("content")->setAttribute("rows", 5)->setRequired("Zadej prosím text příspěvku.");
     $form->addHidden("boardId", 0);
     $form->addSubmit("submit");
     $form->onSuccess[] = array($this, "addBoardFormSucceded");
     return $form;
 }
 protected function createComponentSignInForm()
 {
     $form = new Form();
     $form->getElementPrototype()->class('ajax');
     $form->addText('email')->setAttribute('class', 'input')->setAttribute('placeholder', 'E-mail');
     $form->addPassword('passwd')->setAttribute('class', 'input')->setAttribute('placeholder', 'Heslo');
     $form->addSubmit('signInBut', 'Přihlásit')->setAttribute('class', 'submit_button');
     $form->addCheckBox('stay_logged', 'Neodhlašovat');
     $form->onSuccess[] = array($this, 'signInFormSucceeded');
     return $form;
 }
Example #22
0
 public function create()
 {
     $form = new Form();
     $form->getElementPrototype()->class("ajax");
     $form->addText("name", "Název")->addRule(Form::MAX_LENGTH, "Maximální délka názvu může být %d znaků.", Category::MAX_NAME_LENGTH)->setRequired("Zadej prosím název kategorie.");
     $form->addHidden("visible", 1);
     $form->addHidden("categoryId", 0);
     $form->addSubmit("submit")->setAttribute("class", "btn btn-default");
     $form->onSuccess[] = $this->addCategoryFormSucceeded;
     return $form;
 }
 /**
  * @return Form
  */
 public function create($id = null)
 {
     $this->id = $id;
     $form = new Form();
     $form->getElementPrototype()->class('ajax form');
     $form->addUpload('img', 'Fotografie:', FALSE)->setRequired('Vyberte prosím fotografii, kterou chcete nahrát.')->addRule(Form::IMAGE, 'Fotografie musí být ve formátu JPEG, PNG nebo GIF.')->addRule(Form::MAX_FILE_SIZE, 'Maximální velikost fotografie je 2 MB.', 2 * 1024 * 1024);
     $form->addSubmit('send', 'Nahrát obrázek')->setAttribute('class', 'btn btn-primary');
     $form->onSuccess[] = array($this, 'formSucceeded');
     $form->onError[] = array($this, 'formNotSucceeded');
     return $form;
 }
 /** form for sending message
  * 
  * @return \Nette\Application\UI\Form
  */
 public function createComponentSendMessageForm()
 {
     $form = new Form();
     $form->addText('email', 'Váš email')->addRule(Form::EMAIL, 'Email není platný')->addRule(Form::FILLED, 'Musíte zadat svůj email.');
     $form->addTextArea('text', 'Váš vzkaz')->addRule(Form::FILLED, 'Nelze odeslat prázdnou zprávu')->setAttribute('placeholder', 'Váš vzkaz pro nás.');
     $form->addAntispam('kontrolni', 'Následující políčko vymažte!', 'Jsi spamovací robot?!');
     $form->addSubmit('send', 'Odeslat');
     $form->getElementPrototype()->class('ajax');
     $form->onSuccess[] = $this->sendMessageFormSubmitted;
     return $form;
 }
Example #25
0
 protected function createComponentSignInForm()
 {
     $form = new Nette\Application\UI\Form();
     $form->getElementPrototype()->class = 'login';
     $form->addText('login', 'Login:'******'Please enter your login.');
     $form->addPassword('password', 'Password:'******'Please enter your password.');
     $form->addSubmit('send', 'Sign in');
     // call method signInFormSucceeded() on success
     $form->onSuccess[] = $this->signInFormSucceeded;
     return $form;
 }
 /**
  * @return Form
  */
 public function create($id_product = null)
 {
     // nacteni id nemovitosti
     $this->id_product = $id_product;
     // form
     $form = new Form();
     $form->getElementPrototype()->class('ajax form');
     $form->addSubmit('send', 'Odeslat formulář')->setAttribute('class', 'btn btn-primary');
     $form->onSuccess[] = array($this, 'formSucceeded');
     $form->onError[] = array($this, 'formNotSucceeded');
     return $form;
 }
Example #27
0
 public function create()
 {
     $form = new Form();
     $form->getElementPrototype()->class("ajax");
     $form->addText("description")->addRule(Form::MAX_LENGTH, "Maximální délka popisu může být %d znaků.", Photo::MAX_DESCRIPTION_LENGTH)->setAttribute("size", 40)->setRequired("Zadej prosím popis fotografie.");
     $form->addText("source")->addRule(Form::MAX_LENGTH, "Maximální délka popisu může být %d znaků.", Photo::MAX_SOURCE_LENGTH)->setRequired("Zadej prosím zdroj fotografie.");
     $form->addText("photoTags")->setAttribute("size", 30);
     $form->addButton("addPhotoTag");
     $form->addSubmit("submit");
     $form->onSuccess[] = array($this, "addPhotoFormSucceeded");
     return $form;
 }
 /**
  * @return Form
  */
 public function create()
 {
     $form = new Form();
     $form->getElementPrototype()->class('ajax form');
     $form->addText('username', 'Username:'******'class', 'form-control')->setAttribute('placeholder', 'Nevyplněno')->setRequired('Prosím vyplňte pole Nick.');
     $form->addPassword('password', 'Password:'******'class', 'form-control')->setAttribute('placeholder', 'Nevyplněno')->setRequired('Prosím vyplňte pole Heslo.');
     $form->addCheckbox('remember', 'Chcete zůstat přihlášen?');
     $form->addSubmit('send', 'Přihlásit')->setAttribute('class', 'btn btn-primary');
     $form->onSuccess[] = array($this, 'formSucceeded');
     $form->onError[] = array($this, 'formNotSucceeded');
     return $form;
 }
 /**
  * @return Form
  */
 public function create($id = null)
 {
     $this->id = $id;
     $form = new Form();
     $form->getElementPrototype()->class('ajax form');
     $form->addPassword('oldpassword', 'Současné heslo:')->setRequired('Prosím zadejte vaše současné heslo.')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Nevyplněno');
     $form->addPassword('password', 'Nové heslo:')->setRequired('Prosím zadejte nové heslo.')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Nevyplněno');
     $form->addPassword('password2', 'Nové heslo znovu:')->setRequired('Zadejte prosím znovu heslo pro kontrolu.')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Nevyplněno');
     $form->addSubmit('send', 'Změnit heslo')->setAttribute('class', 'btn btn-primary');
     $form->onSuccess[] = array($this, 'formSucceeded');
     $form->onError[] = array($this, 'formNotSucceeded');
     return $form;
 }
 /**
  * @return Form
  */
 protected function createComponentForm()
 {
     $form = new Form();
     $form->getElementPrototype()->class('navbar-form navbar-right');
     $form->addText('positive_votes', 'Positive votes to merge')->setRequired('%label is require')->addRule(Form::INTEGER, '%label has to be an integer');
     $form->addCheckbox('delete_source_branch', 'Remove source branch when merge request is accepted');
     $form->addSubmit('save', 'Save');
     $form->onSuccess[] = $this->formSuccess;
     if ($this->project) {
         $form->setDefaults($this->project);
     }
     return $form;
 }