Skip to content

Commit dfe4a17

Browse files
authored
2.8.7
2 parents bb5c869 + dfb0058 commit dfe4a17

40 files changed

Lines changed: 2723 additions & 428 deletions

File tree

application/config/migration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
|
2323
*/
2424

25-
$config['migration_version'] = 243;
25+
$config['migration_version'] = 244;
2626

2727
/*
2828
|--------------------------------------------------------------------------

application/controllers/Awards.php

Lines changed: 196 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,30 @@ private function build_sota_options($meta, $field) {
547547
*/
548548
public function wwff()
549549
{
550-
551-
// Grab all worked wwff stations
552550
$this->load->model('wwff');
553-
$data['wwff_all'] = $this->wwff->get_all();
551+
$this->load->model('modes');
552+
$this->load->model('bands');
553+
554+
$data['worked_bands'] = $this->bands->get_worked_bands('wwff');
555+
$data['modes'] = $this->modes->active();
556+
557+
if ($this->input->method() === 'post') {
558+
$postdata['band'] = $this->security->xss_clean($this->input->post('band'));
559+
$postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
560+
$postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl'));
561+
$postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw'));
562+
$postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl'));
563+
} else {
564+
$postdata['band'] = 'All';
565+
$postdata['mode'] = 'All';
566+
$postdata['qsl'] = 1;
567+
$postdata['lotw'] = 1;
568+
$postdata['eqsl'] = 0;
569+
}
570+
571+
$data['postdata'] = $postdata;
572+
$data['wwff_all'] = $this->wwff->get_all_filtered($postdata);
573+
$data['wwff_summary'] = $this->wwff->get_wwff_summary($postdata);
554574

555575
// Render page
556576
$data['page_title'] = "Awards - WWFF";
@@ -752,17 +772,40 @@ public function was()
752772
}
753773
public function wab()
754774
{
755-
// get worked squares from Worked_all_britain_model
775+
$footerData = [];
776+
$footerData['scripts'] = [
777+
'assets/js/sections/wab.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wab.js")),
778+
];
779+
756780
$this->load->model('worked_all_britain_model');
757-
$data['worked_squares'] = array_filter($this->worked_all_britain_model->get_worked_squares());
781+
$this->load->model('bands');
782+
$this->load->model('modes');
783+
784+
$data['worked_bands'] = $this->bands->get_worked_bands('wab') ?? [];
785+
$data['modes'] = $this->modes->active();
786+
787+
$filters = [];
788+
$filters['band'] = $this->input->post('band') ? $this->security->xss_clean($this->input->post('band')) : 'All';
789+
$filters['band'] = $filters['band'] ?: 'All';
790+
$filters['mode'] = $this->input->post('mode') ? $this->security->xss_clean($this->input->post('mode')) : 'All';
791+
$filters['mode'] = $filters['mode'] ?: 'All';
792+
$filters['confirmed_only'] = $this->input->post('confirmed_only') ? true : false;
758793

759-
$data['confirmed_squares'] = array_filter($this->worked_all_britain_model->get_confirmed_squares());
794+
$data['filters'] = $filters;
795+
796+
$data['worked_squares'] = array_filter($this->worked_all_britain_model->get_worked_squares($filters) ?? []);
797+
$data['confirmed_squares'] = array_filter($this->worked_all_britain_model->get_confirmed_squares($filters) ?? []);
798+
$data['worked_count'] = count($data['worked_squares']);
799+
$data['confirmed_count'] = count($data['confirmed_squares']);
800+
801+
$data['wab_qsos'] = $this->worked_all_britain_model->get_wab_qsos($filters);
802+
$data['filter_summary'] = $this->wab_filter_summary($filters);
760803

761804
// Render page
762805
$data['page_title'] = "Awards - Worked All Britain";
763806
$this->load->view('interface_assets/header', $data);
764807
$this->load->view('awards/wab/index');
765-
$this->load->view('interface_assets/footer');
808+
$this->load->view('interface_assets/footer', $footerData);
766809
}
767810

768811

@@ -828,20 +871,37 @@ public function gmdxsummer()
828871

829872
public function wab_details_ajax()
830873
{
831-
$this->load->model('logbook_model');
832-
833874
$wab = str_replace('"', "", $this->security->xss_clean($this->input->post("Wab")));
834875

835876
$wab = str_replace(["Small Square ", " Boundry Box"], "", $wab);
877+
$filters = [];
878+
$filters['band'] = $this->input->post('Band') ? $this->security->xss_clean($this->input->post('Band')) : 'All';
879+
$filters['band'] = $filters['band'] ?: 'All';
880+
$filters['mode'] = $this->input->post('Mode') ? $this->security->xss_clean($this->input->post('Mode')) : 'All';
881+
$filters['mode'] = $filters['mode'] ?: 'All';
882+
$filters['confirmed_only'] = $this->input->post('ConfirmedOnly') ? true : false;
883+
$filters['square'] = $wab;
836884

837-
$data['results'] = $this->logbook_model->wab_qso_details($wab);
885+
$this->load->model('worked_all_britain_model');
886+
$data['results'] = $this->worked_all_britain_model->get_wab_qsos($filters);
838887

839888
// Render Page
840889
$data['page_title'] = "Log View - WAB";
841-
$data['filter'] = "WAB " . $wab;
890+
$data['filter'] = "WAB " . $wab . ' · ' . $this->wab_filter_summary($filters);
842891
$this->load->view('awards/wab/details', $data);
843892
}
844893

894+
private function wab_filter_summary($filters)
895+
{
896+
$parts = [];
897+
$parts[] = ($filters['band'] ?? 'All') === 'All' ? 'All bands' : ($filters['band'] . ' band');
898+
$parts[] = ($filters['mode'] ?? 'All') === 'All' ? 'All modes' : ($filters['mode'] . ' mode');
899+
if (!empty($filters['confirmed_only'])) {
900+
$parts[] = 'Confirmed only';
901+
}
902+
return implode(' · ', $parts);
903+
}
904+
845905

846906
public function iota()
847907
{
@@ -1181,8 +1241,30 @@ public function sig()
11811241
{
11821242
// Grab all worked sig stations
11831243
$this->load->model('sig');
1244+
$this->load->model('bands');
1245+
$this->load->model('modes');
1246+
1247+
// Parse filters from POST
1248+
$filters = array();
1249+
if ($this->input->method() === 'post') {
1250+
$filters['band'] = $this->security->xss_clean($this->input->post('band')) ?: 'all';
1251+
$filters['mode'] = $this->security->xss_clean($this->input->post('mode')) ?: 'all';
1252+
$filters['confirmed_only'] = $this->security->xss_clean($this->input->post('confirmed_only'));
1253+
} else {
1254+
$filters['band'] = 'all';
1255+
$filters['mode'] = 'all';
1256+
$filters['confirmed_only'] = false;
1257+
}
1258+
1259+
$data['sig_types'] = $this->sig->get_all_sig_types($filters);
11841260

1185-
$data['sig_types'] = $this->sig->get_all_sig_types();
1261+
// Get available bands and modes
1262+
$data['bands'] = $this->bands->get_worked_bands('sig');
1263+
$data['modes'] = $this->sig->get_worked_modes();
1264+
1265+
// Pass filters to view
1266+
$data['active_filters'] = $filters;
1267+
$data['filter_summary'] = $this->_sig_filter_summary($filters);
11861268

11871269
// Render page
11881270
$data['page_title'] = "Awards - SIG";
@@ -1199,9 +1281,36 @@ public function sig_details()
11991281

12001282
// Grab all worked sig stations
12011283
$this->load->model('sig');
1284+
$this->load->model('bands');
1285+
$this->load->model('modes');
1286+
12021287
$type = str_replace('"', "", $this->security->xss_clean($this->input->get("type")));
1203-
$data['sig_all'] = $this->sig->get_all($type);
1288+
1289+
// Parse filters
1290+
$filters = array();
1291+
if ($this->input->method() === 'post') {
1292+
$filters['band'] = $this->security->xss_clean($this->input->post('band')) ?: 'all';
1293+
$filters['mode'] = $this->security->xss_clean($this->input->post('mode')) ?: 'all';
1294+
$filters['confirmed_only'] = $this->security->xss_clean($this->input->post('confirmed_only'));
1295+
} else {
1296+
$filters['band'] = 'all';
1297+
$filters['mode'] = 'all';
1298+
$filters['confirmed_only'] = false;
1299+
}
1300+
1301+
$data['sig_all'] = $this->sig->get_all($type, $filters);
12041302
$data['type'] = $type;
1303+
$data['filters'] = $filters;
1304+
1305+
// Get stats for this SIG type
1306+
$data['worked_refs'] = $this->sig->get_worked_sig_refs($type, $filters);
1307+
$data['confirmed_refs'] = $this->sig->get_confirmed_sig_refs($type, $filters);
1308+
1309+
// Get available bands and modes
1310+
$data['bands'] = $this->bands->get_worked_bands('sig');
1311+
$data['modes'] = $this->sig->get_worked_modes();
1312+
1313+
$data['filter_summary'] = $this->_sig_filter_summary($filters);
12051314

12061315
// Render page
12071316
$data['page_title'] = "Awards - SIG - " . $type;
@@ -1210,6 +1319,23 @@ public function sig_details()
12101319
$this->load->view('interface_assets/footer');
12111320
}
12121321

1322+
/**
1323+
* Helper: Generate human-readable filter summary for SIG
1324+
*/
1325+
private function _sig_filter_summary($filters) {
1326+
$parts = array();
1327+
if (!empty($filters['band']) && $filters['band'] !== 'all') {
1328+
$parts[] = $filters['band'] . " band";
1329+
}
1330+
if (!empty($filters['mode']) && $filters['mode'] !== 'all') {
1331+
$parts[] = $filters['mode'] . " mode";
1332+
}
1333+
if (!empty($filters['confirmed_only']) && ($filters['confirmed_only'] === true || $filters['confirmed_only'] === 'true')) {
1334+
$parts[] = "Confirmed only";
1335+
}
1336+
return !empty($parts) ? implode(" · ", $parts) : "";
1337+
}
1338+
12131339
/*
12141340
Handles exporting SIGS to ADIF
12151341
*/
@@ -1226,6 +1352,63 @@ public function sigexportadif()
12261352
$this->load->view('adif/data/exportall', $data);
12271353
}
12281354

1355+
public function sigexportcsv()
1356+
{
1357+
$this->load->model('sig');
1358+
1359+
$type = urldecode($this->security->xss_clean($this->uri->segment(3)));
1360+
$qsos = $this->sig->get_all($type)->result();
1361+
1362+
// Set headers for CSV download
1363+
header('Content-Type: text/csv; charset=utf-8');
1364+
header('Content-Disposition: attachment; filename=SIG_' . $type . '_' . date('Y-m-d') . '.csv');
1365+
1366+
// Open output stream
1367+
$output = fopen('php://output', 'w');
1368+
1369+
// Write header row
1370+
fputcsv($output, array(
1371+
'Reference',
1372+
'Date/Time',
1373+
'Callsign',
1374+
'Mode',
1375+
'Band',
1376+
'RST Sent',
1377+
'RST Received',
1378+
'QSL Status'
1379+
));
1380+
1381+
// Write data rows
1382+
foreach ($qsos as $row) {
1383+
$is_confirmed = ($row->COL_QSL_RCVD == 'Y' || $row->COL_EQSL_QSL_RCVD == 'Y' || $row->COL_LOTW_QSL_RCVD == 'Y');
1384+
1385+
$qsl_status = '';
1386+
if ($row->COL_LOTW_QSL_RCVD == 'Y') {
1387+
$qsl_status = 'LoTW';
1388+
} elseif ($row->COL_EQSL_QSL_RCVD == 'Y') {
1389+
$qsl_status = 'eQSL';
1390+
} elseif ($row->COL_QSL_RCVD == 'Y') {
1391+
$qsl_status = 'QSL';
1392+
} else {
1393+
$qsl_status = 'Unconfirmed';
1394+
}
1395+
1396+
fputcsv($output, array(
1397+
$row->COL_SIG_INFO,
1398+
date('d/m/y H:i', strtotime($row->COL_TIME_ON)),
1399+
$row->COL_CALL,
1400+
$row->COL_MODE,
1401+
$row->COL_BAND,
1402+
$row->COL_RST_SENT,
1403+
$row->COL_RST_RCVD,
1404+
$qsl_status
1405+
));
1406+
}
1407+
1408+
fclose($output);
1409+
exit;
1410+
}
1411+
12291412
/*
12301413
function was_map
12311414

0 commit comments

Comments
 (0)