Ejemplo n.º 1
0
 public function createComponentCategories()
 {
     $form = new Nette\Application\UI\Form();
     $form->getElementPrototype()->class('xform-inline');
     $form->setTranslator($this->translator);
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class="control-group"';
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = NULL;
     $categories = $this->context->createServiceCategories()->select('category.*,
          COUNT(DISTINCT :subject_x_category.subject.id)
              AS catCount')->where('category.visible', '1')->group('category.id')->having('COUNT(:subject_x_category.category_id) > 0')->order('shift DESC, category.name');
     if ($this->shire != '') {
         $categories->where(':subject_x_category.subject.locality.shire.code', $this->shire);
     }
     $cat = $form->addContainer('categories');
     foreach ($categories as $category) {
         $cat->addCheckbox($category->id, $category->name)->setAttribute('onchange', 'submit()')->setOption('description', \Nette\Utils\Html::el("span")->class('help-inline')->setHtml("(" . $category->catCount . ")"));
         if (isset($this->categories[$category->id])) {
             $form['categories'][$category->id]->setValue($this->categories[$category->id]);
         }
     }
     //		$cat->addCheckbox('all', 'all')->setAttribute('onchange', 'submit()');
     $form->addHidden('blabla')->setValue(1);
     $form->onSuccess[] = array($this, 'setCategory');
     return $form;
 }
Ejemplo n.º 2
0
 protected function createComponentForm($name)
 {
     $form = new \Nette\Application\UI\Form($this, $name);
     $form->setTranslator($this->getTranslator());
     $form->setMethod($form::GET);
     $buttons = $form->addContainer(self::BUTTONS);
     $buttons->addSubmit('search', 'Grido.Search')->onClick[] = [$this, 'handleFilter'];
     $buttons->addSubmit('reset', 'Grido.Reset')->onClick[] = [$this, 'handleReset'];
     $buttons->addSubmit('perPage', 'Grido.ItemsPerPage')->onClick[] = [$this, 'handlePerPage'];
     $form->addSelect('count', 'Count', $this->getItemsForCountSelect())->setTranslator(NULL)->controlPrototype->attrs['title'] = $this->getTranslator()->translate('Grido.ItemsPerPage');
 }
Ejemplo n.º 3
0
 protected function createComponentGridForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->method = "POST";
     $form->getElementPrototype()->class[] = "grid-gridForm";
     $form->addContainer($this->name);
     $form[$this->name]->addContainer("rowForm");
     $form[$this->name]['rowForm']->addSubmit("send", "Uložiť");
     $form[$this->name]['rowForm']['send']->getControlPrototype()->addClass("grid-editable");
     $form[$this->name]->addContainer("filter");
     $form[$this->name]['filter']->addSubmit("send", "Filtrovať");
     $form[$this->name]->addContainer("action");
     $form[$this->name]['action']->addSelect("action_name", "Označené:");
     $form[$this->name]['action']->addSubmit("send", "Potvrdit")->getControlPrototype()->addData("select", $form[$this->name]["action"]["action_name"]->getControl()->name);
     $form[$this->name]->addContainer('perPage');
     $form[$this->name]['perPage']->addSelect("perPage", "Záznamou na stranu:", $this->perPageValues)->getControlPrototype()->addClass("grid-changeperpage")->addData("gridname", $this->getGridPath())->addData("link", $this->link("changePerPage!"));
     $form[$this->name]['perPage']->addSubmit("send", "Ok")->getControlPrototype()->addClass("grid-perpagesubmit");
     $form->onSuccess[] = [$this, 'processGridForm'];
     return $form;
 }