/** * Forgery constructor * * @param \Magelight\Db\Collection $visitorsCollection * @param int $currentPage */ public function __forge(\Magelight\Db\Collection $visitorsCollection, $currentPage = 0) { $this->collection = $visitorsCollection; $this->currentPage = $currentPage; $this->collection->setPage($currentPage); $total = 0; $this->visitors = $this->collection->fetchAll(true, $total); $this->total = $total; $this->sectionAppend('visitors-pager', $this->getPagerBlock()); }
/** * Set pager current page * * @param int $currentPage * @return Pager */ public function setCurrentPage($currentPage = 0) { if ($this->collection instanceof \Magelight\Db\Collection) { $this->collection->setPage($currentPage); } $this->currentPage = $currentPage; return $this; }