From 17589a95795a7d181d2234aaef3ca17095a6a943 Mon Sep 17 00:00:00 2001 From: phecho Date: Wed, 21 Dec 2016 10:47:52 +0800 Subject: Added pagination details showing --- app/Core/Paginator.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'app/Core') diff --git a/app/Core/Paginator.php b/app/Core/Paginator.php index cfe89938..046c539c 100644 --- a/app/Core/Paginator.php +++ b/app/Core/Paginator.php @@ -231,6 +231,17 @@ class Paginator return $this; } + /** + * Get the number of current page + * + * @access public + * @return integer + */ + public function getPage() + { + return $this->page; + } + /** * Set the default column order * @@ -270,6 +281,16 @@ class Paginator return $this; } + /** + * Get the maximum number of items per page. + * + * @return int + */ + public function getMax() + { + return $this->limit; + } + /** * Return true if the collection is empty * @@ -390,6 +411,17 @@ class Paginator return $html; } + /** + * Generate the page showing. + * + * @access public + * @return string + */ + public function generatPageShowing() + { + return ''.t('Showing %d-%d of %d', (($this->getPage() - 1) * $this->getMax() + 1), min($this->getTotal(), $this->getPage() * $this->getMax()), $this->getTotal()).''; + } + /** * Return true if there is no pagination to show * @@ -413,6 +445,7 @@ class Paginator if (! $this->hasNothingtoShow()) { $html .= ''; -- cgit v1.2.3