From ccacc244db3986c0a1837208941ff7c1242955a3 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 6 Oct 2022 11:41:01 +0200 Subject: [PATCH] [Bands] Added master checkbox for award --- application/controllers/Band.php | 12 +++++++ application/models/Bands.php | 12 +++++++ application/views/bands/index.php | 52 +++++++++++++++++++++++++------ assets/js/sections/bands.js | 22 +++++++++++++ 4 files changed, 88 insertions(+), 10 deletions(-) diff --git a/application/controllers/Band.php b/application/controllers/Band.php index acce57b8..04c6ec17 100644 --- a/application/controllers/Band.php +++ b/application/controllers/Band.php @@ -137,4 +137,16 @@ class Band extends CI_Controller { echo json_encode(array('message' => 'OK')); return; } + + public function saveBandAward() { + $award = $this->security->xss_clean($this->input->post('award')); + $status = $this->security->xss_clean($this->input->post('status')); + + $this->load->model('bands'); + $this->bands->saveBandAward($award, $status); + + header('Content-Type: application/json'); + echo json_encode(array('message' => 'OK')); + return; + } } \ No newline at end of file diff --git a/application/models/Bands.php b/application/models/Bands.php index a31582e5..f8eee324 100644 --- a/application/models/Bands.php +++ b/application/models/Bands.php @@ -260,6 +260,18 @@ class Bands extends CI_Model { $this->db->update('bandxuser', $data); + return true; + } + + function saveBandAward($award, $status) { + $data = array( + $award => $status == "true" ? '1' : '0', + ); + + $this->db->where('bandxuser.userid', $this->session->userdata('user_id')); + + $this->db->update('bandxuser', $data); + return true; } diff --git a/application/views/bands/index.php b/application/views/bands/index.php index ad01691e..ec79ddb5 100644 --- a/application/views/bands/index.php +++ b/application/views/bands/index.php @@ -1,3 +1,15 @@ +