diff options
Diffstat (limited to 'app/Core/Paginator.php')
-rw-r--r-- | app/Core/Paginator.php | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/app/Core/Paginator.php b/app/Core/Paginator.php index cfe89938..9075a713 100644 --- a/app/Core/Paginator.php +++ b/app/Core/Paginator.php @@ -232,6 +232,17 @@ class Paginator } /** + * Get the number of current page + * + * @access public + * @return integer + */ + public function getPage() + { + return $this->page; + } + + /** * Set the default column order * * @access public @@ -271,6 +282,16 @@ class Paginator } /** + * Get the maximum number of items per page. + * + * @return int + */ + public function getMax() + { + return $this->limit; + } + + /** * Return true if the collection is empty * * @access public @@ -353,7 +374,9 @@ class Paginator '← '.t('Previous'), $this->controller, $this->action, - $this->getUrlParams($this->page - 1, $this->order, $this->direction) + $this->getUrlParams($this->page - 1, $this->order, $this->direction), + false, + 'js-modal-replace' ); } else { $html .= '← '.t('Previous'); @@ -379,7 +402,9 @@ class Paginator t('Next').' →', $this->controller, $this->action, - $this->getUrlParams($this->page + 1, $this->order, $this->direction) + $this->getUrlParams($this->page + 1, $this->order, $this->direction), + false, + 'js-modal-replace' ); } else { $html .= t('Next').' →'; @@ -391,6 +416,17 @@ class Paginator } /** + * Generate the page showing. + * + * @access public + * @return string + */ + public function generatPageShowing() + { + return '<span class="pagination-showing">'.t('Showing %d-%d of %d', (($this->getPage() - 1) * $this->getMax() + 1), min($this->getTotal(), $this->getPage() * $this->getMax()), $this->getTotal()).'</span>'; + } + + /** * Return true if there is no pagination to show * * @access public @@ -413,6 +449,7 @@ class Paginator if (! $this->hasNothingtoShow()) { $html .= '<div class="pagination">'; + $html .= $this->generatPageShowing(); $html .= $this->generatePreviousLink(); $html .= $this->generateNextLink(); $html .= '</div>'; @@ -453,7 +490,9 @@ class Paginator $label, $this->controller, $this->action, - $this->getUrlParams($this->page, $column, $direction) + $this->getUrlParams($this->page, $column, $direction), + false, + 'js-modal-replace' ); } } |