Initial support for filtering events.

First I tell extractNamedParams() which params I care about (ignore the rest),
then I loop through the returned results and build my query via named params.

Finally I pass the named params into the $conditions array for paginate to use.
This commit is contained in:
Kyle Johnson 2013-05-29 07:54:06 -04:00
parent cc4af23115
commit 633aa7a9ad
1 changed files with 11 additions and 0 deletions

View File

@ -8,6 +8,17 @@ public function index() {
$this->loadModel('Monitor'); $this->loadModel('Monitor');
$conditions = array(); $conditions = array();
$named = $this->extractNamedParams(
array('MonitorId')
);
if ($named) {
foreach ($named as $key => $value) {
$$key = array($key => $value);
array_push($conditions, $$key);
}
};
$events_per_page = Configure::read('ZM_WEB_EVENTS_PER_PAGE'); $events_per_page = Configure::read('ZM_WEB_EVENTS_PER_PAGE');
$this->paginate = array( $this->paginate = array(