feat: add WAPC map

This commit is contained in:
tallcode
2026-02-28 14:09:46 +08:00
parent 993c833915
commit 994b207ae5
4 changed files with 315 additions and 33 deletions

View File

@@ -200,6 +200,10 @@ class Awards extends CI_Controller {
public function wapc () {
$footerData = [];
$footerData['scripts'] = [
'assets/js/sections/wapcmap.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wapcmap.js")),
'assets/js/leaflet/L.Maidenhead.js',
];
$this->load->model('wapc');
$this->load->model('modes');
@@ -1705,6 +1709,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->security->xss_clean($this->input->post('band'));
$postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
$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