From 67208a6c2739d0ab2e6934a7babd29a4c22e5342 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 14 Sep 2023 14:53:48 +0000 Subject: [PATCH] Added red/yellow/green Colorscheme to Bandlist --- application/models/Dxcluster_model.php | 1 + application/models/Logbook_model.php | 53 +++++++++++++++++++++++++- assets/js/sections/bandmap_list.js | 9 ++++- 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/application/models/Dxcluster_model.php b/application/models/Dxcluster_model.php index 81ba7059..e40c4134 100644 --- a/application/models/Dxcluster_model.php +++ b/application/models/Dxcluster_model.php @@ -63,6 +63,7 @@ class Dxcluster_model extends CI_Model { if ( ($de != '') && ($de != 'Any') && (property_exists($singlespot->dxcc_spotter,'cont')) ){ // If we have a "de continent" and a filter-wish filter on that if (strtolower($de) == strtolower($singlespot->dxcc_spotter->cont ?? '')) { $singlespot->worked_call = ($this->logbook_model->check_if_callsign_worked_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1); + $singlespot->cnfmd_call = ($this->logbook_model->check_if_callsign_cnfmd_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1); array_push($spotsout,$singlespot); } } else { // No de continent? No Filter --> Just push diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index e2ef9073..277c4baa 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1676,7 +1676,58 @@ class Logbook_model extends CI_Model { } - function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = null, $band = null) { + function check_if_callsign_cnfmd_in_logbook($callsign, $StationLocationsArray = null, $band = null) { + $user_gridmap_confirmation = $this->session->userdata('user_gridmap_confirmation'); + + if($StationLocationsArray == null) { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + } else { + $logbooks_locations_array = $StationLocationsArray; + } + + $extrawhere=''; + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'Q') !== false) { + $extrawhere="COL_QSL_RCVD='Y'"; + } + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'L') !== false) { + if ($extrawhere!='') { + $extrawhere.=" OR"; + } + $extrawhere.=" COL_LOTW_QSL_RCVD='Y'"; + } + if (isset($user_gridmap_confirmation) && strpos($user_gridmap_confirmation, 'E') !== false) { + if ($extrawhere!='') { + $extrawherei.=" OR"; + } + $extrawhere.=" COL_EQSL_QSL_RCVD='Y'"; + } + + + $this->db->select('COL_CALL'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_CALL', $callsign); + + if($band != null && $band != 'SAT') { + $this->db->where('COL_BAND', $band); + } else if($band == 'SAT') { + // Where col_sat_name is not empty + $this->db->where('COL_SAT_NAME !=', ''); + } + if ($extrawhere != '') { + $this->db->where('('.$extrawhere.')'); + } else { + $this->db->where("1=0"); + } + $this->db->limit('2'); + $query = $this->db->get($this->config->item('table_name')); + + return $query->num_rows(); + + } + +function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = null, $band = null) { if($StationLocationsArray == null) { $CI =& get_instance(); diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index f11fab99..a69a250b 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -45,10 +45,17 @@ $(function() { dxspots.sort(SortByQrg); dxspots.forEach((single) => { var data=[]; + if (single.cnfmd_call) { + addon_class="text-success"; + } else if (single.worked_call) { + addon_class="text-warning"; + } else { + addon_class=""; + } data[0]=[]; data[0].push(single.when_pretty); data[0].push(single.frequency*1); - data[0].push((single.worked_call ?'' : '')+single.spotted+(single.worked_call ? '' : '')); + data[0].push((addon_class != '' ?'' : '')+single.spotted+(addon_class != '' ? '' : '')); data[0].push(single.dxcc_spotted.entity); data[0].push(single.spotter); if (oldtable.length > 0) {