/** * Get a list of zones * * @param string $rtrn Data type to return [count, list] * @param array $filters Filters to apply to query * @return mixed Returns an integer or array depending upon format chosen */ public function zones($rtrn = 'list', $filters = array(), $clear = false) { $tbl = new \Components\Tools\Tables\Zones($this->_db); switch (strtolower($rtrn)) { case 'count': if (!isset($this->_cache['zones.count']) || $clear) { $this->_cache['zones.count'] = $tbl->find('count', $filters); } return $this->_cache['zones.count']; break; case 'list': case 'results': default: if (!$this->_cache['zones.list'] instanceof ItemList || $clear) { if ($results = $tbl->find('list', $filters)) { foreach ($results as $key => $result) { $results[$key] = new Zone($result); } } else { $results = array(); } $this->_cache['zones.list'] = new ItemList($results); } return $this->_cache['zones.list']; break; } }