readded forMonitor - removed by mistake

This commit is contained in:
Pliable Pixels 2016-09-03 14:51:24 -04:00
parent 9a4330eb59
commit 7bf0b3c423
1 changed files with 17 additions and 1 deletions

View File

@ -12,7 +12,7 @@ class ZonesController extends AppController {
*
* @var array
*/
public $components = array('RequestHandler');
public $components = array('RequestHandler');
public function beforeFilter() {
parent::beforeFilter();
@ -24,6 +24,22 @@ public function beforeFilter() {
}
}
// Find all zones which belong to a MonitorId
public function forMonitor($id = null) {
$this->loadModel('Monitor');
if (!$this->Monitor->exists($id)) {
throw new NotFoundException(__('Invalid monitor'));
}
$this->Zone->recursive = -1;
$zones = $this->Zone->find('all', array(
'conditions' => array('MonitorId' => $id)
));
$this->set(array(
'zones' => $zones,
'_serialize' => array('zones')
));
}
public function index() {
$this->Zone->recursive = -1;