public function render() { $template = $this->getTemplate(); $template->setFile($this->templateDir . '/' . $this->templateFile); $template->setTranslator($this->getPresenter()->translator); //upravim model if (!is_null($this->order)) { $this->model->order($this->order . ' ' . $this->orderDir); } elseif (!is_null($this->orderDefault)) { if (is_null($this->orderDirDefault)) { $orderDir = 'ASC'; } else { $orderDir = $this->orderDirDefault; } $this->model->order($this->orderDefault . ' ' . $orderDir); } //strankovani $this->visualPaginator->getPaginator()->setItemsPerPage($this->itemsToPage); $this->visualPaginator->getPaginator()->setItemCount($this->model->count('*')); $this->model->limit($this->visualPaginator->getPaginator()->getLength(), $this->visualPaginator->getPaginator()->getOffset()); $template->columns = $this->columns; $template->model = $this->model; $template->menu = $this->menu; $template->uniquete = $this->uniquete; $template->emptyText = is_null($this->emptyText) ? $this->getPresenter()->translator->translate('admin.grid.noItemFound') : $this->emptyText; $template->visualPaginator = $this->visualPaginator; $template->order = $this->order; $template->orderDir = $this->orderDir; $template->ordering = $this->ordering; $template->render(); }
public function renderDefault() { $this->template->items = $this->items->fetchVisible(); $this->template->page = $this->page; $this->offset = $this->limit * ($this->page - 1); $this->template->count = $count = $this->items->count(); if ($this->page * $this->limit > $count - $this->limit) { //zkontroluje, zda se jedna o posledni stranku vypisu $this->limit = 99; // nastavi limi na hodne velky cislo, aby se vypsalo vse zbyvajici $this->template->limit = $this->limit; } elseif (($this->page + 1) * $this->limit > $count - $this->limit) { // zkontroluje, zda se jedna o predposledni stranku vypisu $this->template->limit = 98; } else { $this->template->limit = $this->limit; } }