Initial commit of MVC for Monitors
This commit is contained in:
parent
a5e2f29a4b
commit
055d8f8d0b
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
class MonitorsController extends AppController {
|
||||
public $helpers = array('Html', 'Form');
|
||||
|
||||
public function index() {
|
||||
$this->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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
class Monitor extends AppModel {
|
||||
public $useTable = 'Monitors';
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,17 @@
|
|||
<h2>Monitors</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>MonitorId</th>
|
||||
</tr>
|
||||
|
||||
<?php foreach ($monitors as $monitor): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $this->Html->link($monitor['Monitor']['Name'],
|
||||
array('controller' => 'monitors', 'action' => 'view', $monitor['Monitor']['Id'])); ?>
|
||||
<td><?php echo $monitor['Monitor']['Id']; ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php unset($monitor); ?>
|
||||
</table>
|
Loading…
Reference in New Issue