From c9cba9a52b20e95ee04720218f369b98776e6502 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Skej=C3=B8?= Date: Fri, 5 Sep 2008 23:17:27 +0200 Subject: [PATCH] Adding the start of a simple module - SimplePortfolio --- modules/SimplePortfolio/SimplePortfolio.php | 71 +++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 modules/SimplePortfolio/SimplePortfolio.php diff --git a/modules/SimplePortfolio/SimplePortfolio.php b/modules/SimplePortfolio/SimplePortfolio.php new file mode 100644 index 0000000..2731901 --- /dev/null +++ b/modules/SimplePortfolio/SimplePortfolio.php @@ -0,0 +1,71 @@ +setStorageType("mysql"); + $s->setTable("SimplePortfolio"); + + $this->_entries = $s->select(); + $this->_count = $s->numRows(); + $this->_limit = $this->core()->getSetting("limit", __class__); + $this->_offset = $this->core()->getSetting("offset", __class__); + $this->_sortBy = $this->core()->getSetting("sortBy", __class__); + $this->_order = $this->core()->getSetting("order", __class__); + $this->_entries->sort($this->sortBy(), $this->order()); + } + + public function show() + { + $rows = $this->entries()->getRows($this->offset(), $this->offset()+$this->limit()); + return "Simple Portfolio"; + } + + public function setSortBy($field) + { + if (!$this->entries()->inColumnIndex($field)) + { + return false; + } + $this->_sortBy = $field; + return true; + } + + public function sortBy() + { + return $this->_sortBy; + } + + public function setOrder($order) + { + $order = strtoupper($order); + if ($order != "ASC" || $order != "DESC") + { + $this->core()->log("Not asc or desc"); + return false; + } + $this->_order = $order; + return true; + } + + public function order() + { + return $this->_order; + } + + public function entries() + { + return $this->_entries; + } +} -- 2.11.4.GIT