From 633aa7a9ad3e8a7123ec807d790579261bbed3b8 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Wed, 29 May 2013 07:54:06 -0400 Subject: [PATCH] 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. --- web/app/Controller/EventsController.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web/app/Controller/EventsController.php b/web/app/Controller/EventsController.php index 5653388a9..f0665ac05 100644 --- a/web/app/Controller/EventsController.php +++ b/web/app/Controller/EventsController.php @@ -8,6 +8,17 @@ public function index() { $this->loadModel('Monitor'); $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'); $this->paginate = array(