/** * @param int $limit * @param int $offset * @return array */ public function getData($limit = NULL, $offset = NULL) { if ($limit !== NULL) { $this->source->limit($limit, $offset); } return $this->source->fetchAll(); }
static function appendLimit(Nette\Database\Table\Selection &$query, $limit = NULL, $offset = NULL) { if (!is_null($limit)) { $query->limit($limit, $offset); } return $query; }
/** Render funkcia pre vypisanie odkazu na clanok * @see Nette\Application\Control#render() */ public function render() { if (count($this->dokumenty)) { //Ak nieco mam, tak najdem nahodny $obrazky = $this->dokumenty->limit(1, rand(0, count($this->dokumenty) - 1))->fetch(); $alt = $obrazky->popis; $src = $obrazky->subor; } else { $alt = $this->texty["notFound"]; $src = "www/images/otaznik.png"; } $this->template->setFile(__DIR__ . '/NahodnaFotka.latte'); $this->template->h4 = $this->texty["h4"]; $this->template->alt = $alt; $this->template->src = $src; $this->template->render(); }
/** * Reduce the result starting from $start to have $count rows * * @param int the number of results to obtain * @param int the offset * @return IDataSource (fluent) * @throws \OutOfRangeException */ public function reduce($count, $start = 0) { // Delibearately skipping check agains count($this) if ($count === NULL) { $count = 0; } if ($start === NULL) { $start = 0; } if ($start < 0 || $count < 0) { throw new \OutOfRangeException(); } $this->selection->limit($count, $start); return $this; }
/** * @param int $offset * @param int $limit */ public function limit($offset, $limit) { $this->selection->limit($limit, $offset); }
/** * Apply limit and offset on data * @param int $offset * @param int $limit * @return static */ public function limit($offset, $limit) { $this->data = $this->data_source->limit($limit, $offset)->fetchAll(); return $this; }
/** * Sets limit clause. * @param int $limit * @param int $offset * @return self */ public function limit($limit, $offset = null) { $this->selection->limit($limit, $offset); return $this; }
/** * Limit data * @param int $limit * @param int $offset */ public function limit($limit, $offset) { $this->table->limit($limit, $offset); }
/** * @param int $limit * @param int $offset * @return EntityCollection */ public function limit($limit, $offset = NULL) { $this->selection->limit($limit, $offset); $this->invalidate(); return $this; }
/** * @param Selection $out * @param Paginator $paginator * @return Selection */ protected function addPaginator($out, Paginator $paginator) { $paginator->setItemsPerPage($this->itemsPerPage); $paginator->setItemCount($out->count()); $out->limit($paginator->itemsPerPage, $paginator->offset); return $out; }