[ITU Award] Speed increase

This commit is contained in:
Andreas Kristiansen
2026-02-25 09:54:52 +01:00
parent b57440c9c8
commit 3af87733be
4 changed files with 446 additions and 299 deletions

View File

@@ -1978,9 +1978,9 @@ class Awards extends CI_Controller {
$this->load->model('itu');
$this->load->model('modes');
$this->load->model('bands');
$data['user_map_custom'] = $this->optionslib->get_map_custom();
$data['worked_bands'] = $this->bands->get_worked_bands('cq');
$data['user_map_custom'] = $this->optionslib->get_map_custom();
$data['modes'] = $this->modes->active(); // Used in the view for mode select
if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
@@ -1997,35 +1997,43 @@ class Awards extends CI_Controller {
$data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view
if($this->input->method() === 'post') {
$postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl'));
$postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw'));
$postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl'));
$postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz'));
$postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog'));
$postdata['worked'] = $this->security->xss_clean($this->input->post('worked'));
$postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed'));
$postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked'));
$postdata['band'] = $this->security->xss_clean($this->input->post('band'));
$postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
}
else { // Setting default values at first load of page
$postdata['qsl'] = 1;
$postdata['lotw'] = 1;
$postdata['eqsl'] = 0;
$postdata['qrz'] = 0;
$postdata['clublog'] = 0;
$postdata['worked'] = 1;
$postdata['confirmed'] = 1;
$postdata['notworked'] = 1;
$postdata['band'] = 'All';
if($this->input->method() === 'post') {
$postdata['qsl'] = ($this->input->post('qsl',true) ?? 0) == 0 ? NULL: 1;
$postdata['lotw'] = ($this->input->post('lotw',true) ?? 0) == 0 ? NULL: 1;
$postdata['eqsl'] = ($this->input->post('eqsl',true) ?? 0) == 0 ? NULL: 1;
$postdata['qrz'] = ($this->input->post('qrz',true) ?? 0) == 0 ? NULL: 1;
$postdata['clublog'] = ($this->input->post('clublog',true) ?? 0) == 0 ? NULL: 1;
$postdata['worked'] = ($this->input->post('worked',true) ?? 0) == 0 ? NULL: 1;
$postdata['confirmed'] = ($this->input->post('confirmed',true) ?? 0) == 0 ? NULL: 1;
$postdata['notworked'] = ($this->input->post('notworked',true) ?? 0) == 0 ? NULL: 1;
$postdata['band'] = $this->security->xss_clean($this->input->post('band'));
$postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
$postdata['datefrom'] = $this->security->xss_clean($this->input->post('dateFrom'));
$postdata['dateto'] = $this->security->xss_clean($this->input->post('dateTo'));
}
else { // Setting default values at first load of page
$postdata['qsl'] = 1;
$postdata['lotw'] = 1;
$postdata['eqsl'] = NULL;
$postdata['qrz'] = NULL;
$postdata['clublog'] = NULL;
$postdata['worked'] = 1;
$postdata['confirmed'] = 1;
$postdata['notworked'] = 1;
$postdata['band'] = 'All';
$postdata['mode'] = 'All';
}
$postdata['datefrom'] = null;
$postdata['dateto'] = null;
}
$data['posted_band'] = $postdata['band'];
if ($logbooks_locations_array) {
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$data['itu_array'] = $this->itu->get_itu_array($bands, $postdata, $location_list);
$data['itu_summary'] = $this->itu->get_itu_summary($bands, $postdata, $location_list);
$itu_result = $this->itu->get_itu_array($bands, $postdata, $location_list);
// Extract bands data and summary from the result
$data['itu_array'] = ($itu_result && isset($itu_result['bands'])) ? $itu_result['bands'] : null;
$data['itu_summary'] = ($itu_result && isset($itu_result['summary'])) ? $itu_result['summary'] : null;
} else {
$location_list = null;
$data['itu_array'] = null;
@@ -2048,8 +2056,16 @@ class Awards extends CI_Controller {
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('itu');
$this->load->model('bands');
$bands[] = $this->input->post('band');
$data['worked_bands'] = $this->bands->get_worked_bands('cq');
if ($this->input->post('band') == 'All') {
$bands = $data['worked_bands'];
}
else {
$bands[] = $this->input->post('band');
}
$postdata['qsl'] = $this->input->post('qsl') == 0 ? NULL: 1;
$postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1;
@@ -2061,34 +2077,15 @@ class Awards extends CI_Controller {
$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'));
$postdata['datefrom'] = $this->security->xss_clean($this->input->post('dateFrom'));
$postdata['dateto'] = $this->security->xss_clean($this->input->post('dateTo'));
if ($logbooks_locations_array) {
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$itu_array = $this->itu->get_itu_array($bands, $postdata, $location_list);
$zones = $this->itu->get_itu_array($bands, $postdata, $location_list, true);
} else {
$location_list = null;
$itu_array = null;
}
$zones = array();
foreach ($itu_array as $itu => $value) {
foreach ($value as $key) {
if($key != "") {
if (strpos($key, '>W<') !== false) {
$zones[] = 'W';
break;
}
if (strpos($key, '>C<') !== false) {
$zones[] = 'C';
break;
}
if (strpos($key, '-') !== false) {
$zones[] = '-';
break;
}
}
}
$zones = array();
}
header('Content-Type: application/json');

View File

@@ -1,12 +1,12 @@
<?php
class Itu extends CI_Model{
class ITU extends CI_Model{
function __construct() {
$this->load->library('Genfunctions');
}
function get_itu_array($bands, $postdata, $location_list) {
function get_itu_array($bands, $postdata, $location_list, $map = false) {
$ituZ = array(); // Used for keeping track of which states that are not worked
for ($i = 1; $i <= 90; $i++) {
@@ -15,65 +15,224 @@ class Itu extends CI_Model{
$qsl = $this->genfunctions->gen_qsl_from_postdata($postdata);
// Initialize all bands to dash
foreach ($bands as $band) {
for ($i = 1; $i <= 90; $i++) {
$banditu[$i][$band] = '-'; // Sets all to dash to indicate no result
$bandItu[$i][$band] = '-'; // Sets all to dash to indicate no result
}
}
// Initialize summary counters only for the bands passed in
foreach ($bands as $band) {
$summary['worked'][$band] = 0;
$summary['confirmed'][$band] = 0;
}
$summary['worked']['Total'] = 0;
$summary['confirmed']['Total'] = 0;
// Track unique zone/band combinations for totals
$workedZones = []; // [band][zone] = true
$confirmedZones = []; // [band][zone] = true
// Create a lookup array for valid bands
$validBands = array_flip($bands); // ['160m' => true, '80m' => true, etc]
$itudata = $this->getItuZoneData($location_list, $postdata);
$itudata_sat = $this->getItuZoneDataSat($location_list, $postdata);
foreach ($itudata as $itu) {
// Skip if this band is not in our requested bands list
if (!isset($validBands[$itu->col_band])) {
continue;
}
if ($postdata['worked'] != NULL) {
$ituBand = $this->getituWorked($location_list, $band, $postdata);
foreach ($ituBand as $line) {
$banditu[$line->col_ituz][$band] = '<div class="bg-danger awardsBgWarning"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $line->col_ituz) . '","' . $band . '","All", "All","'. $postdata['mode'] . '","ITU","")\'>W</a></div>';
$ituZ[$line->col_ituz]['count']++;
$ituZ[$itu->col_ituz]['count']++; // Count each itu zone
// Check if confirmed based on the confirmation types selected in postdata
$isConfirmed = false;
$confirmationLetters = '';
if (isset($postdata['qsl']) && $postdata['qsl'] == 1 && $itu->qsl == 1) {
$isConfirmed = true;
$confirmationLetters .= 'Q';
}
if (isset($postdata['lotw']) && $postdata['lotw'] == 1 && $itu->lotw == 1) {
$isConfirmed = true;
$confirmationLetters .= 'L';
}
if (isset($postdata['eqsl']) && $postdata['eqsl'] == 1 && $itu->eqsl == 1) {
$isConfirmed = true;
$confirmationLetters .= 'E';
}
if (isset($postdata['qrz']) && $postdata['qrz'] == 1 && $itu->qrz == 1) {
$isConfirmed = true;
$confirmationLetters .= 'Z';
}
if (isset($postdata['clublog']) && $postdata['clublog'] == 1 && $itu->clublog == 1) {
$isConfirmed = true;
$confirmationLetters .= 'C';
}
if ($isConfirmed) {
$bandItu[$itu->col_ituz][$itu->col_band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $itu->col_ituz) . '","' . $itu->col_band . '","All", "All","'. $postdata['mode'] . '","ITUZone","'.$qsl.'")\'>' . $confirmationLetters . '</a></div>';
// Track confirmed zones for summary
if (!isset($confirmedZones[$itu->col_band][$itu->col_ituz])) {
$confirmedZones[$itu->col_band][$itu->col_ituz] = true;
$summary['confirmed'][$itu->col_band]++;
}
} else {
$bandItu[$itu->col_ituz][$itu->col_band] = '<div class="bg-danger awardsBgWarning"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $itu->col_ituz) . '","' . $itu->col_band . '","All", "All","'. $postdata['mode'] . '","ITUZone","")\'>W</a></div>';
}
// Track worked zones for summary
if (!isset($workedZones[$itu->col_band][$itu->col_ituz])) {
$workedZones[$itu->col_band][$itu->col_ituz] = true;
$summary['worked'][$itu->col_band]++;
}
}
foreach ($itudata_sat as $itu) {
// Skip if this band is not in our requested bands list
if (!isset($validBands[$itu->col_band])) {
continue;
}
$ituZ[$itu->col_ituz]['count']++; // Count each itu zone
// Check if confirmed based on the confirmation types selected in postdata
$isConfirmed = false;
$confirmationLetters = '';
if (isset($postdata['qsl']) && $postdata['qsl'] == 1 && $itu->qsl == 1) {
$isConfirmed = true;
$confirmationLetters .= 'Q';
}
if (isset($postdata['lotw']) && $postdata['lotw'] == 1 && $itu->lotw == 1) {
$isConfirmed = true;
$confirmationLetters .= 'L';
}
if (isset($postdata['eqsl']) && $postdata['eqsl'] == 1 && $itu->eqsl == 1) {
$isConfirmed = true;
$confirmationLetters .= 'E';
}
if (isset($postdata['qrz']) && $postdata['qrz'] == 1 && $itu->qrz == 1) {
$isConfirmed = true;
$confirmationLetters .= 'Z';
}
if (isset($postdata['clublog']) && $postdata['clublog'] == 1 && $itu->clublog == 1) {
$isConfirmed = true;
$confirmationLetters .= 'C';
}
if ($isConfirmed) {
$bandItu[$itu->col_ituz][$itu->col_band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $itu->col_ituz) . '","' . $itu->col_band . '","All", "All","'. $postdata['mode'] . '","ITUZone","'.$qsl.'")\'>' . $confirmationLetters . '</a></div>';
// Track confirmed zones for summary
if (!isset($confirmedZones[$itu->col_band][$itu->col_ituz])) {
$confirmedZones[$itu->col_band][$itu->col_ituz] = true;
$summary['confirmed'][$itu->col_band]++;
}
} else {
$bandItu[$itu->col_ituz][$itu->col_band] = '<div class="bg-danger awardsBgWarning"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $itu->col_ituz) . '","' . $itu->col_band . '","All", "All","'. $postdata['mode'] . '","ITUZone","")\'>W</a></div>';
}
// Track worked zones for summary
if (!isset($workedZones[$itu->col_band][$itu->col_ituz])) {
$workedZones[$itu->col_band][$itu->col_ituz] = true;
$summary['worked'][$itu->col_band]++;
}
}
// Calculate totals across all bands (excluding SAT)
$totalWorkedZones = [];
$totalConfirmedZones = [];
foreach ($workedZones as $band => $zones) {
// Skip SAT for totals
if ($band === 'SAT') {
continue;
}
foreach ($zones as $zone => $true) {
if (!isset($totalWorkedZones[$zone])) {
$totalWorkedZones[$zone] = true;
$summary['worked']['Total']++;
}
}
if ($postdata['confirmed'] != NULL) {
$ituBand = $this->getituConfirmed($location_list, $band, $postdata);
foreach ($ituBand as $line) {
$banditu[$line->col_ituz][$band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $line->col_ituz) . '","' . $band . '","All", "All","'. $postdata['mode'] . '","ITU","'.$qsl.'")\'>C</a></div>';
$ituZ[$line->col_ituz]['count']++;
}
foreach ($confirmedZones as $band => $zones) {
// Skip SAT for totals
if ($band === 'SAT') {
continue;
}
foreach ($zones as $zone => $true) {
if (!isset($totalConfirmedZones[$zone])) {
$totalConfirmedZones[$zone] = true;
$summary['confirmed']['Total']++;
}
}
}
// We want to remove the worked zones in the list, since we do not want to display them
if ($postdata['worked'] == NULL) {
$ituBand = $this->getituWorked($location_list, $postdata['band'], $postdata);
foreach ($ituBand as $line) {
unset($banditu[$line->col_ituz]);
// Remove zones based on postdata filters
for ($i = 1; $i <= 90; $i++) {
// Remove not-worked zones if filter is disabled
if ($postdata['notworked'] == NULL && $ituZ[$i]['count'] == 0) {
unset($bandItu[$i]);
continue;
}
// Remove worked-only zones if filter is disabled
if ($postdata['worked'] == NULL && $ituZ[$i]['count'] > 0 && !isset($totalConfirmedZones[$i])) {
unset($bandItu[$i]);
continue;
}
// Remove confirmed zones if filter is disabled
if ($postdata['confirmed'] == NULL && isset($totalConfirmedZones[$i])) {
unset($bandItu[$i]);
continue;
}
}
// We want to remove the confirmed zones in the list, since we do not want to display them
if ($postdata['confirmed'] == NULL) {
$ituBand = $this->getituConfirmed($location_list, $postdata['band'], $postdata);
foreach ($ituBand as $line) {
unset($banditu[$line->col_ituz]);
// If this is for the map, return simplified format
if ($map) {
$mapZones = [];
if ($bands[0] == 'SAT') {
for ($i = 1; $i <= 90; $i++) {
if ($ituZ[$i]['count'] == 0) {
$mapZones[$i-1] = '-'; // Not worked
} elseif (isset($confirmedZones['SAT'][$i])) {
$mapZones[$i-1] = 'C'; // Confirmed
} else {
$mapZones[$i-1] = 'W'; // Worked but not confirmed
}
}
} else {
for ($i = 1; $i <= 90; $i++) {
if (isset($totalConfirmedZones[$i])) {
$mapZones[$i-1] = 'C'; // Confirmed
} else if (isset($totalWorkedZones[$i])) {
$mapZones[$i-1] = 'W'; // Worked but not confirmed
} else {
$mapZones[$i-1] = '-'; // Not worked
}
}
}
return $mapZones;
}
if ($postdata['notworked'] == NULL) {
for ($i = 1; $i <= 90; $i++) {
if ($ituZ[$i]['count'] == 0) {
unset($banditu[$i]);
};
}
}
if (isset($banditu)) {
return $banditu;
if (isset($bandItu)) {
// Return both the band data and summary
return ['bands' => $bandItu, 'summary' => $summary];
} else {
return 0;
}
}
/*
* Function returns all worked, but not confirmed states
* $postdata contains data from the form, in this case Lotw or QSL are used
*/
function getituWorked($location_list, $band, $postdata) {
function getItuZoneData($location_list, $postdata) {
$bindings=[];
$sql = "SELECT distinct col_ituz FROM " . $this->config->item('table_name') . " thcv
$sql = "SELECT thcv.col_ituz, thcv.col_band,
MAX(case when thcv.col_lotw_qsl_rcvd ='Y' then 1 else 0 end) as lotw,
MAX(case when thcv.col_qsl_rcvd = 'Y' then 1 else 0 end) as qsl,
MAX(case when thcv.col_eqsl_qsl_rcvd = 'Y' then 1 else 0 end) as eqsl,
MAX(case when thcv.COL_QRZCOM_QSO_DOWNLOAD_STATUS= 'Y' then 1 else 0 end) as qrz,
MAX(case when thcv.COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y' then 1 else 0 end) as clublog
FROM " . $this->config->item('table_name') . " thcv
where station_id in (" . $location_list . ") and col_ituz <= 90 and col_ituz <> ''";
if ($postdata['mode'] != 'All') {
@@ -82,36 +241,34 @@ class Itu extends CI_Model{
$bindings[]=$postdata['mode'];
}
$sql .= $this->genfunctions->addBandToQuery($band,$bindings);
$sql .= " and not exists (select 1 from " . $this->config->item('table_name') .
" where station_id in (" . $location_list .
") and col_ituz = thcv.col_ituz and col_ituz <> '' ";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[]=$postdata['mode'];
$bindings[]=$postdata['mode'];
if ($postdata['datefrom'] != NULL) {
$sql .= " and col_time_on >= ?";
$bindings[]=$postdata['datefrom'] . ' 00:00:00';
}
$sql .= $this->genfunctions->addBandToQuery($band,$bindings);
if ($postdata['dateto'] != NULL) {
$sql .= " and col_time_on <= ?";
$bindings[]=$postdata['dateto'] . ' 23:59:59';
}
$sql .= $this->genfunctions->addQslToQuery($postdata);
$sql .= " and col_prop_mode != 'SAT'";
$sql .= ")";
$sql .= " GROUP BY thcv.col_ituz, thcv.col_band";
$query = $this->db->query($sql,$bindings);
return $query->result();
}
/*
* Function returns all confirmed states on given band and on LoTW or QSL
* $postdata contains data from the form, in this case Lotw or QSL are used
*/
function getituConfirmed($location_list, $band, $postdata) {
function getItuZoneDataSat($location_list, $postdata) {
$bindings=[];
$sql = "SELECT distinct col_ituz FROM " . $this->config->item('table_name') . " thcv
$sql = "SELECT thcv.col_ituz, 'SAT' as col_band,
MAX(case when thcv.col_lotw_qsl_rcvd ='Y' then 1 else 0 end) as lotw,
MAX(case when thcv.col_qsl_rcvd = 'Y' then 1 else 0 end) as qsl,
MAX(case when thcv.col_eqsl_qsl_rcvd = 'Y' then 1 else 0 end) as eqsl,
MAX(case when thcv.COL_QRZCOM_QSO_DOWNLOAD_STATUS= 'Y' then 1 else 0 end) as qrz,
MAX(case when thcv.COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y' then 1 else 0 end) as clublog
FROM " . $this->config->item('table_name') . " thcv
where station_id in (" . $location_list . ") and col_ituz <= 90 and col_ituz <> ''";
if ($postdata['mode'] != 'All') {
@@ -120,106 +277,23 @@ class Itu extends CI_Model{
$bindings[]=$postdata['mode'];
}
$sql .= $this->genfunctions->addBandToQuery($band,$bindings);
if ($postdata['datefrom'] != NULL) {
$sql .= " and col_time_on >= ?";
$bindings[]=$postdata['datefrom'] . ' 00:00:00';
}
$sql .= $this->genfunctions->addQslToQuery($postdata);
if ($postdata['dateto'] != NULL) {
$sql .= " and col_time_on <= ?";
$bindings[]=$postdata['dateto'] . ' 23:59:59';
}
$sql .= " and col_prop_mode = 'SAT'";
$sql .= " GROUP BY thcv.col_ituz";
$query = $this->db->query($sql,$bindings);
return $query->result();
}
/*
* Function gets worked and confirmed summary on each band on the active stationprofile
*/
function get_itu_summary($bands, $postdata, $location_list) {
foreach ($bands as $band) {
$worked = $this->getSummaryByBand($band, $postdata, $location_list);
$confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list);
$ituSummary['worked'][$band] = $worked[0]->count;
$ituSummary['confirmed'][$band] = $confirmed[0]->count;
}
$workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list);
$confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list);
$ituSummary['worked']['Total'] = $workedTotal[0]->count;
$ituSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
return $ituSummary;
}
function getSummaryByBand($band, $postdata, $location_list) {
$bindings=[];
$sql = "SELECT count(distinct thcv.col_ituz) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id in (" . $location_list . ') and col_ituz <= 90 and col_ituz > 0';
if ($band == 'SAT') {
$sql .= " and thcv.col_prop_mode = ?";
$bindings[]=$band;
} else if ($band == 'All') {
$this->load->model('bands');
$bandslots = $this->bands->get_worked_bands('cq');
$bandslots_list = "'".implode("','",$bandslots)."'";
$sql .= " and thcv.col_band in (" . $bandslots_list . ")" .
" and thcv.col_prop_mode !='SAT'";
} else {
$sql .= " and thcv.col_prop_mode !='SAT'";
$sql .= " and thcv.col_band = ?";
$bindings[]=$band;
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[]=$postdata['mode'];
$bindings[]=$postdata['mode'];
}
$query = $this->db->query($sql,$bindings);
return $query->result();
}
function getSummaryByBandConfirmed($band, $postdata, $location_list){
$bindings=[];
$sql = "SELECT count(distinct thcv.col_ituz) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id in (" . $location_list . ') and col_ituz <= 90 and col_ituz > 0';
if ($band == 'SAT') {
$sql .= " and thcv.col_prop_mode = ?";
$bindings[]=$band;
} else if ($band == 'All') {
$this->load->model('bands');
$bandslots = $this->bands->get_worked_bands('cq');
$bandslots_list = "'".implode("','",$bandslots)."'";
$sql .= " and thcv.col_band in (" . $bandslots_list . ")" .
" and thcv.col_prop_mode !='SAT'";
} else {
$sql .= " and thcv.col_prop_mode !='SAT'";
$sql .= " and thcv.col_band = ?";
$bindings[]=$band;
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[]=$postdata['mode'];
$bindings[]=$postdata['mode'];
}
$sql .= $this->genfunctions->addQslToQuery($postdata);
$query = $this->db->query($sql, $bindings);
return $query->result();
}
}

View File

@@ -31,96 +31,130 @@
</div>
<!-- End of Award Info Box -->
<form class="form" action="<?php echo site_url('awards/itu'); ?>" method="post" enctype="multipart/form-data">
<fieldset>
<div class="mb-4 text-center">
<div class="dropdown" data-bs-auto-close="outside">
<button class="btn btn-sm btn-primary dropdown-toggle" type="button" id="filterDropdown" data-bs-toggle="dropdown" aria-expanded="false"><?= __("Filters") ?></button>
<button id="button1id" type="submit" name="button1id" class="btn btn-sm btn-primary"><?= __("Show"); ?></button>
<?php if ($itu_array) {
?><button type="button" onclick="load_itu_map();" class="btn btn-info btn-sm"><i class="fas fa-globe-americas"></i> <?= __("Show ITU Zone Map"); ?></button>
<?php }?>
<!-- Multiple Checkboxes (inline) -->
<div class="mb-3 row">
<div class="col-md-2" for="checkboxes"><?= __("Worked") . ' / ' . __("Confirmed")?></div>
<div class="col-md-10">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="worked" id="worked" value="1" <?php if ($this->input->post('worked') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="worked"><?= __("Show worked"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="confirmed" id="confirmed" value="1" <?php if ($this->input->post('confirmed') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="confirmed"><?= __("Show confirmed"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="notworked" id="notworked" value="1" <?php if ($this->input->post('notworked') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="notworked"><?= __("Show not worked"); ?></label>
</div>
</div>
</div>
<!-- Dropdown Menu with Filter Content -->
<div class="dropdown-menu start-50 translate-middle-x p-3 mt-5 dropdown-filters-responsive" aria-labelledby="filterDropdown" style="max-width: 800px;">
<div class="card-body filterbody">
<div class="row mb-3">
<label class="form-label" for="checkboxes"><?= __("Date Presets") . ": " ?></label>
<div class="d-flex gap-1 d-flex flex-wrap">
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('today')"><?= __("Today") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('yesterday')"><?= __("Yesterday") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('last7days')"><?= __("Last 7 Days") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('last30days')"><?= __("Last 30 Days") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('thismonth')"><?= __("This Month") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('lastmonth')"><?= __("Last Month") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('thisyear')"><?= __("This Year") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('lastyear')"><?= __("Last Year") ?></button>
<button type="button" class="btn btn-danger btn-sm flex-shrink-0" onclick="resetDates()"><i class="fas fa-times"></i> <?= __("Clear") ?></button>
</div>
</div>
<div class="mb-3 row">
<div class="col-md-2"><?= __("Show QSO with QSL Type"); ?></div>
<div class="col-md-10">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="qsl" value="1" id="qsl" <?php if ($this->input->post('qsl') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="qsl"><?= __("QSL Card"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="lotw" value="1" id="lotw" <?php if ($this->input->post('lotw') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="lotw"><?= __("LoTW"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="eqsl" value="1" id="eqsl" <?php if ($this->input->post('eqsl')) echo ' checked="checked"'; ?> >
<label class="form-check-label" for="eqsl"><?= __("eQSL"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="qrz" value="1" id="qrz" <?php if ($this->input->post('qrz')) echo ' checked="checked"'; ?> >
<label class="form-check-label" for="qrz"><?= __("QRZ.com"); ?></label>
</div>
</div>
</div>
<div class="mb-3 row">
<div class="col-md-2 control-label" for="checkboxes"><?= __("Date from"); ?></div>
<div class="col-md-10">
<div class="form-check-inline">
<input name="dateFrom" id="dateFrom" type="date" class="form-control form-control-sm w-auto border border-secondary" <?php if ($this->input->post('dateFrom', TRUE)) echo 'value="' . $this->input->post('dateFrom', TRUE) . '"'; ?>>
</div>
</div>
</div>
<div class="mb-3 row">
<div class="col-md-2 control-label" for="checkboxes"><?= __("Date to"); ?></div>
<div class="col-md-10">
<div class="form-check-inline">
<input name="dateTo" id="dateTo" type="date" class="form-control form-control-sm w-auto border border-secondary" <?php if ($this->input->post('dateTo', TRUE)) echo 'value="' . $this->input->post('dateTo', TRUE) . '"'; ?>>
</div>
</div>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" for="band2"><?= __("Band"); ?></label>
<div class="col-md-2">
<select id="band2" name="band" class="form-select form-select-sm">
<option value="All" <?php if ($this->input->post('band') == "All" || $this->input->method() !== 'post') echo ' selected'; ?> ><?= __("All"); ?></option>
<?php foreach($worked_bands as $band) {
echo '<option value="' . $band . '"';
if ($this->input->post('band') == $band) echo ' selected';
echo '>' . $band . '</option>'."\n";
} ?>
</select>
</div>
</div>
<!-- Multiple Checkboxes (inline) -->
<div class="mb-3 row">
<div class="col-md-2" for="checkboxes"><?= __("Worked") . ' / ' . __("Confirmed")?></div>
<div class="col-md-10">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="worked" id="worked" value="1" <?php if ($this->input->post('worked', TRUE) || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="worked"><?= __("Show worked"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="confirmed" id="confirmed" value="1" <?php if ($this->input->post('confirmed', TRUE) || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="confirmed"><?= __("Show confirmed"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="notworked" id="notworked" value="1" <?php if ($this->input->post('notworked', TRUE) || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="notworked"><?= __("Show not worked"); ?></label>
</div>
</div>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" for="mode"><?= __("Mode"); ?></label>
<div class="col-md-2">
<select id="mode" name="mode" class="form-select form-select-sm">
<option value="All" <?php if ($this->input->post('mode') == "All" || $this->input->method() !== 'mode') echo ' selected'; ?>><?= __("All"); ?></option>
<?php
foreach($modes->result() as $mode){
if ($mode->submode == null) {
echo '<option value="' . $mode->mode . '"';
if ($this->input->post('mode') == $mode->mode) echo ' selected';
echo '>'. $mode->mode . '</option>'."\n";
} else {
echo '<option value="' . $mode->submode . '"';
if ($this->input->post('mode') == $mode->submode) echo ' selected';
echo '>' . $mode->submode . '</option>'."\n";
<div class="mb-3 row">
<div class="col-md-2"><?= __("Show QSO with QSL Type"); ?></div>
<div class="col-md-10">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="qsl" value="1" id="qsl" <?php if ($this->input->post('qsl', TRUE) || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="qsl"><?= __("QSL Card"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="lotw" value="1" id="lotw" <?php if ($this->input->post('lotw', TRUE) || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="lotw"><?= __("LoTW"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="eqsl" value="1" id="eqsl" <?php if ($this->input->post('eqsl', TRUE)) echo ' checked="checked"'; ?> >
<label class="form-check-label" for="eqsl"><?= __("eQSL"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="qrz" value="1" id="qrz" <?php if ($this->input->post('qrz', TRUE)) echo ' checked="checked"'; ?> >
<label class="form-check-label" for="qrz"><?= __("QRZ.com"); ?></label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="clublog" value="1" id="clublog" <?php if ($this->input->post('clublog', TRUE)) echo ' checked="checked"'; ?> >
<label class="form-check-label" for="clublog"><?= __("Clublog"); ?></label>
</div>
</div>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" for="band2"><?= __("Band"); ?></label>
<div class="col-md-3">
<select id="band2" name="band" class="form-select form-select-sm">
<option value="All" <?php if ($this->input->post('band', TRUE) == "All" || $this->input->method() !== 'post') echo ' selected'; ?> ><?= __("All"); ?></option>
<?php foreach($worked_bands as $band) {
echo '<option value="' . $band . '"';
if ($this->input->post('band', TRUE) == $band) echo ' selected';
echo '>' . $band . '</option>'."\n";
} ?>
</select>
</div>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" for="mode"><?= __("Mode"); ?></label>
<div class="col-md-3">
<select id="mode" name="mode" class="form-select form-select-sm">
<option value="All" <?php if ($this->input->post('mode', TRUE) == "All" || $this->input->method() !== 'mode') echo ' selected'; ?>><?= __("All"); ?></option>
<?php
foreach($modes->result() as $mode){
if ($mode->submode == null) {
echo '<option value="' . $mode->mode . '"';
if ($this->input->post('mode', TRUE) == $mode->mode) echo ' selected';
echo '>'. $mode->mode . '</option>'."\n";
} else {
echo '<option value="' . $mode->submode . '"';
if ($this->input->post('mode', TRUE) == $mode->submode) echo ' selected';
echo '>' . $mode->submode . '</option>'."\n";
}
}
}
?>
</select>
?>
</select>
</div>
</div>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" for="button1id"></label>
<div class="col-md-10">
<button id="button2id" type="reset" name="button2id" class="btn btn-sm btn-warning"><?= __("Reset"); ?></button>
<button id="button1id" type="submit" name="button1id" class="btn btn-sm btn-primary"><?= __("Show"); ?></button>
<?php if ($itu_array) {
?><button type="button" onclick="load_itu_map();" class="btn btn-info btn-sm"><i class="fas fa-globe-americas"></i> <?= __("Show ITU Zone Map"); ?></button>
<?php }?>
</div>
</div>
</fieldset>
</div>
</form>
<ul class="nav nav-tabs" id="myTab" role="tablist">
@@ -146,12 +180,19 @@
<?php
$i = 1;
if ($itu_array) {
echo __('Legend:');
echo '<pre>'.__("(Q)SL-Paper-Card").", ";
echo __("(L)oTW").", ";
echo __("(e)QSL").", ";
echo __('QR(Z)-"confirmation"').", ";
echo __("(C)lublog").", ";
echo __("(W)orked").'</pre>';
echo "
<table style='width:100%' class='table tableitu table-sm table-bordered table-hover table-striped table-condensed text-center'>
<thead>
<tr>
<td>#</td>
<td>".__("ITU Zone")."</td>";
<td>" . __("ITU Zone") . "</td>";
foreach($bands as $band) {
echo '<td>' . $band . '</td>';
}
@@ -174,24 +215,58 @@
<thead>
<tr><td></td>";
foreach($bands as $band) {
echo '<td>' . $band . '</td>';
}
echo "<td>" . __("Total") . "</td></tr>
</thead>
$addsat='';
foreach($bands as $band) {
if ($band != 'SAT') {
echo '<td>' . $band . '</td>';
} else {
$addsat='<td>' . $band . '</td>';
}
}
if ($posted_band != 'SAT') {
echo '<td><b>' . __("Total (ex SAT)") . '</b></td>';
}
if (count($bands) > 1) {
echo '<td class="spacingcell"></td>';
}
echo $addsat;
echo "</thead>
<tbody>
<tr><td>" . __("Total worked") . "</td>";
foreach ($itu_summary['worked'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
$sat_value = '';
foreach ($itu_summary['worked'] as $ituz => $value) {
if ($posted_band == 'SAT' && $ituz == 'Total') {
continue;
}
if ($ituz == 'SAT') {
$sat_value = '<td style="text-align: center"' . ($ituz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
} else {
echo '<td style="text-align: center"' . ($ituz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
}
}
if (count($bands) > 1) {
echo '<td class="spacingcell"></td>';
}
echo $sat_value;
echo "</tr><tr>
<td>" . __("Total confirmed") . "</td>";
foreach ($itu_summary['confirmed'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
$sat_value = '';
foreach ($itu_summary['confirmed'] as $ituz => $value) {
if ($posted_band == 'SAT' && $ituz == 'Total') {
continue;
}
if ($ituz == 'SAT') {
$sat_value = '<td style="text-align: center"' . ($ituz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
} else {
echo '<td style="text-align: center"' . ($ituz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
}
}
if (count($bands) > 1) {
echo '<td class="spacingcell"></td>';
}
echo $sat_value;
echo '</tr>
</table>
@@ -199,7 +274,7 @@
}
else {
echo '<div class="alert alert-danger" role="alert">'.__("Nothing found!").'</div>';
echo '<div class="alert alert-danger" role="alert">' . __("Nothing found!") . '</div>';
}
?>

View File

@@ -199,7 +199,8 @@ function load_itu_map2(data) {
legend.onAdd = function(map) {
var div = L.DomUtil.create("div", "legend");
div.innerHTML += "<h4>" + lang_general_word_colors + "</h4>";
var band = $('#band2').val();
div.innerHTML += "<h4>Band: " + band + "</h4>";
div.innerHTML += "<i style='background: " + confirmedColor + "'></i><span>" + lang_general_word_confirmed + " (" + confirmed + ")</span><br>";
div.innerHTML += "<i style='background: " + workedColor + "'></i><span>" + lang_general_word_worked_not_confirmed + " (" + workednotconfirmed + ")</span><br>";
div.innerHTML += "<i style='background: " + unworkedColor + "'></i><span>" + lang_general_word_not_worked + " (" + notworked + ")</span><br>";