From b12783da4e097a4e38e17d733bb6211b85187c58 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Skej=C3=B8?= Date: Sat, 11 Jul 2009 18:46:38 +0200 Subject: [PATCH] Paginator: Added previosURL() and made $options of createURL() optional. --- modules/Paginator/Paginator.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/Paginator/Paginator.php b/modules/Paginator/Paginator.php index e47f616..e1a5aa6 100644 --- a/modules/Paginator/Paginator.php +++ b/modules/Paginator/Paginator.php @@ -4,6 +4,7 @@ class Paginator extends AOOSModule { private $_module = null; private $_options = null; + private $_history = array(); private function start() { // First we clear options from previous @@ -35,6 +36,12 @@ class Paginator extends AOOSModule if (!($m = $this->core()->getModule($this->module()))) { return false; } + if (sizeof($this->_history) == 0) { + array_push($this->_history, $this->currentURL()); + } + elseif ($this->_history[sizeof($this->_history)-1] != $this->currentURL()) { + array_push($this->_history, $this->currentURL()); + } return $m->show(); } @@ -56,7 +63,7 @@ class Paginator extends AOOSModule return $this->_module; } - public function createURL($module, $options) { + public function createURL($module, $options = array()) { $this->start(); if (!is_array($options)) { throw new AOOSException($this->core(), $this->core()->tr("not_array"), "", true, 1); @@ -86,6 +93,14 @@ class Paginator extends AOOSModule } } + public function previousURL() { + if (sizeof($this->_history) > 1) { + return $this->_history[sizeof($this->_history)-2]; + } else { + return $this->currentURL(); + } + } + public function numOptions() { return count($this->options()); -- 2.11.4.GIT