summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorphecho <phecho@163.com>2016-12-21 10:47:52 +0800
committerphecho <phecho@163.com>2016-12-21 10:47:52 +0800
commit17589a95795a7d181d2234aaef3ca17095a6a943 (patch)
treebcd9c7d17c6e4df8dec518d82ed802b98fbc29bd /app
parenta4f258b26c9d7a04ec8f3775f1028e647f179f7d (diff)
Added pagination details showing
Diffstat (limited to 'app')
-rw-r--r--app/Core/Paginator.php33
-rw-r--r--app/Locale/zh_CN/translations.php1
2 files changed, 34 insertions, 0 deletions
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
@@ -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
@@ -391,6 +412,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 +445,7 @@ class Paginator
if (! $this->hasNothingtoShow()) {
$html .= '<div class="pagination">';
+ $html .= $this->generatPageShowing();
$html .= $this->generatePreviousLink();
$html .= $this->generateNextLink();
$html .= '</div>';
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index bbe7df5b..8153a78a 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -1288,4 +1288,5 @@ return array(
// 'Your personal API access token is "%s"' => '',
// 'Remove your token' => '',
// 'Generate a new token' => '',
+ 'Showing %d-%d of %d' => '本页显示 %d-%d 条,共有: %d 条',
);