diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 2e6e881ec..e17e74909 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -200,6 +200,10 @@ class Awards extends CI_Controller { public function wapc () { $footerData = []; + $footerData['scripts'] = [ + 'assets/js/sections/wapcmap.js', + 'assets/js/leaflet/L.Maidenhead.js', + ]; $this->load->model('wapc'); $this->load->model('modes'); @@ -1698,6 +1702,58 @@ class Awards extends CI_Controller { echo json_encode($prefectures); } + /* + function wapc_map + */ + public function wapc_map() { + $this->load->model('wapc'); + $this->load->model('bands'); + + $bands[] = $this->security->xss_clean($this->input->post('band')); + + $postdata['qsl'] = $this->input->post('qsl') == 0 ? NULL: 1; + $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; + $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; + $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; + $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; + $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; + $postdata['band'] = $this->input->post('band', TRUE); + $postdata['mode'] = $this->input->post('mode', TRUE); + + $wapc_array = $this->wapc->get_wapc_array($bands, $postdata); + + $provinces = array(); + + $wapcArray = array_keys($this->wapc->cnProvinces); + foreach ($wapcArray as $state) { + $provinces[$state] = '-'; + } + + foreach ($wapc_array as $wapc => $value) { + foreach ($value as $key) { + if($key != "") { + if (strpos($key, '>W<') !== false) { + $provinces[$wapc] = 'W'; + break; + } + if (strpos($key, '>C<') !== false) { + $provinces[$wapc] = 'C'; + break; + } + if (strpos($key, '-') !== false) { + $provinces[$wapc] = '-'; + break; + } + } + } + } + + header('Content-Type: application/json'); + echo json_encode($provinces); + } + /* function dxcc_map This displays the DXCC map diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 6ecc4394f..b6c889838 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -624,8 +624,28 @@ class Logbook_model extends CI_Model { $this->db->where('COL_DXCC', '339'); break; case 'WAPC': - $this->db->where('COL_STATE', $searchphrase); - $this->db->where('COL_DXCC', '318'); + if($searchphrase == 'HK'){ + $this->db->where('COL_DXCC', '321'); + } + else if($searchphrase == 'MO'){ + $this->db->where('COL_DXCC', '152'); + } + else if($searchphrase == 'TW'){ + $this->db->where_in('COL_DXCC', ['386', '505']); + } + else if($searchphrase == 'HI'){ + $this->db->group_start() + ->group_start() + ->where('COL_DXCC', '318') + ->where('COL_STATE', 'HI') + ->group_end() + ->or_where('COL_DXCC', '506') + ->group_end(); + } + else{ + $this->db->where('COL_STATE', $searchphrase); + $this->db->where('COL_DXCC', '318'); + } break; case 'QSLRDATE': $this->db->where('date(COL_QSLRDATE)=date(SYSDATE())'); diff --git a/application/models/Wapc.php b/application/models/Wapc.php index 009c8a748..89b6186ac 100644 --- a/application/models/Wapc.php +++ b/application/models/Wapc.php @@ -81,17 +81,17 @@ class WAPC extends CI_Model { } // VR else if($line->col_dxcc == '321'){ - $bandWapc['HK'][$band] = '
'; + $bandWapc['HK'][$band] = ''; $provinces['HK']['count']++; } // XX9 else if($line->col_dxcc == '152'){ - $bandWapc['MO'][$band] = ''; + $bandWapc['MO'][$band] = ''; $provinces['MO']['count']++; } // BU-BX/BV9P else if($line->col_dxcc == '386' || $line->col_dxcc == '505'){ - $bandWapc['TW'][$band] = ''; + $bandWapc['TW'][$band] = ''; $provinces['TW']['count']++; } } @@ -111,17 +111,17 @@ class WAPC extends CI_Model { } // VR else if($line->col_dxcc == '321'){ - $bandWapc['HK'][$band] = ''; + $bandWapc['HK'][$band] = ''; $provinces['HK']['count']++; } // XX9 else if($line->col_dxcc == '152'){ - $bandWapc['MO'][$band] = ''; + $bandWapc['MO'][$band] = ''; $provinces['MO']['count']++; } // BU-BX/BV9P else if($line->col_dxcc == '386' || $line->col_dxcc == '505'){ - $bandWapc['TW'][$band] = ''; + $bandWapc['TW'][$band] = ''; $provinces['MO']['count']++; } } diff --git a/application/views/awards/wapc/index.php b/application/views/awards/wapc/index.php index 64f64c405..4046c2281 100644 --- a/application/views/awards/wapc/index.php +++ b/application/views/awards/wapc/index.php @@ -1,3 +1,18 @@ + + + +