Added the ability to delete radio profiles

pull/106/merge
Peter Goodhall 2012-11-13 20:14:39 +00:00
rodzic 7c4db8ad66
commit e04e324365
3 zmienionych plików z 53 dodań i 2 usunięć

Wyświetl plik

@ -4,6 +4,10 @@
public function index()
{
// Check Auth
$this->load->model('user_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
// load the view
$data['page_title'] = "Radio Status";
@ -13,15 +17,21 @@
}
function status() {
// Check Auth
$this->load->model('user_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$this->load->model('cat');
$query = $this->cat->status();
if ($query->num_rows() > 0)
{
echo "<tr>";
echo "<tr class=\"titles\">";
echo "<td>Radio</td>";
echo "<td>Frequency</td>";
echo "<td>Mode</td>";
echo "<td>Timestamp</td>" ;
echo "<td>Options</td>";
echo "</tr>";
foreach ($query->result() as $row)
{
@ -30,6 +40,7 @@
echo "<td>".$row->frequency."</td>";
echo "<td>".$row->mode."</td>";
echo "<td>".$row->timestamp."</td>" ;
echo "<td><a href=\"".site_url('radio/delete')."/".$row->id."\" ><img src=\"".base_url()."/images/delete.png\" width=\"16\" height=\"16\" alt=\"Delete\" /></a></td>" ;
echo "</tr>";
}
} else {
@ -41,6 +52,11 @@
}
function frequency($id) {
// Check Auth
$this->load->model('user_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
//$this->db->where('radio', $result['radio']);
$this->db->select('frequency');
$this->db->where('id', $id);
@ -56,6 +72,11 @@
}
function mode($id) {
// Check Auth
$this->load->model('user_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
//$this->db->where('radio', $result['radio']);
$this->db->select('mode');
$this->db->where('id', $id);
@ -69,6 +90,21 @@
}
}
}
function delete($id) {
// Check Auth
$this->load->model('user_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$this->load->model('cat');
$this->cat->delete($id);
$this->session->set_flashdata('message', 'Radio Profile Deleted');
redirect('radio');
}
}
?>

Wyświetl plik

@ -57,6 +57,13 @@
return $query;
}
function delete($id) {
$this->db->where('id', $id);
$this->db->delete('cat');
return true;
}
}

Wyświetl plik

@ -13,10 +13,18 @@
<div id="container">
<h2><?php echo $page_title; ?></h2>
<?php if($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">
<p><?php echo $this->session->flashdata('message'); ?></p>
</div>
<?php } ?>
<div class="row show-grid">
<div class="span15">
<!-- Display Radio Statuses -->
<table class="status">
</table>