From 055d8f8d0b1d56e1e7cc046de321779bc0286370 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Wed, 1 May 2013 18:41:59 -0400 Subject: [PATCH] Initial commit of MVC for Monitors --- web/app/Controller/MonitorsController.php | 23 +++++++++++++++++++++++ web/app/Model/Monitor.php | 5 +++++ web/app/View/Monitors/index.ctp | 17 +++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 web/app/Controller/MonitorsController.php create mode 100644 web/app/Model/Monitor.php create mode 100644 web/app/View/Monitors/index.ctp diff --git a/web/app/Controller/MonitorsController.php b/web/app/Controller/MonitorsController.php new file mode 100644 index 000000000..76f0586c2 --- /dev/null +++ b/web/app/Controller/MonitorsController.php @@ -0,0 +1,23 @@ +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); + } + } + +?> diff --git a/web/app/Model/Monitor.php b/web/app/Model/Monitor.php new file mode 100644 index 000000000..6a6bb64a6 --- /dev/null +++ b/web/app/Model/Monitor.php @@ -0,0 +1,5 @@ + diff --git a/web/app/View/Monitors/index.ctp b/web/app/View/Monitors/index.ctp new file mode 100644 index 000000000..38caf9caf --- /dev/null +++ b/web/app/View/Monitors/index.ctp @@ -0,0 +1,17 @@ +

Monitors

+ + + + + + + + + + + + +
NameMonitorId
+ Html->link($monitor['Monitor']['Name'], +array('controller' => 'monitors', 'action' => 'view', $monitor['Monitor']['Id'])); ?> +