set('monitors', $this->Monitor->find('all')); } public function view($id = null) { if (!$id) { throw new NotFoundException(__('Invalid monitor')); } $monitor = $this->Monitor->findById($id); if (!$monitor) { throw new NotFoundException(__('Invalid monitor')); } $this->set('monitor', $monitor); } public function edit($id = null) { if (!$id) { throw new NotFoundException(__('Invalid monitor')); } $monitor = $this->Monitor->findById($id); if (!$monitor) { throw new NotFoundException(__('Invalid monitor')); } if ($this->request->is('put') || $this->request->is('post')) { $this->Monitor->id = $id; if ($this->Monitor->save($this->request->data)) { $this->Session->setFlash('Your monitor has been updated.'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash('Unable to update your monitor.'); } } if (!$this->request->data) { $this->request->data = $monitor; } } } ?>