From 4aadd4e931e5d6f31227d55dd0957afc284a5320 Mon Sep 17 00:00:00 2001 From: Andreas Date: Fri, 9 Oct 2020 18:29:41 +0200 Subject: [PATCH 1/4] Added button to activate/deactivate in mode list. This is done dynamically with javascript. --- application/controllers/Mode.php | 18 +++++++++++ application/models/Modes.php | 30 +++++++++++++++++ application/views/interface_assets/footer.php | 32 +++++++++++++++++++ application/views/mode/index.php | 12 +++++-- 4 files changed, 90 insertions(+), 2 deletions(-) diff --git a/application/controllers/Mode.php b/application/controllers/Mode.php index a5afe7c3..b6176fbb 100644 --- a/application/controllers/Mode.php +++ b/application/controllers/Mode.php @@ -90,4 +90,22 @@ class Mode extends CI_Controller { redirect('mode'); } + + public function activate() { + $id = $this->input->post('id'); + $this->load->model('modes'); + $this->modes->activate($id); + header('Content-Type: application/json'); + echo json_encode(array('message' => 'OK')); + return; + } + + public function deactivate() { + $id = $this->input->post('id'); + $this->load->model('modes'); + $this->modes->deactivate($id); + header('Content-Type: application/json'); + echo json_encode(array('message' => 'OK')); + return; + } } \ No newline at end of file diff --git a/application/models/Modes.php b/application/models/Modes.php index 76aaee7b..07d9ec28 100644 --- a/application/models/Modes.php +++ b/application/models/Modes.php @@ -72,6 +72,36 @@ class Modes extends CI_Model { $this->db->delete('adif_modes', array('id' => $clean_id)); } + function activate($id) { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + $data = array( + 'active' => '1', + ); + + $this->db->where('id', $clean_id); + + $this->db->update('adif_modes', $data); + + return true; + } + + function deactivate($id) { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + $data = array( + 'active' => '0', + ); + + $this->db->where('id', $clean_id); + + $this->db->update('adif_modes', $data); + + return true; + } + } ?> \ No newline at end of file diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 0d3e8e32..e1aecffc 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1790,6 +1790,38 @@ $(document).ready(function(){ + uri->segment(1) == "mode") { ?> + + + diff --git a/application/views/mode/index.php b/application/views/mode/index.php index 8652b0eb..ff866336 100644 --- a/application/views/mode/index.php +++ b/application/views/mode/index.php @@ -32,12 +32,20 @@ mode;?> submode;?> qrgmode;?> - active == 1) { echo "active";} else { echo "not active";};?> + active == 1) { echo "active";} else { echo "not active";};?> + + active == 1) { + echo ""; + } else { + echo ""; + };?> + id; ?>" class="btn btn-info btn-sm"> Edit - id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete mode mode; ?> ');"> Delete + id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete mode mode; ?> ');"> Delete + From f7a7f3e24475b26c4fcdb81a3d2b345d16348837 Mon Sep 17 00:00:00 2001 From: Andreas Date: Fri, 9 Oct 2020 19:30:27 +0200 Subject: [PATCH 2/4] Changed text on button to clarify it's function. --- application/views/station_profile/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/station_profile/index.php b/application/views/station_profile/index.php index 4c8749f3..78dbe551 100644 --- a/application/views/station_profile/index.php +++ b/application/views/station_profile/index.php @@ -71,7 +71,7 @@ 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?');"> Empty Station Profile + station_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete all QSOs within this station profile?');"> Empty 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 Profile From 161798c44ddf17fae9f368e88259c2f8ff1aa6c1 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sun, 11 Oct 2020 14:46:35 +0200 Subject: [PATCH 3/4] Added summary for the CQ award. --- application/controllers/Awards.php | 1 + application/models/Cq.php | 54 +++++++++++++++++++++++++++ application/views/awards/cq/index.php | 32 +++++++++++++++- 3 files changed, 86 insertions(+), 1 deletion(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 2133a304..7c579c02 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -349,6 +349,7 @@ class Awards extends CI_Controller { } $data['cq_array'] = $this->cq->get_cq_array($bands, $postdata); + $data['cq_summary'] = $this->cq->get_cq_summary($bands); // Render page $data['page_title'] = "Awards - CQ Magazine"; diff --git a/application/models/Cq.php b/application/models/Cq.php index e62ee86f..d5d47d38 100644 --- a/application/models/Cq.php +++ b/application/models/Cq.php @@ -212,4 +212,58 @@ class CQ extends CI_Model{ return $sql; } + /* + * Function gets worked and confirmed summary on each band on the active stationprofile + */ + function get_cq_summary($bands) { + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); + + foreach ($bands as $band) { + $worked = $this->getSummaryByBand($band, $station_id); + $confirmed = $this->getSummaryByBandConfirmed($band, $station_id); + $cqSummary['worked'][$band] = $worked[0]->count; + $cqSummary['confirmed'][$band] = $confirmed[0]->count; + } + + return $cqSummary; + } + + function getSummaryByBand($band, $station_id) { + $sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv"; + + $sql .= " where station_id = " . $station_id; + + if ($band == 'SAT') { + $sql .= " and thcv.col_prop_mode ='" . $band . "'"; + } else { + $sql .= " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band ='" . $band . "'"; + + } + $query = $this->db->query($sql); + + return $query->result(); + } + + function getSummaryByBandConfirmed($band, $station_id){ + $sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv"; + + $sql .= " where station_id = " . $station_id; + + if ($band == 'SAT') { + $sql .= " and thcv.col_prop_mode ='" . $band . "'"; + } else { + $sql .= " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band ='" . $band . "'"; + } + + $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + + $query = $this->db->query($sql); + + return $query->result(); + } + } diff --git a/application/views/awards/cq/index.php b/application/views/awards/cq/index.php index 0fc9fc35..cdb5a718 100644 --- a/application/views/awards/cq/index.php +++ b/application/views/awards/cq/index.php @@ -164,7 +164,37 @@ } echo ''; } - echo ''; + echo ' +

Summary

+ + + + '; + + foreach($bands as $band) { + echo ''; + } + echo ''; + + echo ' + + + + '; + + foreach ($cq_summary['worked'] as $dxcc) { // Fills the table with the data + echo ''; + } + + echo ' + '; + foreach ($cq_summary['confirmed'] as $dxcc) { // Fills the table with the data + echo ''; + } + + echo ' +
' . $band . '
Total worked' . $dxcc . '
Total confirmed' . $dxcc . '
+ '; } else { From 99df3c82909e5449da24eed16171d73014fa578e Mon Sep 17 00:00:00 2001 From: Andreas Date: Sun, 11 Oct 2020 14:54:23 +0200 Subject: [PATCH 4/4] Added summary for the IOTA award. --- application/controllers/Awards.php | 1 + application/models/Iota.php | 57 +++++++++++++++++++++++++ application/views/awards/iota/index.php | 33 +++++++++++++- 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 2133a304..a70855f5 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -507,6 +507,7 @@ class Awards extends CI_Controller { $iotalist = $this->iota->fetchIota($postdata); $data['iota_array'] = $this->iota->get_iota_array($iotalist, $bands, $postdata); + $data['iota_summary'] = $this->iota->get_iota_summary($bands); // Render Page $data['page_title'] = "Awards - IOTA (Islands On The Air)"; diff --git a/application/models/Iota.php b/application/models/Iota.php index 12c5d539..a2f054b7 100644 --- a/application/models/Iota.php +++ b/application/models/Iota.php @@ -307,5 +307,62 @@ class IOTA extends CI_Model { } return $sql; } + + /* + * Function gets worked and confirmed summary on each band on the active stationprofile + */ + function get_iota_summary($bands) + { + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); + + foreach ($bands as $band) { + $worked = $this->getSummaryByBand($band, $station_id); + $confirmed = $this->getSummaryByBandConfirmed($band, $station_id); + $iotaSummary['worked'][$band] = $worked[0]->count; + $iotaSummary['confirmed'][$band] = $confirmed[0]->count; + } + + return $iotaSummary; + } + + function getSummaryByBand($band, $station_id) + { + $sql = "SELECT count(distinct thcv.col_iota) as count FROM " . $this->config->item('table_name') . " thcv"; + + $sql .= " where station_id = " . $station_id; + + if ($band == 'SAT') { + $sql .= " and thcv.col_prop_mode ='" . $band . "'"; + } else { + $sql .= " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band ='" . $band . "'"; + + } + $query = $this->db->query($sql); + + return $query->result(); + } + + function getSummaryByBandConfirmed($band, $station_id) + { + $sql = "SELECT count(distinct thcv.col_iota) as count FROM " . $this->config->item('table_name') . " thcv"; + + $sql .= " where station_id = " . $station_id; + + if ($band == 'SAT') { + $sql .= " and thcv.col_prop_mode ='" . $band . "'"; + } else { + $sql .= " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band ='" . $band . "'"; + } + + $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + + $query = $this->db->query($sql); + + return $query->result(); + } } ?> \ No newline at end of file diff --git a/application/views/awards/iota/index.php b/application/views/awards/iota/index.php index 2eb46dc7..c3b63057 100644 --- a/application/views/awards/iota/index.php +++ b/application/views/awards/iota/index.php @@ -125,7 +125,38 @@ } echo ''; } - echo ''; + + echo ' +

Summary

+ + + + '; + + foreach($bands as $band) { + echo ''; + } + echo ''; + + echo ' + + + + '; + + foreach ($iota_summary['worked'] as $dxcc) { // Fills the table with the data + echo ''; + } + + echo ' + '; + foreach ($iota_summary['confirmed'] as $dxcc) { // Fills the table with the data + echo ''; + } + + echo ' +
' . $band . '
Total worked' . $dxcc . '
Total confirmed' . $dxcc . '
+ '; } else {