From 377843dcd9b650c17e558b0658a93fd74f64739d Mon Sep 17 00:00:00 2001 From: int2001 Date: Fri, 8 Nov 2024 14:21:10 +0000 Subject: [PATCH] Make CAT-URL Editable --- application/controllers/Radio.php | 21 +++++++++++++++++++++ application/models/Cat.php | 8 ++++++++ 2 files changed, 29 insertions(+) diff --git a/application/controllers/Radio.php b/application/controllers/Radio.php index e58673a43..9b878a027 100644 --- a/application/controllers/Radio.php +++ b/application/controllers/Radio.php @@ -50,6 +50,7 @@ class Radio extends CI_Controller { echo "" . __("Timestamp") . ""; echo ""; echo "" . __("Options") . ""; + echo "" . __("CAT-URL") . ""; echo ""; echo ""; foreach ($query->result() as $row) { @@ -102,6 +103,7 @@ class Radio extends CI_Controller { echo '"; echo "id . "\" class=\"btn btn-sm btn-danger\"> " . __("Delete") . ""; echo ""; } @@ -113,6 +115,20 @@ class Radio extends CI_Controller { } } + public function saveCatUrl() { + $name = xss_clean($this->input->post('name', true)); + $id = xss_clean($this->input->post('id', true)); + $this->load->model('cat'); + $this->cat->updateCatUrl($id,$name); + } + + public function editCatUrl() { + $this->load->model('cat'); + $data['container'] = $this->cat->radio_status(xss_clean($this->input->post('id', true)))->row(); + $data['page_title'] = __("Edit container name"); + $this->load->view('radio/edit', $data); + } + function json($id) { $clean_id = $this->security->xss_clean($id); @@ -148,6 +164,8 @@ class Radio extends CI_Controller { $prop_mode = $row->prop_mode; + $cat_url = $row->cat_url;; + // Check Mode if (isset($row->mode) && ($row->mode != null)) { $mode = strtoupper($row->mode); @@ -217,6 +235,9 @@ class Radio extends CI_Controller { if (isset($prop_mode) && ($prop_mode != null)) { $a_ret['prop_mode'] = $prop_mode; } + if (isset($cat_url) && ($cat_url != null)) { + $a_ret['cat_url'] = $cat_url; + } $a_ret['update_minutes_ago'] = $updated_at; echo json_encode($a_ret, JSON_PRETTY_PRINT); } diff --git a/application/models/Cat.php b/application/models/Cat.php index 276f18fba..efde42f69 100644 --- a/application/models/Cat.php +++ b/application/models/Cat.php @@ -121,5 +121,13 @@ return true; } + + function updateCatUrl($id,$caturl) { + $this->db->where('id', $id); + $this->db->where('user_id', $this->session->userdata('user_id')); + $this->db->update('cat',array('cat_url' => $caturl)); + + return true; + } } ?>