From a4e942af43f2daf8c498d013119277cb6e4449d9 Mon Sep 17 00:00:00 2001 From: AndreasK79 Date: Fri, 7 Feb 2020 14:54:49 +0100 Subject: [PATCH] Added a button to only delete the log, not the profile. I found this to be valuable when testing out the import, and not having to create a new profile each time. --- application/controllers/Station.php | 7 +++++++ application/models/Stations.php | 6 ++++++ application/views/station_profile/index.php | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/application/controllers/Station.php b/application/controllers/Station.php index 2a27499b..694b204f 100644 --- a/application/controllers/Station.php +++ b/application/controllers/Station.php @@ -122,4 +122,11 @@ class Station extends CI_Controller { redirect('station'); } + public function deletelog($id) { + $this->load->model('stations'); + $this->stations->deletelog($id); + + redirect('station'); + } + } \ No newline at end of file diff --git a/application/models/Stations.php b/application/models/Stations.php index 46eddd10..8a24849d 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -81,6 +81,12 @@ class Stations extends CI_Model { $this->db->delete('station_profile', array('station_id' => $clean_id)); } + function deletelog($id) { + // Delete QSOs + $this->db->where('station_id', $id); + $this->db->delete($this->config->item('table_name')); + } + function set_active($current, $new) { // Clean inputs diff --git a/application/views/station_profile/index.php b/application/views/station_profile/index.php index 0cb1ec72..557bfa12 100644 --- a/application/views/station_profile/index.php +++ b/application/views/station_profile/index.php @@ -44,6 +44,7 @@ + @@ -69,6 +70,9 @@ station_id; ?>" class="btn btn-info btn-sm"> Edit + + station_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete all QSOs within this station profile?');"> Delete log + station_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete station profile station_profile_name; ?> this will delete all QSOs within this station profile?');"> Delete