[WAE Award] Optimized logic and queries

This commit is contained in:
Andreas Kristiansen
2026-03-01 08:17:36 +01:00
parent 35fb4ea5b3
commit 2e3cf51ce0
3 changed files with 570 additions and 775 deletions

View File

@@ -36,7 +36,6 @@ class Awards extends CI_Controller {
public function dok ()
{
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$data['user_map_custom'] = $this->optionslib->get_map_custom();
@@ -205,7 +204,7 @@ class Awards extends CI_Controller {
// Render Page
$data['page_title'] = sprintf(__("Awards - %s"), __("DXCC"));
$data['posted_band']=$postdata['band'];
$data['posted_band'] = $postdata['band'];
$this->load->view('interface_assets/header', $data);
$this->load->view('awards/dxcc/index');
$this->load->view('interface_assets/footer');
@@ -2235,17 +2234,14 @@ class Awards extends CI_Controller {
$postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1;
$postdata['includedeleted'] = $this->security->xss_clean($this->input->post('includedeleted'));
$postdata['Africa'] = $this->security->xss_clean($this->input->post('Africa'));
$postdata['Asia'] = $this->security->xss_clean($this->input->post('Asia'));
$postdata['Europe'] = $this->security->xss_clean($this->input->post('Europe'));
$postdata['NorthAmerica'] = $this->security->xss_clean($this->input->post('NorthAmerica'));
$postdata['SouthAmerica'] = $this->security->xss_clean($this->input->post('SouthAmerica'));
$postdata['Oceania'] = $this->security->xss_clean($this->input->post('Oceania'));
$postdata['Antarctica'] = $this->security->xss_clean($this->input->post('Antarctica'));
$postdata['band'] = $this->security->xss_clean($this->input->post('band'));
$postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
$postdata['sat'] = $this->security->xss_clean($this->input->post('sats'));
$postdata['orbit'] = $this->security->xss_clean($this->input->post('orbits'));
$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;
@@ -2255,21 +2251,19 @@ class Awards extends CI_Controller {
$postdata['confirmed'] = 1;
$postdata['notworked'] = 1;
$postdata['includedeleted'] = 0;
$postdata['Africa'] = 1;
$postdata['Asia'] = 1;
$postdata['Europe'] = 1;
$postdata['NorthAmerica'] = 1;
$postdata['SouthAmerica'] = 1;
$postdata['Oceania'] = 1;
$postdata['Antarctica'] = 1;
$postdata['band'] = 'All';
$postdata['mode'] = 'All';
$postdata['sat'] = 'All';
$postdata['orbit'] = 'All';
$postdata['dateFrom'] = null;
$postdata['dateTo'] = null;
}
$data['wae_array'] = $this->wae->get_wae_array($bands, $postdata);
$data['wae_summary'] = $this->wae->get_wae_summary($bands, $postdata);
$result = $this->wae->get_wae_array($bands, $postdata);
$data['wae_array'] = $result['matrix'] ?? null;
$data['wae_summary'] = $result['summary'] ?? null;
$data['posted_band'] = $postdata['band'];
// Render Page
$data['page_title'] = sprintf(__("Awards - %s"), __("WAE"));

View File

@@ -7,18 +7,10 @@ class WAE extends CI_Model {
// Reference: https://www.darc.de/der-club/referate/dx/diplome/wae-diplom/wae-laenderliste/
// ADIF refrence: https://www.adif.org.uk/315/ADIF_315.htm#Region_Enumeration
// $sql = select * from dxcc_entities where cont = 'EU' and end is null
// 4U1V (OE for DXCC), JW/b, GM/s, IT, TA1,
private $eucountries = '5,7,21,27,40,45,52,54,61,106,114,117,118,122,126,145,146,149,167,179,180,203,206,209,212,214,221,222,223,224,225,227,230,233,236,239,242,245,246,248,251,254,257,259,260,263,265,266,269,272,275,278,279,281,284,287,288,294,295,296,497,499,501,502,503,504,514,522';
// 4U1V (OE for DXCC), JW/b, GM/s, IT, TA1,
private $waecountries = '206, 248, 259, 279, 390';
private $region = "'IV', 'SY', 'BI', 'SI', 'ET'";
// $sql = select * from dxcc_entities where cont = 'EU' and end is not null
// Need to handle deleted eu countries
// Deleted
// Prefix Country valid since valid until
// 9S4 Saarland Nov 8, 1947 Mar 31, 1957
@@ -30,6 +22,8 @@ class WAE extends CI_Model {
// OK Czechoslovakia Dec 31, 1992
// R1MV Maliy Vysotskij Isl. Feb 17, 2012
private $validWaeRegions = ['IV', 'SY', 'BI', 'SI', 'ET'];
private $location_list;
function __construct() {
@@ -54,239 +48,370 @@ class WAE extends CI_Model {
return null;
}
$waeCount = array(); // Used for keeping track of which WAE are not worked
$waeCount['IV']['count'] = 0;
$waeCount['SY']['count'] = 0;
$waeCount['BI']['count'] = 0;
$waeCount['SI']['count'] = 0;
$waeCount['ET']['count'] = 0;
$qsl = $this->genfunctions->gen_qsl_from_postdata($postdata);
$dxccArray = $this->fetchdxcc($postdata, $this->location_list);
$qsl = $this->genfunctions->gen_qsl_from_postdata($postdata);
// WAE special regions
$waeRegions = [
'IV' => ['name' => 'ITU Vienna', 'prefix' => '4U1V'],
'SY' => ['name' => 'Sicily', 'prefix' => 'IT9'],
'BI' => ['name' => 'Bear Island', 'prefix' => 'JW/b'],
'SI' => ['name' => 'Shetland Islands', 'prefix' => 'GM/s'],
'ET' => ['name' => 'European Turkey', 'prefix' => 'TA1']
];
foreach ($bands as $band) { // Looping through bands and entities to generate the array needed for display
// Initialize matrix with all DXCC entities and WAE regions
foreach ($dxccArray as $dxcc) {
if ($dxcc->adif == '0') {
$dxccMatrix[$dxcc->adif]['name'] = $dxcc->name;
$adif = $dxcc->adif ?? '0';
$name = $dxcc->name ?? '';
$prefix = $dxcc->prefix ?? '';
$enddate = $dxcc->Enddate ?? null;
if ($adif == '0') {
$dxccMatrix[$adif]['name'] = $name;
} else {
$dxccMatrix[$dxcc->adif]['name'] = ucwords(strtolower($dxcc->name), "- (/");
$dxccMatrix[$adif]['name'] = ucwords(strtolower($name), "- (/");
}
$dxccMatrix[$dxcc->adif]['Dxccprefix'] = $dxcc->prefix;
if ($postdata['includedeleted'])
$dxccMatrix[$dxcc->adif]['Deleted'] = isset($dxcc->Enddate) ? 1 : 0;
$dxccMatrix[$dxcc->adif][$band] = '-';
}
$dxccMatrix['IV']['name'] = 'ITU Vienna';
$dxccMatrix['IV']['Dxccprefix'] = '4U1V';
$dxccMatrix['IV'][$band] = '-';
$dxccMatrix['SY']['name'] = 'Sicily';
$dxccMatrix['SY']['Dxccprefix'] = 'IT9';
$dxccMatrix['SY'][$band] = '-';
$dxccMatrix['BI']['name'] = 'Bear Island';
$dxccMatrix['BI']['Dxccprefix'] = 'JW/b';
$dxccMatrix['BI'][$band] = '-';
$dxccMatrix['SI']['name'] = 'Shetland Islands';
$dxccMatrix['SI']['Dxccprefix'] = 'GM/s';
$dxccMatrix['SI'][$band] = '-';
$dxccMatrix['ET']['name'] = 'European Turkey';
$dxccMatrix['ET']['Dxccprefix'] = 'TA1';
$dxccMatrix['ET'][$band] = '-';
// If worked is checked, we add worked entities to the array
if ($postdata['worked'] != NULL) {
$workedDXCC = $this->getDxccBandWorked($this->location_list, $band, $postdata);
foreach ($workedDXCC as $wdxcc) {
$dxccMatrix[$wdxcc->dxcc][$band] = '<div class="bg-danger awardsBgWarning" ><a href=\'javascript:displayContacts("'.$wdxcc->dxcc.'","'. $band . '","'. $postdata['sat'] . '","' . $postdata['orbit'] . '","'. $postdata['mode'] . '","WAE", "")\'>W</a></div>';
$dxccMatrix[$adif]['Dxccprefix'] = $prefix;
if ($postdata['includedeleted']) {
$dxccMatrix[$adif]['Deleted'] = isset($enddate) ? 1 : 0;
}
$workedDXCC = $this->getDxccBandWorked($this->location_list, $band, $postdata, true);
foreach ($workedDXCC as $wdxcc) {
$dxccMatrix[$wdxcc->col_region][$band] = '<div class="bg-danger awardsBgWarning" ><a href=\'javascript:displayContacts("'.$wdxcc->col_region.'","'. $band . '","'. $postdata['sat'] . '","' . $postdata['orbit'] . '","'. $postdata['mode'] . '","WAE", "")\'>W</a></div>';
$waeCount[$wdxcc->col_region]['count']++;
// Initialize all bands to dash
foreach ($bands as $band) {
$dxccMatrix[$adif][$band] = '-';
}
}
// If confirmed is checked, we add confirmed entities to the array
if ($postdata['confirmed'] != NULL) {
$confirmedDXCC = $this->getDxccBandConfirmed($this->location_list, $band, $postdata);
foreach ($confirmedDXCC as $cdxcc) {
$dxccMatrix[$cdxcc->dxcc][$band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("'.$cdxcc->dxcc.'","'. $band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","' . $postdata['mode'] . '","WAE","'.$qsl.'")\'>C</a></div>';
// Initialize WAE regions
foreach ($waeRegions as $region => $info) {
$dxccMatrix[$region]['name'] = $info['name'];
$dxccMatrix[$region]['Dxccprefix'] = $info['prefix'];
foreach ($bands as $band) {
$dxccMatrix[$region][$band] = '-';
}
$confirmedDXCC = $this->getDxccBandConfirmed($this->location_list, $band, $postdata, true);
foreach ($confirmedDXCC as $cdxcc) {
$dxccMatrix[$cdxcc->col_region][$band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("'.$cdxcc->col_region.'","'. $band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","' . $postdata['mode'] . '","WAE","'.$qsl.'")\'>C</a></div>';
$waeCount[$cdxcc->col_region]['count']++;
}
// 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 entity/band combinations for totals
$workedEntities = []; // [band][entity] => true
$confirmedEntities = []; // [band][entity] => true
// Track worked status for each entity
$entityWorkedStatus = []; // [entity] => count
// Create a lookup array for valid bands
$validBands = array_flip($bands);
// Get all WAE data in efficient queries
$waeData = $this->getWaeData($this->location_list, $postdata);
$waeDataSat = $this->getWaeDataSat($this->location_list, $postdata);
foreach ($waeData as $wae) {
// Skip if this band is not in our requested bands list
if (!isset($validBands[$wae->col_band])) {
continue;
}
// Use region only if it's a valid WAE region, otherwise use DXCC
$entityKey = (!empty($wae->col_region) && in_array($wae->col_region, $this->validWaeRegions)) ? $wae->col_region : (string)$wae->dxcc;
// Track worked status for this entity
if (!isset($entityWorkedStatus[$entityKey])) {
$entityWorkedStatus[$entityKey] = 0;
}
$entityWorkedStatus[$entityKey]++;
// Check if confirmed based on the confirmation types selected in postdata
$isConfirmed = false;
$confirmationLetters = '';
if (isset($postdata['qsl']) && $postdata['qsl'] == 1 && $wae->qsl > 0) {
$isConfirmed = true;
$confirmationLetters .= 'Q';
}
if (isset($postdata['lotw']) && $postdata['lotw'] == 1 && $wae->lotw > 0) {
$isConfirmed = true;
$confirmationLetters .= 'L';
}
if (isset($postdata['eqsl']) && $postdata['eqsl'] == 1 && $wae->eqsl > 0) {
$isConfirmed = true;
$confirmationLetters .= 'E';
}
if (isset($postdata['qrz']) && $postdata['qrz'] == 1 && $wae->qrz > 0) {
$isConfirmed = true;
$confirmationLetters .= 'Z';
}
if (isset($postdata['clublog']) && $postdata['clublog'] == 1 && $wae->clublog > 0) {
$isConfirmed = true;
$confirmationLetters .= 'C';
}
if ($isConfirmed) {
$dxccMatrix[$entityKey][$wae->col_band] = '<div class="bg-success awardsBgSuccess" additional_successinfo=">C<"><a href=\'javascript:displayContacts("'.$entityKey.'","'. $wae->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","WAE","'.$qsl.'","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>'.$confirmationLetters.'</a></div>';
// Track confirmed entities for summary
if (!isset($confirmedEntities[$wae->col_band][$entityKey])) {
$confirmedEntities[$wae->col_band][$entityKey] = true;
$summary['confirmed'][$wae->col_band]++;
}
} else {
$dxccMatrix[$entityKey][$wae->col_band] = '<div class="bg-danger awardsBgWarning" ><a href=\'javascript:displayContacts("'.$entityKey.'","'. $wae->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","WAE", "", "'.$postdata['dateFrom'].'", "'.$postdata['dateTo'].'")\'>W</a></div>';
}
// Track worked entities for summary
if (!isset($workedEntities[$wae->col_band][$entityKey])) {
$workedEntities[$wae->col_band][$entityKey] = true;
$summary['worked'][$wae->col_band]++;
}
}
foreach ($waeDataSat as $wae) {
// Skip if this band is not in our requested bands list
if (!isset($validBands['SAT'])) {
continue;
}
// Use region only if it's a valid WAE region, otherwise use DXCC
$entityKey = (!empty($wae->col_region) && in_array($wae->col_region, $this->validWaeRegions)) ? $wae->col_region : (string)$wae->dxcc;
// Track worked status for this entity
if (!isset($entityWorkedStatus[$entityKey])) {
$entityWorkedStatus[$entityKey] = 0;
}
$entityWorkedStatus[$entityKey]++;
// Check if confirmed based on the confirmation types selected in postdata
$isConfirmed = false;
$confirmationLetters = '';
if (isset($postdata['qsl']) && $postdata['qsl'] == 1 && $wae->qsl > 0) {
$isConfirmed = true;
$confirmationLetters .= 'Q';
}
if (isset($postdata['lotw']) && $postdata['lotw'] == 1 && $wae->lotw > 0) {
$isConfirmed = true;
$confirmationLetters .= 'L';
}
if (isset($postdata['eqsl']) && $postdata['eqsl'] == 1 && $wae->eqsl > 0) {
$isConfirmed = true;
$confirmationLetters .= 'E';
}
if (isset($postdata['qrz']) && $postdata['qrz'] == 1 && $wae->qrz > 0) {
$isConfirmed = true;
$confirmationLetters .= 'Z';
}
if (isset($postdata['clublog']) && $postdata['clublog'] == 1 && $wae->clublog > 0) {
$isConfirmed = true;
$confirmationLetters .= 'C';
}
if ($isConfirmed) {
$dxccMatrix[$entityKey]['SAT'] = '<div class="bg-success awardsBgSuccess" additional_successinfo=">C<"><a href=\'javascript:displayContacts("'.$entityKey.'","SAT","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","WAE","'.$qsl.'","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>'.$confirmationLetters.'</a></div>';
// Track confirmed entities for summary
if (!isset($confirmedEntities['SAT'][$entityKey])) {
$confirmedEntities['SAT'][$entityKey] = true;
$summary['confirmed']['SAT']++;
}
} else {
$dxccMatrix[$entityKey]['SAT'] = '<div class="bg-danger awardsBgWarning" ><a href=\'javascript:displayContacts("'.$entityKey.'","SAT","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","WAE", "", "'.$postdata['dateFrom'].'", "'.$postdata['dateTo'].'")\'>W</a></div>';
}
// Track worked entities for summary
if (!isset($workedEntities['SAT'][$entityKey])) {
$workedEntities['SAT'][$entityKey] = true;
$summary['worked']['SAT']++;
}
}
// Calculate totals across all bands (excluding SAT)
$totalWorkedEntities = [];
$totalConfirmedEntities = [];
foreach ($workedEntities as $band => $entities) {
// Skip SAT for totals
if ($band === 'SAT') {
continue;
}
foreach ($entities as $entity => $true) {
if (!isset($totalWorkedEntities[$entity])) {
$totalWorkedEntities[$entity] = true;
$summary['worked']['Total']++;
}
}
}
foreach ($confirmedEntities as $band => $entities) {
// Skip SAT for totals
if ($band === 'SAT') {
continue;
}
foreach ($entities as $entity => $true) {
if (!isset($totalConfirmedEntities[$entity])) {
$totalConfirmedEntities[$entity] = true;
$summary['confirmed']['Total']++;
}
}
}
// We want to remove the worked dxcc's in the list, since we do not want to display them
if ($postdata['worked'] == NULL) {
$workedDxcc = $this->getDxccWorked($this->location_list, $postdata);
foreach ($workedDxcc as $wdxcc) {
if (array_key_exists($wdxcc->dxcc, $dxccMatrix)) {
unset($dxccMatrix[$wdxcc->dxcc]);
// Remove entities based on postdata filters
foreach ($dxccMatrix as $entity => $data) {
// Remove not-worked entities if filter is disabled
if ($postdata['notworked'] == NULL && !isset($entityWorkedStatus[$entity])) {
unset($dxccMatrix[$entity]);
continue;
}
// Remove worked-only entities if filter is disabled
if ($postdata['worked'] == NULL && isset($entityWorkedStatus[$entity]) && !isset($totalConfirmedEntities[$entity])) {
unset($dxccMatrix[$entity]);
continue;
}
$workedWae = $this->getDxccWorked($this->location_list, $postdata, true);
foreach ($workedWae as $wdxcc) {
if (array_key_exists($wdxcc->col_region, $dxccMatrix)) {
unset($dxccMatrix[$wdxcc->col_region]);
}
// Remove confirmed entities if filter is disabled
if ($postdata['confirmed'] == NULL && isset($totalConfirmedEntities[$entity])) {
unset($dxccMatrix[$entity]);
continue;
}
}
// We want to remove the confirmed dxcc's in the list, since we do not want to display them
if ($postdata['confirmed'] == NULL) {
$confirmedDxcc = $this->getDxccConfirmed($this->location_list, $postdata);
foreach ($confirmedDxcc as $cdxcc) {
if (array_key_exists($cdxcc->dxcc, $dxccMatrix)) {
unset($dxccMatrix[$cdxcc->dxcc]);
}
}
$confirmedWae = $this->getDxccConfirmed($this->location_list, $postdata, true);
foreach ($confirmedWae as $cdxcc) {
if (array_key_exists($cdxcc->col_region, $dxccMatrix)) {
unset($dxccMatrix[$cdxcc->col_region]);
}
}
}
if ($postdata['notworked'] == NULL) {
if ($waeCount['IV']['count'] == 0) {
unset($dxccMatrix['IV']);
};
if ($waeCount['SY']['count'] == 0) {
unset($dxccMatrix['SY']);
};
if ($waeCount['BI']['count'] == 0) {
unset($dxccMatrix['BI']);
};
if ($waeCount['SI']['count'] == 0) {
unset($dxccMatrix['SI']);
};
if ($waeCount['ET']['count'] == 0) {
unset($dxccMatrix['ET']);
};
}
if (isset($dxccMatrix)) {
if (isset($dxccMatrix) && !empty($dxccMatrix)) {
// Convert associative array to indexed array for sorting
$dxccIndexed = array_values($dxccMatrix);
// Sort the indexed array by the 'name' key
// Sort the indexed array by the 'Dxccprefix' key
usort($dxccIndexed, function ($a, $b) {
return strcmp($a['Dxccprefix'], $b['Dxccprefix']);
$aPrefix = $a['Dxccprefix'] ?? '';
$bPrefix = $b['Dxccprefix'] ?? '';
return strcmp($aPrefix, $bPrefix);
});
// Optionally reindex the sorted array back to associative format
$dxccSorted = [];
foreach ($dxccIndexed as $item) {
$key = array_search($item, $dxccMatrix);
$dxccSorted[$key] = $item;
}
return $dxccSorted;
// Return both the matrix data and summary
return ['matrix' => $dxccIndexed, 'summary' => $summary];
} else {
return 0;
return ['matrix' => [], 'summary' => $summary ?? []];
}
}
function getDxccBandConfirmed($location_list, $band, $postdata, $wae = false) {
/*
* Gets all WAE data with confirmation status in efficient query using MAX aggregation
*/
function getWaeData($location_list, $postdata) {
$bindings = [];
$sql = "select adif as dxcc, name, x.col_region from dxcc_entities
join (
select col_region, col_dxcc from ".$this->config->item('table_name')." thcv
LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name
where station_id in (" . $location_list . ")";
if ($wae) {
$sql .= ' and col_dxcc in ( '. $this->waecountries . ') and col_region in ('. $this->region.')';
} else {
$sql .= " and col_dxcc in ( ". $this->eucountries . ") and coalesce(col_region, '') = ''";
}
$sql = "SELECT
COALESCE(thcv.col_region, CAST(thcv.col_dxcc AS CHAR)) as entity_key,
thcv.col_dxcc as dxcc,
thcv.col_region,
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
JOIN dxcc_entities d ON thcv.col_dxcc = d.adif
WHERE station_id IN (" . $location_list . ")";
$sql .= $this->genfunctions->addBandToQuery($band,$bindings);
if ($band == 'SAT') {
if ($postdata['sat'] != 'All') {
$sql .= " and col_sat_name = ?";
$bindings[] = $postdata['sat'];
}
}
// Filter for European DXCC entities and WAE regions
$sql .= " AND thcv.col_dxcc IN (" . $this->eucountries . ") AND d.end IS NULL";
// Mode filter
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$sql .= " AND (thcv.col_mode = ? OR thcv.col_submode = ?)";
$bindings[] = $postdata['mode'];
$bindings[] = $postdata['mode'];
}
$sql .= $this->addOrbitToQuery($postdata,$bindings);
$sql .= $this->genfunctions->addQslToQuery($postdata);
$sql .= " group by col_dxcc, col_region
) x on dxcc_entities.adif = x.col_dxcc";
// if ($postdata['includedeleted'] == NULL) {
$sql .= " and dxcc_entities.end is null";
// }
if ($wae) {
$sql .= ' and dxcc_entities.adif in ( '. $this->waecountries . ')';
} else {
$sql .= ' and dxcc_entities.adif in (' . $this->eucountries . ')';
// Date filters
if ($postdata['dateFrom'] != NULL) {
$sql .= " AND thcv.col_time_on >= ?";
$bindings[] = $postdata['dateFrom'] . ' 00:00:00';
}
$query = $this->db->query($sql,$bindings);
if ($postdata['dateTo'] != NULL) {
$sql .= " AND thcv.col_time_on <= ?";
$bindings[] = $postdata['dateTo'] . ' 23:59:59';
}
$sql .= " AND thcv.col_prop_mode != 'SAT'";
// Orbit filter
$sql .= $this->addOrbitToQuery($postdata, $bindings);
$sql .= " GROUP BY COALESCE(thcv.col_region, CAST(thcv.col_dxcc AS CHAR)), thcv.col_dxcc, thcv.col_region, thcv.col_band";
$query = $this->db->query($sql, $bindings);
return $query->result();
}
function getDxccBandWorked($location_list, $band, $postdata, $wae = false) {
$bindings=[];
$sql = "select adif as dxcc, name, x.col_region from dxcc_entities
join (
select col_region, col_dxcc from ".$this->config->item('table_name')." thcv
LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name
where station_id in (" . $location_list . ")";
if ($wae) {
$sql .= ' and col_dxcc in ( '. $this->waecountries . ') and col_region in ('. $this->region.')';
} else {
$sql .= " and col_dxcc in ( ". $this->eucountries . ") and coalesce(col_region, '') = ''";
function getWaeDataSat($location_list, $postdata) {
$bindings = [];
$sql = "SELECT
COALESCE(thcv.col_region, CAST(thcv.col_dxcc AS CHAR)) as entity_key,
thcv.col_dxcc as dxcc,
thcv.col_region,
'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
JOIN dxcc_entities d ON thcv.col_dxcc = d.adif
LEFT JOIN satellite ON thcv.COL_SAT_NAME = satellite.name
WHERE station_id IN (" . $location_list . ")";
// Filter for European DXCC entities and WAE regions
$sql .= " AND thcv.col_dxcc IN (" . $this->eucountries . ") AND d.end IS NULL";
// Mode filter
if ($postdata['mode'] != 'All') {
$sql .= " AND (thcv.col_mode = ? OR thcv.col_submode = ?)";
$bindings[] = $postdata['mode'];
$bindings[] = $postdata['mode'];
}
$sql .= $this->genfunctions->addBandToQuery($band,$bindings);
if ($band == 'SAT') {
// Date filters
if ($postdata['dateFrom'] != NULL) {
$sql .= " AND thcv.col_time_on >= ?";
$bindings[] = $postdata['dateFrom'] . ' 00:00:00';
}
if ($postdata['dateTo'] != NULL) {
$sql .= " AND thcv.col_time_on <= ?";
$bindings[] = $postdata['dateTo'] . ' 23:59:59';
}
// Satellite filter
if ($postdata['sat'] != 'All') {
$sql .= " and col_sat_name = ?";
$sql .= " AND thcv.col_sat_name = ?";
$bindings[] = $postdata['sat'];
}
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[] = $postdata['mode'];
$bindings[] = $postdata['mode'];
}
$sql .= $this->addOrbitToQuery($postdata,$bindings);
$sql .= " group by col_dxcc, col_region
) x on dxcc_entities.adif = x.col_dxcc";;
// Orbit filter
$sql .= $this->addOrbitToQuery($postdata, $bindings);
// if ($postdata['includedeleted'] == NULL) {
$sql .= " and dxcc_entities.end is null";
// }
$sql .= " AND thcv.col_prop_mode = 'SAT'";
if ($wae) {
$sql .= ' and dxcc_entities.adif in ( '. $this->waecountries . ')';
} else {
$sql .= ' and dxcc_entities.adif in (' . $this->eucountries . ')';
}
$sql .= " GROUP BY COALESCE(thcv.col_region, CAST(thcv.col_dxcc AS CHAR)), thcv.col_dxcc, thcv.col_region";
$query = $this->db->query($sql,$bindings);
$query = $this->db->query($sql, $bindings);
return $query->result();
}
// Adds orbit type to query
function addOrbitToQuery($postdata,&$binding) {
$sql = '';
if ($postdata['orbit'] != 'All') {
$sql .= ' AND satellite.orbit = ?';
$binding[] = $postdata['orbit'];
}
return $sql;
}
function fetchDxcc($postdata, $location_list) {
$bindings = [];
@@ -339,425 +464,5 @@ class WAE extends CI_Model {
return $query->result();
}
function getDxccWorked($location_list, $postdata, $wae = false) {
$bindings = [];
$sql = "SELECT adif as dxcc, ll.col_region FROM dxcc_entities
join (
select col_dxcc, col_region
from ".$this->config->item('table_name')." thcv
LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name
where station_id in (" . $location_list . ")";
if ($wae) {
$sql .= ' and col_dxcc in ( '. $this->waecountries . ') and col_region in ('. $this->region.')';
} else {
$sql .= " and col_dxcc in ( ". $this->eucountries . ") and coalesce(col_region, '') = ''";
}
$sql .= $this->genfunctions->addBandToQuery($postdata['band'],$bindings);
if ($postdata['band'] == 'SAT') {
if ($postdata['sat'] != 'All') {
$sql .= " and col_sat_name = ?";
$bindings[] = $postdata['sat'];
}
}
$sql .= $this->addOrbitToQuery($postdata,$bindings);
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[] = $postdata['mode'];
$bindings[] = $postdata['mode'];
}
$sql .= " and not exists (select 1 from ".$this->config->item('table_name')." where station_id in (". $location_list .") and col_dxcc = thcv.col_dxcc";
if ($wae) {
$sql .= ' and col_dxcc in ( '. $this->waecountries . ') and col_region in ('. $this->region.')';
} else {
$sql .= " and col_dxcc in ( ". $this->eucountries . ") and coalesce(col_region, '') = ''";
}
$sql .= $this->genfunctions->addBandToQuery($postdata['band'],$bindings);
if ($postdata['band'] == 'SAT') {
if ($postdata['sat'] != 'All') {
$sql .= " and col_sat_name = ?";
$bindings[] = $postdata['sat'];
}
}
$sql .= $this->addOrbitToQuery($postdata,$bindings);
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[] = $postdata['mode'];
$bindings[] = $postdata['mode'];
}
$sql .= $this->genfunctions->addQslToQuery($postdata);
$sql .= ')';
$sql .= " group by col_dxcc, col_region
) ll on dxcc_entities.adif = ll.col_dxcc
where 1=1";
// if ($postdata['includedeleted'] == NULL) {
$sql .= " and dxcc_entities.end is null";
// }
if ($wae) {
$sql .= ' and dxcc_entities.adif in ( '. $this->waecountries . ')';
} else {
$sql .= ' and dxcc_entities.adif in (' . $this->eucountries . ')';
}
$query = $this->db->query($sql,$bindings);
return $query->result();
}
function getDxccConfirmed($location_list, $postdata, $wae = false) {
$bindings = [];
$sql = "SELECT adif as dxcc, ll.col_region FROM dxcc_entities
join (
select col_dxcc, col_region
from ".$this->config->item('table_name')." thcv
LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name
where station_id in (" . $location_list . ")";
if ($wae) {
$sql .= ' and col_dxcc in ( '. $this->waecountries . ') and col_region in ('. $this->region.')';
} else {
$sql .= " and col_dxcc in ( ". $this->eucountries . ") and coalesce(col_region, '') = ''";
}
$sql .= $this->genfunctions->addBandToQuery($postdata['band'],$bindings);
if ($postdata['band'] == 'SAT') {
if ($postdata['sat'] != 'All') {
$sql .= " and col_sat_name = ?";
$bindings[] = $postdata['sat'];
}
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[] = $postdata['mode'];
$bindings[] = $postdata['mode'];
}
$sql .= $this->addOrbitToQuery($postdata,$bindings);
$sql .= $this->genfunctions->addQslToQuery($postdata);
$sql .= " group by col_dxcc, col_region
) ll on dxcc_entities.adif = ll.col_dxcc
where 1=1";
// if ($postdata['includedeleted'] == NULL) {
$sql .= " and dxcc_entities.end is null";
// }
if ($wae) {
$sql .= ' and col_dxcc in ( '. $this->waecountries . ') and col_region in ('. $this->region.')';
} else {
$sql .= " and col_dxcc in ( ". $this->eucountries . ") and coalesce(col_region, '') = ''";
}
$query = $this->db->query($sql,$bindings);
return $query->result();
}
/*
* Function gets worked and confirmed summary on each band on the active stationprofile
*/
function get_wae_summary($bands, $postdata) {
if ($this->location_list == '') {
return null;
}
foreach ($bands as $band) {
$dxccSummary['worked'][$band] = 0;
$dxccSummary['confirmed'][$band] = 0;
}
$this->load->model('bands');
$bandslots = $this->bands->get_worked_bands('dxcc');
//WAE
$confirmed = $this->getSummaryConfirmed($postdata, $this->location_list, true);
foreach ($confirmed as $c) {
if (isset($dxccSummary['confirmed'][$c->col_band])) {
$dxccSummary['confirmed'][$c->col_band] += $c->regioncount;
}
}
$confirmed = '';
// EU DXCC
$confirmed = $this->getSummaryConfirmed($postdata, $this->location_list);
foreach ($confirmed as $c) {
if (isset($dxccSummary['confirmed'][$c->col_band])) {
$dxccSummary['confirmed'][$c->col_band] += $c->count;
}
}
// EU DXCC
$worked = $this->getSummary($postdata, $this->location_list);
foreach ($worked as $w) {
if (isset($dxccSummary['worked'][$w->col_band])) {
$dxccSummary['worked'][$w->col_band] += $w->count;
}
}
$worked = '';
//WAE
$worked = $this->getSummary($postdata, $this->location_list, true);
foreach ($worked as $w) {
if (isset($dxccSummary['worked'][$w->col_band])) {
$dxccSummary['worked'][$w->col_band] += $w->regioncount;
}
}
if (isset($dxccSummary['worked']['SAT'])) {
$workedSat = $this->getSummaryByBand('SAT', $postdata, $this->location_list, $bandslots, true);
$dxccSummary['worked']['SAT'] += $workedSat[0]->regioncount;
$workedSat = $this->getSummaryByBand('SAT', $postdata, $this->location_list, $bandslots);
$dxccSummary['worked']['SAT'] += $workedSat[0]->count;
}
if (isset($dxccSummary['confirmed']['SAT'])) {
$confirmedSat = $this->getSummaryByBandConfirmed('SAT', $postdata, $this->location_list, $bandslots, true);
$dxccSummary['confirmed']['SAT'] += $confirmedSat[0]->regioncount;
$confirmedSat = $this->getSummaryByBandConfirmed('SAT', $postdata, $this->location_list, $bandslots);
$dxccSummary['confirmed']['SAT'] += $confirmedSat[0]->count;
}
$dxccSummary['worked']['Total'] = 0;
$dxccSummary['confirmed']['Total'] = 0;
$workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $this->location_list, $bandslots);
$confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $this->location_list, $bandslots);
$dxccSummary['worked']['Total'] += $workedTotal[0]->count;
$dxccSummary['confirmed']['Total'] += $confirmedTotal[0]->count;
$workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $this->location_list, $bandslots, true);
$confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $this->location_list, $bandslots, true);
$dxccSummary['worked']['Total'] += $workedTotal[0]->regioncount;
$dxccSummary['confirmed']['Total'] += $confirmedTotal[0]->regioncount;
return $dxccSummary;
}
function getSummary($postdata, $location_list, $wae = false) {
$bindings = [];
$sql = "SELECT count(distinct thcv.col_dxcc) as count, count(distinct thcv.col_region) regioncount, col_band FROM " . $this->config->item('table_name') . " thcv";
$sql .= " LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name";
$sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif";
$sql .= " where station_id in (" . $location_list . ")";
if ($wae) {
$sql .= ' and col_dxcc in ( '. $this->waecountries . ') and col_region in ('. $this->region.')';
} else {
$sql .= " and col_dxcc in ( ". $this->eucountries . ") and coalesce(col_region, '') = ''";
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[] = $postdata['mode'];
$bindings[] = $postdata['mode'];
}
$sql .= " and thcv.col_prop_mode !='SAT'";
// if ($postdata['includedeleted'] == NULL) {
$sql .= " and d.end is null";
// }
if ($wae) {
$sql .= ' and d.adif in ( '. $this->waecountries . ')';
} else {
$sql .= ' and d.adif in (' . $this->eucountries . ')';
}
$sql .= $this->addOrbitToQuery($postdata,$bindings);
$sql .= ' group by col_band';
$query = $this->db->query($sql,$bindings);
return $query->result();
}
function getSummaryByBand($band, $postdata, $location_list, $bandslots, $wae = false) {
$bindings = [];
$sql = "SELECT count(distinct thcv.col_dxcc) as count, count(distinct thcv.col_region) regioncount FROM " . $this->config->item('table_name') . " thcv";
$sql .= " LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name";
$sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif";
$sql .= " where station_id in (" . $location_list . ")";
if ($wae) {
$sql .= ' and col_dxcc in ( '. $this->waecountries . ') and col_region in ('. $this->region.')';
} else {
$sql .= " and col_dxcc in ( ". $this->eucountries . ") and coalesce(col_region, '') = ''";
}
if ($band == 'SAT') {
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
if ($band != 'All' && $postdata['sat'] != 'All') {
$sql .= " and col_sat_name = ?";
$bindings[] = $postdata['sat'];
}
} else if ($band == 'All') {
$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'];
}
// if ($postdata['includedeleted'] == NULL) {
$sql .= " and d.end is null";
// }
if ($wae) {
$sql .= ' and d.adif in ( '. $this->waecountries . ')';
} else {
$sql .= ' and d.adif in (' . $this->eucountries . ')';
}
$sql .= $this->addOrbitToQuery($postdata,$bindings);
$query = $this->db->query($sql,$bindings);
return $query->result();
}
// Adds orbit type to query
function addOrbitToQuery($postdata,&$binding) {
$sql = '';
if ($postdata['orbit'] != 'All') {
$sql .= ' AND satellite.orbit = ?';
$binding[] = $postdata['orbit'];
}
return $sql;
}
function getSummaryConfirmed($postdata, $location_list, $wae = false) {
$bindings = [];
$sql = "SELECT count(distinct thcv.col_dxcc) as count, count(distinct thcv.col_region) regioncount, thcv.col_band FROM " . $this->config->item('table_name') . " thcv";
$sql .= " LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name";
$sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif";
$sql .= " where station_id in (" . $location_list . ")";
if ($wae) {
$sql .= ' and col_dxcc in ( '. $this->waecountries . ') and col_region in ('. $this->region.')';
} else {
$sql .= " and col_dxcc in ( ". $this->eucountries . ") and coalesce(col_region, '') = ''";
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[] = $postdata['mode'];
$bindings[] = $postdata['mode'];
}
$sql .= " and thcv.col_prop_mode !='SAT'";
$sql .= $this->genfunctions->addQslToQuery($postdata);
$sql .= $this->addOrbitToQuery($postdata,$bindings);
// if ($postdata['includedeleted'] == NULL) {
$sql .= " and d.end is null";
// }
if ($wae) {
$sql .= ' and d.adif in ( '. $this->waecountries . ')';
} else {
$sql .= ' and d.adif in (' . $this->eucountries . ')';
}
$sql .= ' group by thcv.col_band';
$query = $this->db->query($sql,$bindings);
return $query->result();
}
function getSummaryByBandConfirmed($band, $postdata, $location_list, $bandslots, $wae = false) {
$bindings=[];
$sql = "SELECT count(distinct thcv.col_dxcc) as count, count(distinct thcv.col_region) regioncount FROM " . $this->config->item('table_name') . " thcv";
$sql .= " LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name";
$sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif";
$sql .= " where station_id in (" . $location_list . ")";
if ($wae) {
$sql .= ' and col_dxcc in ( '. $this->waecountries . ') and col_region in ('. $this->region.')';
} else {
$sql .= " and col_dxcc in ( ". $this->eucountries . ") and coalesce(col_region, '') = ''";
}
if ($band == 'SAT') {
$sql .= " and thcv.col_prop_mode = ?";
$bindings[] = $band;
if ($postdata['sat'] != 'All') {
$sql .= " and col_sat_name = ?";
$bindings[] = $postdata['sat'];
}
} else if ($band == 'All') {
$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);
$sql .= $this->addOrbitToQuery($postdata,$bindings);
// if ($postdata['includedeleted'] == NULL) {
$sql .= " and d.end is null";
// }
if ($wae) {
$sql .= ' and d.adif in ( '. $this->waecountries . ')';
} else {
$sql .= ' and d.adif in (' . $this->eucountries . ')';
}
$query = $this->db->query($sql,$bindings);
return $query->result();
}
}
?>

View File

@@ -1,3 +1,14 @@
<script>
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll('.dropdown').forEach(dd => {
dd.addEventListener('hide.bs.dropdown', function (e) {
if (e.clickEvent && e.clickEvent.target.closest('.dropdown-menu')) {
e.preventDefault(); // stop Bootstrap from closing
}
});
});
});
</script>
<div class="container">
<!-- Award Info Box -->
<br>
@@ -16,18 +27,46 @@
<!-- End of Award Info Box -->
<form class="form" action="<?php echo site_url('awards/wae'); ?>" method="post" enctype="multipart/form-data">
<fieldset>
<?php
/* <div class="mb-3 row">
<div class="col-md-2 control-label" for="checkboxes"><?= __("Deleted WAE"); ?></div>
<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>
<!-- 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 control-label" for="checkboxes"><?= __("Date from"); ?></div>
<div class="col-md-10">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="includedeleted" id="includedeleted" value="1" <?php if ($this->input->post('includedeleted')) echo ' checked="checked"'; ?> >
<label class="form-check-label" for="includedeleted"><?= __("Include deleted"); ?></label>
<input name="dateFrom" id="dateFrom" type="date" class="form-control form-control-sm w-auto border border-secondary" <?php if ($this->input->post('dateFrom')) echo 'value="' . $this->input->post('dateFrom') . '"'; ?>>
</div>
</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')) echo 'value="' . $this->input->post('dateTo') . '"'; ?>>
</div>
</div>
</div>
<!-- Multiple Checkboxes (inline) -->
<div class="mb-3 row">
<div class="col-md-2" for="checkboxes"><?= __("Worked / Confirmed"); ?></div>
@@ -75,7 +114,7 @@
<div class="mb-3 row">
<label class="col-md-2 control-label" for="band2"><?= __("Band"); ?></label>
<div class="col-md-2">
<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') == "All" || $this->input->method() !== 'post') echo ' selected'; ?> ><?= __("Every band"); ?></option>
<?php foreach($worked_bands as $band) {
@@ -89,7 +128,7 @@
<div id="satrow" class="mb-3 row" <?php if ($this->input->post('band') != 'SAT' && $this->input->post('band') != 'All') echo "style=\"display: none\""; ?>>
<?php if (count($sats_available) != 0) { ?>
<label class="col-md-2 control-label" id="satslabel" for="sats"><?= __("Satellite"); ?></label>
<div class="col-md-2">
<div class="col-md-3">
<select class="form-select form-select-sm" id="sats" name="sats">
<option value="All" <?php if ($this->input->post('sats') == "All" || $this->input->method() !== 'post') echo ' selected'; ?>><?= __("All")?></option>
<?php foreach($sats_available as $sat) {
@@ -105,7 +144,7 @@
</div>
<div id="orbitrow" class="mb-3 row" <?php if ($this->input->post('band') != 'SAT' && $this->input->post('band') != 'All') echo "style=\"display: none\""; ?>>
<label class="col-md-2 control-label" id="orbitslabel" for="orbits"><?= __("Orbit"); ?></label>
<div class="col-md-2">
<div class="col-md-3">
<select class="form-select form-select-sm" id="orbits" name="orbits">
<option value="All" <?php if ($this->input->post('orbits') == "All" || $this->input->method() !== 'post') echo ' selected'; ?>><?= __("All")?></option>
<?php
@@ -118,9 +157,10 @@
</select>
</div>
</div>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" for="mode"><?= __("Mode"); ?></label>
<div class="col-md-2">
<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') == "All" || $this->input->method() !== 'mode') echo ' selected'; ?>><?= __("All"); ?></option>
<?php
@@ -139,21 +179,20 @@
</select>
</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>
</div>
</div>
</fieldset>
</form>
<?php
echo '<br /><br />';
$i = 1;
if ($wae_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-sm table tabledxcc table-bordered table-hover table-striped table-condensed text-center">
<thead>
@@ -188,24 +227,81 @@
<thead>
<tr><td></td>';
$addsat='';
foreach($bands as $band) {
if ($band != 'SAT') {
echo '<td>' . $band . '</td>';
} else {
$addsat='<td>' . $band . '</td>';
}
echo '<td>' . __("Total") . '</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 '
</tr>
</thead>
<tbody>
<tr><td>' . __("Total worked") . '</td>';
foreach ($wae_summary['worked'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
$addsat='';
foreach ($wae_summary['worked'] as $band => $dxcc) { // Fills the table with the data
if ($posted_band == 'SAT' && $band == 'Total') {
continue;
}
if ($band != 'SAT') {
echo '<td style="text-align: center">';
if ($band == 'Total') {
echo '<b>'.$dxcc.'</b>';
} else {
echo $dxcc;
}
echo '</td>';
} else {
$addsat='<td style="text-align: center">' . $dxcc . '</td>';
}
}
if (count($bands) > 1) {
echo '<td class="spacingcell"></td>';
}
if ($addsat != '' && count($wae_summary['worked']) > 1) {
echo $addsat;
}
echo '</tr><tr>
<td>' . __("Total confirmed") . '</td>';
foreach ($wae_summary['confirmed'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
$addsat='';
foreach ($wae_summary['confirmed'] as $band => $dxcc) { // Fills the table with the data
if ($posted_band == 'SAT' && $band == 'Total') {
continue;
}
if ($band != 'SAT') {
echo '<td style="text-align: center">';
if ($band == 'Total') {
echo '<b>'.$dxcc.'</b>';
} else {
echo $dxcc;
}
echo '</td>';
} else {
$addsat='<td style="text-align: center">' . $dxcc . '</td>';
}
}
if (count($bands) > 1) {
echo '<td class="spacingcell"></td>';
}
if ($addsat != '' && count($wae_summary['confirmed']) > 1) {
echo $addsat;
}
echo '</tr>