3 class SimplePortfolio
extends AOOSModule
5 private $_count = null;
6 private $_limit = null;
7 private $_offset = null;
8 private $_sortBy = null;
9 private $_order = null; // ASC or DESC
10 private $_entries = null;
12 public function __construct($core)
14 parent
::__construct($core);
16 $s = new AOOSStorageDevice($this->core());
17 $s->setStorageType("mysql");
18 $s->setTable("SimplePortfolio");
20 $this->_entries
= $s->selectModel("*");
21 $this->_count
= $s->numRows();
22 $this->_limit
= $this->core()->getSetting("limit", __class__
);
23 $this->_offset
= $this->core()->getSetting("offset", __class__
);
24 $this->_sortBy
= $this->core()->getSetting("sortBy", __class__
);
25 $this->_order
= $this->core()->getSetting("order", __class__
);
26 $this->_entries
->sort($this->sortBy(), $this->order());
29 public function show()
31 $rows = $this->entries()->getRows($this->offset(), $this->offset()+
$this->limit(), true);
32 return "Simple Portfolio";
35 public function setSortBy($field)
37 if (!$this->entries()->inColumnIndex($field))
41 $this->_sortBy
= $field;
45 public function sortBy()
47 return $this->_sortBy
;
50 public function setOrder($order)
52 $order = strtoupper($order);
53 if ($order != "ASC" && $order != "DESC")
55 $this->core()->log("Not asc or desc");
58 $this->_order
= $order;
62 public function order()
67 public function setOffset($offset)
69 if (!is_integer($offset))
71 throw new AOOSException($this->core(), $this->tr("offset_not_numeric"), "", true, 1);
74 $this->_offset
= $offset;
78 public function offset()
80 return $this->_offset
;
83 public function setLimit($limit)
85 if (!is_integer($limit))
87 throw new AOOSException($this->core(), $this->tr("limit_not_numeric"), "", true, 1);
90 $this->_limit
= $limit;
94 public function limit()
98 public function entries()
100 return $this->_entries
;