aboutsummaryrefslogtreecommitdiff
path: root/src/phorkie/Html/Pager.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-05-04 09:51:22 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-05-04 09:51:22 +0200
commit925eaabf42cbbbe2ceac8e1bb95c11ec8be5f375 (patch)
treefdaa9c143ac3e10ac3d52d2957c75a0b06d77e74 /src/phorkie/Html/Pager.php
parent35764754559c893569625c115707eb3bf73d1cfd (diff)
downloadphorkie-925eaabf42cbbbe2ceac8e1bb95c11ec8be5f375.tar.gz
phorkie-925eaabf42cbbbe2ceac8e1bb95c11ec8be5f375.zip
use a real pager now
Diffstat (limited to 'src/phorkie/Html/Pager.php')
-rw-r--r--src/phorkie/Html/Pager.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/phorkie/Html/Pager.php b/src/phorkie/Html/Pager.php
new file mode 100644
index 0000000..f5c8105
--- /dev/null
+++ b/src/phorkie/Html/Pager.php
@@ -0,0 +1,57 @@
+<?php
+namespace phorkie;
+
+class Html_Pager
+{
+ protected $pager;
+
+ /**
+ * @param integer $currentPage Current page, beginning with 1
+ */
+ public function __construct($itemCount, $perPage, $currentPage, $filename)
+ {
+ //fix non-static factory method error
+ error_reporting(error_reporting() & ~E_STRICT);
+ $this->pager = \Pager::factory(
+ array(
+ 'mode' => 'Sliding',
+ 'perPage' => $perPage,
+ 'delta' => 2,
+ 'totalItems' => $itemCount,
+ 'currentPage' => $currentPage,
+ 'urlVar' => 'page',
+ 'append' => false,
+ 'path' => '/',
+ 'fileName' => $filename,
+ 'separator' => '###',
+ 'spacesBeforeSeparator' => 0,
+ 'spacesAfterSeparator' => 0,
+ 'curPageSpanPre' => '',
+ 'curPageSpanPost' => '',
+ 'firstPagePre' => '',
+ 'firstPageText' => 'first',
+ 'firstPagePost' => '',
+ 'lastPagePre' => '',
+ 'lastPageText' => 'last',
+ 'lastPagePost' => '',
+ 'prevImg' => '« prev',
+ 'nextImg' => 'next »',
+ )
+ );
+ }
+
+
+ public function getLinks()
+ {
+ $arLinks = $this->pager->getLinks();
+ $arLinks['pages'] = explode('###', $arLinks['pages']);
+ return $arLinks;
+ }
+
+ public function numPages()
+ {
+ return $this->pager->numPages();
+ }
+}
+
+?>