diff --git a/web/app/Controller/MonitorsController.php b/web/app/Controller/MonitorsController.php index 76f0586c2..9fb9391f9 100644 --- a/web/app/Controller/MonitorsController.php +++ b/web/app/Controller/MonitorsController.php @@ -18,6 +18,32 @@ } $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; + } +} + } ?> diff --git a/web/app/View/Monitors/edit.ctp b/web/app/View/Monitors/edit.ctp new file mode 100644 index 000000000..a5bb9650a --- /dev/null +++ b/web/app/View/Monitors/edit.ctp @@ -0,0 +1,10 @@ +