Make CAT-URL Editable

This commit is contained in:
int2001
2024-11-08 14:21:10 +00:00
parent 106d27575f
commit 377843dcd9
2 changed files with 29 additions and 0 deletions

View File

@@ -50,6 +50,7 @@ class Radio extends CI_Controller {
echo "<th>" . __("Timestamp") . "</th>";
echo "<th></th>";
echo "<th>" . __("Options") . "</th>";
echo "<th>" . __("CAT-URL") . "</th>";
echo "<th></th>";
echo "</tr></thead><tbody>";
foreach ($query->result() as $row) {
@@ -102,6 +103,7 @@ class Radio extends CI_Controller {
echo '<td><button id="default_radio_btn_' . $row->id . '" class="btn btn-sm btn-primary ld-ext-right" onclick="release_default_radio(' . $row->id . ')">' . __("Default (click to release)") . '<div class="ld ld-ring ld-spin"></div></button</td>';
}
}
echo "<td><button id='".$row->id."' \" class=\"editCatUrl btn btn-sm btn-primary\"> " . __("Edit") . "</button></td>";
echo "<td><a href=\"" . site_url('radio/delete') . "/" . $row->id . "\" class=\"btn btn-sm btn-danger\"> <i class=\"fas fa-trash-alt\"></i> " . __("Delete") . "</a></td>";
echo "</tr>";
}
@@ -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);
}

View File

@@ -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;
}
}
?>