From 8fba801c40d1b9b9f87ac0e131cef7c8e05cc708 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sun, 8 Apr 2012 16:47:18 +0100 Subject: [PATCH] Added Radio Status at /radio/; --- application/controllers/radio.php | 32 +++++++++++++++++++++++++++-- application/models/cat.php | 15 +------------- application/views/layout/header.php | 3 +-- application/views/radio/index.php | 28 +++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 application/views/radio/index.php diff --git a/application/controllers/radio.php b/application/controllers/radio.php index 42a17c8e..36ec380d 100644 --- a/application/controllers/radio.php +++ b/application/controllers/radio.php @@ -4,12 +4,40 @@ public function index() { - + // load the view + $data['page_title'] = "Radio Status"; + + $this->load->view('layout/header', $data); + $this->load->view('radio/index'); + $this->load->view('layout/footer'); } function status() { $this->load->model('cat'); - print_r($this->cat->status()); + $query = $this->cat->status(); + if ($query->num_rows() > 0) + { + echo ""; + echo "Radio"; + echo "Frequency"; + echo "Mode"; + echo "Timestamp" ; + echo ""; + foreach ($query->result() as $row) + { + echo ""; + echo "".$row->radio.""; + echo "".$row->frequency.""; + echo "".$row->mode.""; + echo "".$row->timestamp."" ; + echo ""; + } + } else { + echo ""; + echo "No CAT Interfaced radios found."; + echo ""; + } + } function frequency($id) { diff --git a/application/models/cat.php b/application/models/cat.php index d2fbbb11..bcb00920 100644 --- a/application/models/cat.php +++ b/application/models/cat.php @@ -44,22 +44,9 @@ function status() { //$this->db->where('radio', $result['radio']); - $this->db->limit(1); $query = $this->db->get('cat'); - if ($query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - $data = array( - 'radio' => $row->radio, - 'frequency' => $row->frequency, - 'mode' => $row->mode - ); - } - } - - return $data; + return $query; } /* Return list of radios */ diff --git a/application/views/layout/header.php b/application/views/layout/header.php index 0e74da5d..e4eaaad7 100644 --- a/application/views/layout/header.php +++ b/application/views/layout/header.php @@ -7,8 +7,6 @@ - - @@ -54,6 +52,7 @@ Admin