예제 #1
0
 /**
  * @param Nette\Http\SessionSection $session
  * @param Nette\ComponentModel\IContainer|null $parent
  * @param null $name
  */
 public function __construct(\Nette\Http\SessionSection $session, $parent = NULL, $name = NULL)
 {
     parent::__construct($parent, $name);
     $this->session = $session;
     $this->question = Html::el('p')->addAttributes(array('class' => "{$this->cssClass}--question"));
     $this->form = new Form($this, 'form');
     $this->form->getElementPrototype()->class = "{$this->cssClass}--form";
     $this->form->getRenderer()->wrappers['controls']['container'] = NULL;
     $this->form->addHidden('token');
     $this->form->addSubmit('yes', self::$_strings['yes'])->onClick[] = array($this, 'confirmClicked');
     $this->form->addSubmit('no', self::$_strings['no'])->onClick[] = array($this, 'cancelClicked');
     $this->form['yes']->getControlPrototype()->class = 'btn';
     $this->form['no']->getControlPrototype()->class = 'btn';
 }
예제 #2
0
  /**
 * Edit hlavne menu form component factory.
 * @return Nette\Application\UI\Form
 */
  public function create($iko, $upload_size)
  {
      $form = new Form();
      $form->addProtection();
      $form->addHidden("id");
      $form->addHidden("id_lang");
      $form->addHidden("spec_nazov");
      $form->addUpload('title_image', 'Titulný obrázok:')->setOption('description', 'Odporúčaný rozmer obrázku je: 90x70px alebo násobky tejto veľkosti. Inak môže dôjsť k deformácii alebo orezaniu obrázku pri ukladaní!')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'Titulný obrázok musí byť JPEG, PNG alebo GIF.')->addRule(Form::MAX_FILE_SIZE, 'Maximálna veľkosť súboru je 64 kB.', 64 * 1024);
      $form->addText('nazov', 'Názov produktu:', 50, 50)->setRequired('Názov musí byť zadaný!');
      $form->addRadioList('tepkat', 'Tepelná kategória:', $iko)->getSeparatorPrototype()->setName(NULL);
      $form->addText('vyska', 'Výška[mm]:', 5, 5)->addRule(Form::RANGE, 'Výška musí byť v rozsahu od %d do %d mm!', array(0, 4000))->setRequired('Výška musí byť zadaná!');
      $form->addText('sirka', 'Šírka[mm]:', 5, 5)->addRule(Form::RANGE, 'Šírka musí byť v rozsahu od %d do %d mm!', array(0, 2000))->setRequired('Šírka musí byť zadaná!');
      $form->addText('hlbka', 'Hĺbka[mm]:', 5, 5)->addRule(Form::RANGE, 'Hĺbka musí byť v rozsahu od %d do %d mm!', array(0, 2000))->setRequired('Hĺbka musí byť zadaná!');
      $form->addText('hmotnost', 'Hmotnosť[kg]:', 5, 5)->addRule(Form::RANGE, 'Hmotnosť musí byť v rozsahu od %d do %d kg!', array(0, 3500))->setRequired('Hmotnosť musí byť zadaná!');
      $form->addText('bottom_plinth_weight', 'Hmotnosť spodného podstavca[kg]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Hmotnosť spodného podstavca musí byť v rozsahu od %d do %d kg!', array(0, 2000));
      $form->addCheckbox('copatible_aurum', ' Kompatibilné s Aurum Pellet Unit');
      $form->addText('termal_energy', 'Tepelná energia[kWh]:', 5, 5)->addRule(Form::RANGE, 'Tepelná energia musí byť v rozsahu od %d do %d kWh!', array(0, 200))->setRequired('Tepelná energia musí byť zadaná!');
      $form->addText('heating_time', 'Čas spaľovania[h:min]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::PATTERN, 'Čas spaľovania musí byť zapísaný v tvare napr.:02:30', '([0-9]\\s*){2}:([0-9]\\s*){2}');
      $form->addText('heating_occasion', 'Max. množstvo dreva[kg]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Max. množstvo dreva musí byť v rozsahu od %d do %d kg!', array(0, 100));
      $form->addText('forewood_lenght', 'Dĺžka dreva do rúry na pečenie[cm]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Dĺžka dreva do rúry na pečenie musí byť v rozsahu od %d do %d cm!', array(0, 100));
      $form->addText('firewood_lenght', 'Dĺžka dreva[cm]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Dĺžka dreva musí byť v rozsahu od %d do %d cm!', array(0, 100));
      $form->addText('nominal_heat_output', 'Nominálny tepelný výkon[kW]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Nominálny tepelný výkon musí byť v rozsahu od %d do %d kW!', array(0, 15));
      $form->addText('nominal_heat_time', 'Nominálny čas[h]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Nominálny čas musí byť v rozsahu od %d do %d h!', array(0, 50));
      $form->addText('heat_release_time100', 'Tepelná akumulačná kapacita, 100 percent maximálneho výkonu[h]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Tepelná akumulačná kapacita musí byť v rozsahu od %d do %d h!', array(0, 50));
      $form->addText('heat_release_time50', 'Tepelná akumulačná kapacita, 50 percent maximálneho výkonu[h]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Tepelná akumulačná kapacita musí byť v rozsahu od %d do %d h!', array(0, 100));
      $form->addText('heat_release_time25', 'Tepelná akumulačná kapacita, 25 percent maximálneho výkonu[h]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Tepelná akumulačná kapacita musí byť v rozsahu od %d do %d h!', array(0, 100));
      $form->addText('efficiency', 'Účinnosť[%]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Účinnosť musí byť v rozsahu od %d do %d %!', array(0, 100));
      $form->addUpload('pec_pdf', 'Katalógový list vo formáte pdf:')->setOption('description', sprintf('Max veľkosť prílohy v bytoch %s kB', $upload_size / 1024))->addCondition(Form::FILLED)->addRule(Form::MIME_TYPE, 'Katalógový list musí byť vo formáte pdf!', 'application/pdf')->addRule(Form::MAX_FILE_SIZE, 'Max veľkosť prílohy može byť v bytoch %d B', $upload_size);
      $form->addSubmit('uloz', 'Ulož produkt');
예제 #3
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;
 }
 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;
 }
예제 #5
0
 protected function createComponentTagForm()
 {
     $form = new Form();
     $form->addText('title', 'title:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addText('slug', 'slug:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addText('color', 'color:')->setRequired()->getControlPrototype()->addClass('color {minV:0.9} form-control');
     $form->addText('bg_color', 'bg_color:')->setRequired()->getControlPrototype()->addClass('color {maxV:0.5} form-control');
     $form->addCheckbox('active', 'active:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addSubmit('send', 'Save tag')->getControlPrototype()->setName('button')->addClass('btn btn-success')->setHtml('<span class="glyphicon glyphicon-ok"></span>');
     $form->onSuccess[] = array($this, 'tagFormSucceeded');
     // 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-10';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-2 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');
     // <form 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;
 }
 /**
  * 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;
 }
예제 #7
0
 /**
  * @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;
 }
예제 #8
0
파일: Filter.php 프로젝트: Aearsis/DataGrid
 public function setFilterForm(Form $filter_form, $template = NULL)
 {
     if (!isset($filter_form['reset']) || !isset($filter_form['filter'])) {
         throw new Grid_Exception('Filter form component have required submit buttons with names "reset" and "filter".');
     }
     if (!$filter_form['reset'] instanceof SubmitButton || !$filter_form['filter'] instanceof SubmitButton) {
         throw new Grid_Exception('Filter form\'s components "reset" and "filter" must be instanceof \\Nette\\Forms\\Controls\\SubmitButton.');
     }
     if (is_null($template) && $filter_form->getRenderer() instanceof DefaultFormRenderer) {
         $filter_form->setRenderer(new FilterFormRenderer());
     }
     $filter_form->getElementPrototype()->class('form-inline', TRUE)->role('form')->action($this->link('submitForm!'));
     $this->filter_form = $filter_form;
     $this->form_template = $template;
 }
예제 #9
0
파일: Komentar.php 프로젝트: petak23/scspp
 /**
  * Formular pre pridanie komentara.
  * @return Nette\Application\UI\Form
  */
 protected function createComponentKomentarForm()
 {
     $form = new Nette\Application\UI\Form();
     $form->addHidden('id_oznam', $this->id_oznam);
     $form->addHidden('id_user_profiles', $this->id_user_profiles);
     $form->addTextArea('text')->setAttribute('class', 'form-control')->setAttribute('rows', $this->textA_rows);
     //->setDefaultValue('');
     $form->addSubmit('uloz', 'Pridaj komentár')->setAttribute('class', 'btn btn-success');
     $form->onSuccess[] = $this->onZapisKomentar;
     $form->getElementPrototype()->class('ajax');
     $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 style="display:none"';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     return $form;
 }
예제 #10
0
 /**
  * Bootstrap 3 Forms
  *
  * Setting HTML for forms with Bootstrap 3 syntax
  *
  * @return Nette\Application\UI\For
  */
 protected function bootstrapForm()
 {
     $form = new Form();
     $renderer = $form->getRenderer();
     // dump($renderer->wrappers);
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $renderer->wrappers['control']['.text'] = $renderer->wrappers['control']['.password'] = $renderer->wrappers['control']['.select'] = 'form-control';
     $renderer->wrappers['label']['requiredsuffix'] = " *";
     $renderer->wrappers['error']['container'] = NULL;
     $renderer->wrappers['error']['item'] = "div class='alert alert-danger'";
     $renderer->wrappers['control']['.submit'] = $renderer->wrappers['control']['.button'] = 'btn btn-primary';
     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;
 }
예제 #12
0
 public function activateBootstrapRenderer(Nette\Application\UI\Form $form)
 {
     $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-9';
     $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
  */
 public function create()
 {
     $boolean = array(0 => 'ne', 1 => 'ano');
     $form = new Form();
     $form->addHidden('id');
     $form->addDatePicker('date', 'datum: ')->setAttribute('class', 'datepicker');
     $form->addText('name', 'nadpis: ', 100)->addRule(Form::FILLED, 'Zadejte prosím nadpis.');
     $form->addTextArea('description', 'krátký popis: ', 105);
     $form->addSelect('active', 'zobrazit: ', $boolean)->setDefaultValue(1);
     $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=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;
 }
예제 #14
0
 /**
  * @param Form $form
  * @return Form
  */
 public static function makeBootstrap(Form $form)
 {
     $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-9';
     $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';
     $form->getElementPrototype()->class('form-horizontal');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Button) {
             $control->setAttribute('class', empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
             $usedPrimary = true;
         } elseif ($control instanceof TextBase || $control instanceof SelectBox || $control instanceof MultiSelectBox) {
             $control->setAttribute('class', 'form-control');
         } elseif ($control instanceof Checkbox || $control instanceof CheckboxList || $control instanceof RadioList) {
             $control->getSeparatorPrototype()->setName('div')->class($control->getControlPrototype()->type);
         }
     }
     return $form;
 }
 protected function createComponentPostForm()
 {
     $form = new Form();
     $form->addText('title', 'Titulek:')->setRequired();
     $form->addTextArea('content', 'Obsah:', 55, 8)->setRequired()->setAttribute('class', 'mceEditor');
     $form->getElementPrototype()->onsubmit('tinyMCE.triggerSave()');
     $form->addSubmit('send', 'Vložit článek');
     foreach ($form->getComponents(TRUE, 'SubmitButton') as $button) {
         if (!$button->getValidationScope()) {
             continue;
         }
         $button->getControlPrototype()->onclick('tinyMCE.triggerSave()');
     }
     // setup form rendering
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class="form-group text-center"';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = 'div class="col-sm-10"';
     $renderer->wrappers['label']['container'] = 'div class="control-label text-center col-sm-1"';
     $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, 'postFormSucceeded');
     return $form;
 }
예제 #16
0
 /** @return Form */
 public function create()
 {
     $f = new Form();
     $f->addText('name', 'Jméno:');
     //->setRequired();
     $f->addText('surname', 'Příjmení:');
     //->setRequired();
     $f->addText('institution', 'Pracoviště:');
     $f->addText('project', 'Projekt:');
     $f->AddText('www', 'web:');
     $f->addText('date', 'Datum setkání:')->setAttribute('placeholder', 'rrrr-mm-dd');
     $f->addTextArea('note', 'Poznámka')->setAttribute('rows', '10');
     $f->addMultiUpload('img', 'Vizitka');
     $f->addUpload('foto', 'Foto:');
     $f->addSubmit('submit', 'Uložit');
     // setup form rendering
     $renderer = $f->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-8';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-2 control-label"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $f->getElementPrototype()->class('form-horizontal');
     foreach ($f->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-success' : '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 $f;
 }
예제 #17
0
 public function createComponentEditPasswordForm()
 {
     $id = $this->getParameter('id');
     $array = explode('-', $id);
     $id = $array[0];
     $form = new Form();
     $form->addHidden('id')->setDefaultValue($id);
     $form->addPassword('password', 'nové heslo :')->addRule(Form::FILLED, 'Zadejte prosím heslo.');
     $form->addPassword('password2', 'nové heslo potvrzení:')->addConditionOn($form["password"], Form::FILLED)->addRule(Form::EQUAL, "Nová hesla se musí shodovat !", $form["password"]);
     $form->addSubmit('login', 'Změnit');
     $form->onSuccess[] = array($this, 'EditPasswordFormSubmitted');
     $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;
 }
예제 #18
0
 /** form for adding new item 
  * 
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentNewItemForm()
 {
     $form = new Form();
     //$userPairs = $this->userRepository->findAll()->fetchPairs('id', 'name');
     if ($this->pageConfig) {
         /** for each item from configuration for this page create form item
          * 
          */
         foreach ($this->pageConfig["form"] as $item => $params) {
             $formItem = NULL;
             switch ($params["type"]) {
                 case "calendar":
                     //$formItem = $form->addDate($item, $params['text'], Vodacek\Forms\Controls\DateInput::TYPE_DATE);
                     //$formItem = $form->addText($item, $params['text'], 40, 100);
                     $formItem = $form->addDatePicker($item, $params['text']);
                     //$formItem->addRule(Form::VALID, 'Zadané datum není platné!');
                     /** check for minimal date */
                     $min = new DateTime('-100 years 00:00');
                     $max = new DateTime('+100 years 00:00');
                     if (isset($params["min"])) {
                         switch ($params["min"]) {
                             case 'today':
                                 $min = new DateTime('-0 days 00:00');
                                 break;
                             default:
                                 $min = new DateTime($params["min"] . ' 00:00');
                                 break;
                         }
                     }
                     /** check for maximal date */
                     if (isset($params["max"])) {
                         switch ($params["max"]) {
                             case 'today':
                                 $max = new DateTime('+0 days 00:00');
                                 break;
                             default:
                                 $max = new DateTime($params["max"] . ' 00:00');
                                 break;
                         }
                     }
                     $formItem->setAttribute('min', $min->format('Y-m-d'))->setAttribute('max', $max->format('Y-m-d'));
                     break;
                 case "shortText":
                     $formItem = $form->addText($item, $params['text'], 40, 100);
                     break;
                 case "longText":
                     $formItem = $form->addTextArea($item, $params['text'], 40, 5);
                     break;
                 case "location":
                     $formItem = $form->addTextArea($item, $params['text'], 40, 3);
                     break;
                 case "select":
                     $formItem = $form->addSelect($item, $params['text'])->setItems($params["options"])->setPrompt('Vyberte');
                     /** set default value for select if any */
                     if (isset($params["defaultValue"])) {
                         $formItem->setDefaultValue($params["defaultValue"]);
                     }
                     break;
             }
             /** if it is mandatory set rule */
             if (isset($params["mandatory"]) && $params["mandatory"]) {
                 $formItem->addRule(Form::FILLED, 'Je nutné vyplnit "' . $params['text'] . '".');
             }
             /** if it has a hint, show it */
             if (isset($params["hint"])) {
                 $formItem->setOption('description', $params["hint"]);
                 if (gettype($params["hint"]) == 'string') {
                     $formItem->setAttribute('title', $params["hint"])->setOption('description', $params["hint"]);
                 }
             }
             /** add placeholder, if any */
             if (isset($params["placeholder"])) {
                 $formItem->setAttribute('placeholder', $params["placeholder"]);
             }
             /** set default value if any */
             if (isset($params["defaultValue"])) {
                 $formItem->setDefaultValue($params["defaultValue"]);
             }
         }
     }
     if (!empty($this->pageConfig['settings']['sendEmail'])) {
         $hintText = 'Tento email nebude zveřejněn; bude vám na něj zaslán odkaz na stránku, na které můžete zde zadané hodnoty zpětně upravit.';
         $session = $this->getSession('agility');
         $defaultVal = '@';
         //$session->email == NULL ? '@' : $session->email;
         $form->addText('email', 'Váš email:', 40, 100)->setDefaultValue($defaultVal)->setType('e-mail')->addRule(Form::FILLED, 'Je nutné zadat email.')->addRule(Form::EMAIL, 'Nezadali jste platnou emailovou adresu.')->setAttribute('title', $hintText)->setOption('description', $hintText);
     }
     $form->addAntispam('kontrolni');
     $form->addSubmit('create', 'Vytvořit');
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'div';
     $renderer->wrappers['pair']['container'] = 'dl';
     $renderer->wrappers['label']['container'] = 'dt';
     $renderer->wrappers['control']['container'] = 'dd';
     $form->getElementPrototype()->class('ajax');
     $form->onSuccess[] = $this->newItemFormSubmitted;
     return $form;
 }
예제 #19
0
 public function createComponentFilterForm()
 {
     $form = new AppForm();
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'p';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = NULL;
     $like = $form->addContainer('like');
     $like->addText('name', 'Název:');
     $like->addSelect('mimetype', 'Typ:', array(0 => '---', 'image' => 'Images', 'text' => 'Text', 'word' => 'Word', 'excel' => 'Excel', 'pdf' => 'PDF'))->controlPrototype->onChange("submit();");
     $created = $form->addContainer('created');
     $created->addSelect('day', 'Datum:', $this->items->getDaysToSelect())->controlPrototype->onChange("submit();");
     $created->addSelect('month', '', $this->items->getMonthsToSelect())->controlPrototype->onChange("submit();");
     $created->addSelect('year', '', $this->items->getYearsToSelect())->controlPrototype->onChange("submit();");
     $like = $form->addContainer('boolean');
     $like->addSelect('visible', 'Visibility:', array(0 => '---', 'false' => 'Hidden', 'true' => 'Visible'))->controlPrototype->onChange("submit();");
     $form->addSubmit('set', 'Set');
     $form->addSubmit('reset', 'Reset')->onClick[] = array($this, 'resetFilter');
     $form->onSuccess[] = array($this, 'setFilter');
     return $form;
 }
예제 #20
0
 /** Potvrdenie ucasti form component factory.
  * @return Nette\Application\UI\Form
  */
 protected function createComponentKontaktForm()
 {
     $form = new Form();
     $form->addProtection();
     $form->addText('meno', $this->text_form['meno'], 30, 50);
     $form->addText('email', $this->text_form['email'], 30, 50)->setType('email')->addRule(Form::EMAIL, $this->text_form['email_ar'])->setRequired($this->text_form['email_sr']);
     $form->addTextArea('text', $this->text_form['text'])->setAttribute('rows', $this->textA_rows)->setAttribute('cols', $this->textA_cols)->setRequired($this->text_form['text_sr']);
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'dl';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = 'dt';
     $renderer->wrappers['control']['container'] = 'dd';
     $form->addSubmit('uloz', $this->text_form['uloz']);
     $form->onSuccess[] = [$this, 'onZapisDotaz'];
     return $form;
 }
예제 #21
0
 /** Formular pre editaciu clanku.
  * @return Nette\Application\UI\Form
  */
 protected function createComponentClankyEditForm()
 {
     $form = new Form();
     $form->addProtection();
     $form->addGroup();
     if ($this->nastavenie['send_e_mail_news']) {
         $form->addCheckbox('posli_news', ' Posielatie NEWS')->setOption('description', 'Zaškrtnutím sa pri uložení pošle informačný e-mail všetkým užívateľom, ktorý majú oprávnenie na čítanie článku(min. úroveň registrácie).');
     }
     $form->addGroup();
     foreach ($this->jaz as $j) {
         $form->addHidden($j->skratka . '_id');
         $form->addHidden($j->skratka . '_id_lang');
         if ($this->nastavenie['clanky']['zobraz_anotaciu']) {
             $form->addText($j->skratka . '_anotacia', 'Anotácia článku pre jazyk ' . $j->nazov, 80, 255);
         }
         $form->addTextArea($j->skratka . '_text', 'Text článku pre jazyk ' . $j->nazov)->setAttribute('cols', 60)->setAttribute('class', 'jquery_ckeditor');
     }
     $form->addGroup();
     $form->addSubmit('uloz', 'Ulož článok')->setAttribute('class', 'btn btn-success');
     $form->onSuccess[] = [$this, 'clankyEditFormSubmitted'];
     $form->getRenderer()->wrappers['pair']['.odd'] = 'r1';
     return $this->_vzhladForm($form);
 }
예제 #22
0
 protected function createComponentPostForm()
 {
     $form = new Form();
     $form->addText('title_en', 'title_en:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addText('slug_en', 'slug_en:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addText('title_cs', 'title_cs:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addText('slug_cs', 'slug_cs:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addText('label', 'label:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addTextArea('body_cs', 'body_cs:')->getControlPrototype()->addClass('form-control')->addRows('10');
     $form->addTextArea('body_en', 'body_en:')->getControlPrototype()->addClass('form-control')->addRows('10');
     $form->addText('date', 'date:')->setType('datetime')->setDefaultValue(new \Nette\Utils\DateTime())->getControlPrototype()->addClass('form-control');
     $form->addSubmit('send', 'Save post');
     //->getControlPrototype()->setName('button')->addClass('btn btn-success')->setHtml('messages.logInForm.PleaseEnterYourPassword <span class="glyphicon glyphicon-ok"></span>');
     // TODO zkusit někdy přidání stylu při definici formuláře setAttribute:
     // https://forum.nette.org/cs/24499-jak-nastavit-class-submitu-ve-formulari#p163765
     //$form->addSubmit('save', 'Odeslat')->setAttribute('class', 'btn btn-primary');
     $form->onSuccess[] = array($this, 'postFormSucceeded');
     // 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-10';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-2 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');
     // <form 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;
 }
예제 #23
0
 public function createComponentFilterForm()
 {
     $form = new AppForm();
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'p';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = NULL;
     $like = $form->addContainer('like');
     $like->addText('name', 'Name:');
     $like->addText('zip', 'Zip:');
     $created = $form->addContainer('simple');
     $created->addSelect('shire_id', 'Shire:', $this->system->getShiresToSelect())->controlPrototype->onChange("submit();");
     $form->addSubmit('set', 'Set');
     $form->addSubmit('reset', 'Reset')->onClick[] = array($this, 'resetFilter');
     $form['reset']->getControlPrototype()->class('cancel');
     $form->onSuccess[] = array($this, 'setFilter');
     return $form;
 }
예제 #24
0
 public function createComponentFilterForm()
 {
     $form = new AppForm();
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'p';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = NULL;
     $like = $form->addContainer('like');
     $like->addText('name', 'Name:');
     $form->addSubmit('set', 'Set');
     $form->addSubmit('reset', 'Reset')->onClick[] = array($this, 'resetFilter');
     $form['reset']->getControlPrototype()->class('cancel');
     $form->onSuccess[] = array($this, 'setFilter');
     return $form;
 }
예제 #25
0
 public function createComponentFilterForm()
 {
     $form = new AppForm();
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'p';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = NULL;
     $like = $form->addContainer('boolean');
     $like->addSelect('is_active', 'Activity:', array(0 => '---', 'true' => 'Active', 'false' => 'InActive'))->controlPrototype->onChange("submit();");
     $form->addSubmit('set', 'Set');
     $form->addSubmit('reset', 'Reset')->onClick[] = array($this, 'resetFilter');
     $form->onSuccess[] = array($this, 'setFilter');
     return $form;
 }
예제 #26
0
         $values->title_image->move($image_name);
         $image = Image::fromFile($image_name);
         $image->resize(90, 70, Image::SHRINK_ONLY | Image::EXACT);
         $image->save($image_name, 80);
     } else {
         $this->flashMessage('Pre titulný obrázok nebol použitý obrázok a tak nebol uložený!', 'danger');
     }
     unset($values->title_image);
 } else {
     unset($values->title_image);
 }
 if (isset($values->pec_pdf)) {
예제 #27
0
 protected function createComponentFilterForm()
 {
     $form = new AppForm();
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'p';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = NULL;
     $like = $form->addContainer('like');
     $like->addText('author', 'Author:');
     $like->addText('description', 'Description:');
     $like = $form->addContainer('boolean');
     $like->addSelect('visible', 'Visibility:', array(0 => '---', 'false' => 'Hidden', 'true' => 'Visible'))->controlPrototype->onChange("submit();");
     $form->addSubmit('set', 'Set')->getControlPrototype()->class('primary');
     $form->addSubmit('reset', 'Reset')->onClick[] = array($this, 'resetFilter');
     $form['reset']->getControlPrototype()->class('cancel');
     $form->onSuccess[] = array($this, 'setFilter');
     return $form;
 }
예제 #28
0
 /** form for editing item 
  * 
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentEditItemForm()
 {
     $form = new Form();
     //$userPairs = $this->userRepository->findAll()->fetchPairs('id', 'name');
     if ($this->pageConfig) {
         /** for each item from configuration for this page create form item
          * 
          */
         foreach ($this->pageConfig["form"] as $item => $params) {
             $formItem = NULL;
             switch ($params["type"]) {
                 case "calendar":
                     //$formItem = $form->addDate($item, $params['text'], Vodacek\Forms\Controls\DateInput::TYPE_DATE);
                     //$formItem = $form->addText($item, $params['text'], 40, 100);
                     $formItem = $form->addDatePicker($item, $params['text']);
                     /** check for minimal date */
                     $min = new DateTime('-100 years 00:00');
                     $max = new DateTime('+100 years 00:00');
                     if (isset($params["min"])) {
                         switch ($params["min"]) {
                             case 'today':
                                 $min = new DateTime('-0 days 00:00');
                                 break;
                             default:
                                 $min = new DateTime($params["min"] . ' 00:00');
                                 break;
                         }
                     }
                     /** check for maximal date */
                     if (isset($params["max"])) {
                         switch ($params["max"]) {
                             case 'today':
                                 $max = new DateTime('+0 days 00:00');
                                 break;
                             default:
                                 $max = new DateTime($params["max"] . ' 00:00');
                                 break;
                         }
                     }
                     $formItem->setAttribute('min', $min->format('Y-m-d'))->setAttribute('max', $max->format('Y-m-d'));
                     break;
                 case "shortText":
                     $formItem = $form->addText($item, $params['text'], 40, 100);
                     break;
                 case "longText":
                     $formItem = $form->addTextArea($item, $params['text'], 40, 5);
                     break;
                 case "location":
                     $formItem = $form->addTextArea($item, $params['text'], 40, 3);
                     break;
                 case "select":
                     $formItem = $form->addSelect($item, $params['text'])->setItems($params["options"])->setPrompt('Vyberte');
                     /** set default value for select if any */
                     if (isset($params["defaultValue"])) {
                         $formItem->setDefaultValue($params["defaultValue"]);
                     }
                     break;
             }
             /** if it is mandatory set rule */
             if (isset($params["mandatory"]) && $params["mandatory"]) {
                 $formItem->addRule(Form::FILLED, 'Je nutné vyplnit "' . $params['text'] . '".');
             }
             /** if it has a hint, show it */
             if (isset($params["hint"])) {
                 $formItem->setOption('description', $params["hint"]);
             }
             /** set actual value if any */
             if (isset($this->editingItem->{$item})) {
                 if ($params["type"] == 'calendar') {
                     //$formItem->setDefaultValue();
                     if (gettype($this->editingItem->{$item}) == 'object') {
                         $this->editingItem->{$item} = $this->editingItem->{$item}->date;
                     }
                 }
                 $formItem->setDefaultValue($this->unescapeTags($this->editingItem->{$item}));
             }
         }
     }
     if (!empty($this->pageConfig['settings']['sendEmail'])) {
         $text = $this->adminEdit ? 'Email' : 'Váš email';
         $form->addText('email', $text, 40, 100)->setDefaultValue($this->editingRow->authorEmail)->setDisabled(TRUE);
     }
     $form->addSelect('delete', 'Chcete tento záznam smazat?')->setItems(array('Ne', 'ANO'));
     $form->addAntispam('kontrolni', 'Následující políčko vymažte!', 'Jsi spamovací robot?!');
     $form->addSubmit('save', 'Uložit');
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'div';
     $renderer->wrappers['pair']['container'] = 'dl';
     $renderer->wrappers['label']['container'] = 'dt';
     $renderer->wrappers['control']['container'] = 'dd';
     $form->getElementPrototype()->class('ajax');
     $form->onSuccess[] = $this->editItemFormSubmitted;
     return $form;
 }
예제 #29
0
 public function createComponentFilterForm()
 {
     $form = new AppForm();
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'p';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = NULL;
     $like = $form->addContainer('like');
     $like->addText('name', 'Name:');
     $like->addText('surname', 'Surname:');
     $like->addText('username', 'Username:'******'set', 'Set');
     $form->addSubmit('reset', 'Reset')->onClick[] = array($this, 'resetFilter');
     $form->onSuccess[] = array($this, 'setFilter');
     $form->setTranslator($this->translator);
     return $form;
 }
 /**
  * Delete folder form
  *
  * @Action("default")
  * @Privilege("delete")
  */
 protected function createComponentDeleteFolderForm()
 {
     $folders = $this->loadFolders();
     $years = $folders;
     $form = new Form();
     array_walk($years, function (&$value) {
         $value = mb_substr($value, 0, 4) . '/' . mb_substr($value, 4, 8);
     });
     $input = array_combine($folders, $years);
     $form->addSelect('foldername', 'Smazat složku pro školní rok:', $input)->setPrompt('Vyberte složku')->setRequired('Vyberte jméno složky.');
     $form->addSubmit('send', 'Smazat');
     $form->onSuccess[] = $this->deleteFolderFormSucceded;
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'div';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['control']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     return $form;
 }