mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Framework for WAE
This commit is contained in:
@@ -1917,4 +1917,84 @@ class Awards extends CI_Controller {
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function wae () {
|
||||
$this->load->model('wae');
|
||||
$this->load->model('modes');
|
||||
$this->load->model('bands');
|
||||
|
||||
$data['orbits'] = $this->bands->get_worked_orbits();
|
||||
$data['sats_available'] = $this->bands->get_worked_sats();
|
||||
$data['user_default_band'] = $this->session->userdata('user_default_band');
|
||||
|
||||
$data['worked_bands'] = $this->bands->get_worked_bands('dxcc'); // Used in the view for band select
|
||||
$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.
|
||||
if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands
|
||||
$bands = $data['worked_bands'];
|
||||
} else {
|
||||
$bands[] = $this->security->xss_clean($this->input->post('band'));
|
||||
}
|
||||
} else {
|
||||
$bands = $data['worked_bands'];
|
||||
}
|
||||
|
||||
$data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view
|
||||
|
||||
if($this->input->method() === 'post') {
|
||||
$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['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1;
|
||||
$postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1;
|
||||
$postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1;
|
||||
$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'));
|
||||
} else { // Setting default values at first load of page
|
||||
$postdata['qsl'] = 1;
|
||||
$postdata['lotw'] = 1;
|
||||
$postdata['eqsl'] = 0;
|
||||
$postdata['qrz'] = 0;
|
||||
$postdata['worked'] = 1;
|
||||
$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';
|
||||
}
|
||||
|
||||
$dxcclist = $this->wae->fetchdxcc($postdata);
|
||||
|
||||
$data['wae_array'] = $this->wae->get_wae_array($dxcclist, $bands, $postdata);
|
||||
$data['wae_summary'] = $this->wae->get_wae_summary($bands, $postdata);
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = sprintf(__("Awards - %s"), __("WAE"));
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('awards/wae/index');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
480
application/models/Wae.php
Normal file
480
application/models/Wae.php
Normal file
@@ -0,0 +1,480 @@
|
||||
<?php
|
||||
|
||||
class WAE extends CI_Model {
|
||||
|
||||
// Make an array of the WAE countries
|
||||
// If in special group JW/b, GM/s etc, do a lookup into db to find WAE country and place
|
||||
// Probably a lookup from the DB with a list from DARC.
|
||||
|
||||
// Reference: https://www.darc.de/der-club/referate/dx/diplome/wae-diplom/wae-laenderliste/
|
||||
|
||||
// Which adifkey should we use?
|
||||
// adifkey+E?
|
||||
|
||||
// $sql = select * from dxcc_entities where cont = 'EU' and end is null
|
||||
|
||||
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';
|
||||
|
||||
// $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
|
||||
// I1 Triest Mar 31, 1957
|
||||
// UN Karelo Finish Republic Jun 30, 1960
|
||||
// DL Germany Sep 16, 1973
|
||||
// Y2 German Democratic Republic Sep 17, 1973 Oct 2, 1990
|
||||
// UA1N Karelia Jul 1, 1960 Dec 31, 1991
|
||||
// OK Czechoslovakia Dec 31, 1992
|
||||
// R1MV Maliy Vysotskij Isl. Feb 17, 2012
|
||||
|
||||
function __construct() {
|
||||
if(!$this->load->is_loaded('Genfunctions')) {
|
||||
$this->load->library('Genfunctions');
|
||||
}
|
||||
}
|
||||
|
||||
function get_wae_array($dxccArray, $bands, $postdata) {
|
||||
$this->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$qsl = $this->genfunctions->gen_qsl_from_postdata($postdata);
|
||||
|
||||
foreach ($bands as $band) { // Looping through bands and entities to generate the array needed for display
|
||||
foreach ($dxccArray as $dxcc) {
|
||||
if ($dxcc->adif == '0') {
|
||||
$dxccMatrix[$dxcc->adif]['name'] = $dxcc->name;
|
||||
} else {
|
||||
$dxccMatrix[$dxcc->adif]['name'] = ucwords(strtolower($dxcc->name), "- (/");
|
||||
}
|
||||
$dxccMatrix[$dxcc->adif]['Dxccprefix'] = $dxcc->prefix;
|
||||
if ($postdata['includedeleted'])
|
||||
$dxccMatrix[$dxcc->adif]['Deleted'] = isset($dxcc->Enddate) ? 1 : 0;
|
||||
$dxccMatrix[$dxcc->adif][$band] = '-';
|
||||
}
|
||||
|
||||
// If worked is checked, we add worked entities to the array
|
||||
if ($postdata['worked'] != NULL) {
|
||||
$workedDXCC = $this->getDxccBandWorked($location_list, $band, $postdata);
|
||||
foreach ($workedDXCC as $wdxcc) {
|
||||
$dxccMatrix[$wdxcc->dxcc][$band] = '<div class="bg-danger awardsBgDanger" ><a href=\'javascript:displayContacts("'.str_replace("&", "%26", $wdxcc->name).'","'. $band . '","'. $postdata['sat'] . '","' . $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC", "")\'>W</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// If confirmed is checked, we add confirmed entities to the array
|
||||
if ($postdata['confirmed'] != NULL) {
|
||||
$confirmedDXCC = $this->getDxccBandConfirmed($location_list, $band, $postdata);
|
||||
foreach ($confirmedDXCC as $cdxcc) {
|
||||
$dxccMatrix[$cdxcc->dxcc][$band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("'.str_replace("&", "%26", $cdxcc->name).'","'. $band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","' . $postdata['mode'] . '","DXCC","'.$qsl.'")\'>C</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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($location_list, $postdata);
|
||||
foreach ($workedDxcc as $wdxcc) {
|
||||
if (array_key_exists($wdxcc->dxcc, $dxccMatrix)) {
|
||||
unset($dxccMatrix[$wdxcc->dxcc]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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($location_list, $postdata);
|
||||
foreach ($confirmedDxcc as $cdxcc) {
|
||||
if (array_key_exists($cdxcc->dxcc, $dxccMatrix)) {
|
||||
unset($dxccMatrix[$cdxcc->dxcc]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($dxccMatrix)) {
|
||||
return $dxccMatrix;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function getDxccBandConfirmed($location_list, $band, $postdata) {
|
||||
$bindings=[];
|
||||
$sql = "select adif as dxcc, name from dxcc_entities
|
||||
join (
|
||||
select 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 .
|
||||
") and col_dxcc in ( ". $this->eucountries . ")";
|
||||
|
||||
$sql .= $this->genfunctions->addBandToQuery($band,$bindings);
|
||||
if ($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
|
||||
) x on dxcc_entities.adif = x.col_dxcc";
|
||||
|
||||
if ($postdata['includedeleted'] == NULL) {
|
||||
$sql .= " and dxcc_entities.end is null";
|
||||
}
|
||||
|
||||
$sql .= ' and col_dxcc in ( '. $this->eucountries . ')';
|
||||
|
||||
$query = $this->db->query($sql,$bindings);
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getDxccBandWorked($location_list, $band, $postdata) {
|
||||
$bindings=[];
|
||||
$sql = "select adif as dxcc, name from dxcc_entities
|
||||
join (
|
||||
select 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 .
|
||||
") and col_dxcc in ( ". $this->eucountries . ")";
|
||||
$sql .= $this->genfunctions->addBandToQuery($band,$bindings);
|
||||
if ($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 .= " group by col_dxcc
|
||||
) x on dxcc_entities.adif = x.col_dxcc";;
|
||||
if ($postdata['includedeleted'] == NULL) {
|
||||
$sql .= " and dxcc_entities.end is null";
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql,$bindings);
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function fetchDxcc($postdata) {
|
||||
$bindings=[];
|
||||
$this->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$sql = "select adif, prefix, name, date(end) Enddate, date(start) Startdate, lat, `long`
|
||||
from dxcc_entities";
|
||||
|
||||
if ($postdata['notworked'] == NULL) {
|
||||
$sql .= " join (select 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 . ") and col_dxcc in ( ". $this->eucountries . ")";
|
||||
|
||||
if ($postdata['band'] != 'All') {
|
||||
if ($postdata['band'] == 'SAT') {
|
||||
$sql .= " and col_prop_mode = ?";
|
||||
$bindings[]=$postdata['band'];
|
||||
if ($postdata['sat'] != 'All') {
|
||||
$sql .= " and col_sat_name = ?";
|
||||
$bindings[]=$postdata['sat'];
|
||||
}
|
||||
} else {
|
||||
$sql .= " and col_prop_mode !='SAT'";
|
||||
$sql .= " and col_band = ?";
|
||||
$bindings[]=$postdata['band'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
$bindings[]=$postdata['mode'];
|
||||
$bindings[]=$postdata['mode'];
|
||||
}
|
||||
|
||||
$sql .= $this->addOrbitToQuery($postdata, $bindings);
|
||||
$sql .= " and col_dxcc in ( ". $this->eucountries . ")";
|
||||
|
||||
$sql .= ' group by col_dxcc) x on dxcc_entities.adif = x.col_dxcc';
|
||||
}
|
||||
|
||||
$sql .= " where 1 = 1";
|
||||
|
||||
if ($postdata['includedeleted'] == NULL) {
|
||||
$sql .= " and end is null";
|
||||
}
|
||||
|
||||
$sql .= " and adif in ( ". $this->eucountries . ")";
|
||||
|
||||
|
||||
$sql .= ' order by prefix';
|
||||
$query = $this->db->query($sql,$bindings);
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getDxccWorked($location_list, $postdata) {
|
||||
$bindings=[];
|
||||
$sql = "SELECT adif as dxcc FROM dxcc_entities
|
||||
join (
|
||||
select 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 .
|
||||
") and col_dxcc in ( ". $this->eucountries . ")";
|
||||
$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 and col_dxcc > 0";
|
||||
$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
|
||||
) ll on dxcc_entities.adif = ll.col_dxcc
|
||||
where 1=1";
|
||||
|
||||
if ($postdata['includedeleted'] == NULL) {
|
||||
$sql .= " and dxcc_entities.end is null";
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql,$bindings);
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getDxccConfirmed($location_list, $postdata) {
|
||||
$bindings=[];
|
||||
$sql = "SELECT adif as dxcc FROM dxcc_entities
|
||||
join (
|
||||
select 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 .
|
||||
") and col_dxcc in ( ". $this->eucountries . ")";
|
||||
|
||||
$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
|
||||
) ll on dxcc_entities.adif = ll.col_dxcc
|
||||
where 1=1";
|
||||
|
||||
if ($postdata['includedeleted'] == NULL) {
|
||||
$sql .= " and dxcc_entities.end is null";
|
||||
}
|
||||
|
||||
$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) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
foreach ($bands as $band) {
|
||||
$worked = $this->getSummaryByBand($band, $postdata, $location_list);
|
||||
$confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list);
|
||||
$dxccSummary['worked'][$band] = $worked[0]->count;
|
||||
$dxccSummary['confirmed'][$band] = $confirmed[0]->count;
|
||||
}
|
||||
|
||||
$workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list);
|
||||
$confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list);
|
||||
|
||||
$dxccSummary['worked']['Total'] = $workedTotal[0]->count;
|
||||
$dxccSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
|
||||
|
||||
return $dxccSummary;
|
||||
}
|
||||
|
||||
function getSummaryByBand($band, $postdata, $location_list) {
|
||||
$bindings=[];
|
||||
$sql = "SELECT count(distinct thcv.col_dxcc) as count 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 . ") and col_dxcc > 0";
|
||||
|
||||
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') {
|
||||
$this->load->model('bands');
|
||||
|
||||
$bandslots = $this->bands->get_worked_bands('dxcc');
|
||||
|
||||
$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";
|
||||
}
|
||||
$sql .= " and col_dxcc 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 getSummaryByBandConfirmed($band, $postdata, $location_list) {
|
||||
$bindings=[];
|
||||
$sql = "SELECT count(distinct thcv.col_dxcc) as count 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 . ") and col_dxcc > 0";
|
||||
|
||||
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') {
|
||||
$this->load->model('bands');
|
||||
|
||||
$bandslots = $this->bands->get_worked_bands('dxcc');
|
||||
|
||||
$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";
|
||||
}
|
||||
|
||||
$sql .= " and col_dxcc in ( ". $this->eucountries . ")";
|
||||
|
||||
$query = $this->db->query($sql,$bindings);
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
}
|
||||
?>
|
||||
218
application/views/awards/wae/index.php
Normal file
218
application/views/awards/wae/index.php
Normal file
@@ -0,0 +1,218 @@
|
||||
<div class="container">
|
||||
<!-- Award Info Box -->
|
||||
<br>
|
||||
<div id="awardInfoButton">
|
||||
<script>
|
||||
var lang_awards_info_button = "<?= __("Award Info"); ?>";
|
||||
var lang_award_info_ln1 = "<?= __("WAE Award"); ?>";
|
||||
var lang_award_info_ln2 = "";
|
||||
var lang_award_info_ln3 = "";
|
||||
var lang_award_info_ln4 = "";
|
||||
</script>
|
||||
<h2><?php echo $page_title; ?></h2>
|
||||
<button type="button" class="btn btn-sm btn-primary me-1" id="displayAwardInfo"><?= __("Award Info"); ?></button>
|
||||
</div>
|
||||
<!-- End of Award Info Box -->
|
||||
|
||||
<form class="form" action="<?php echo site_url('awards/wae'); ?>" method="post" enctype="multipart/form-data">
|
||||
<fieldset>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<div class="col-md-2 control-label" for="checkboxes"><?= __("Deleted WAE"); ?></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>
|
||||
</div>
|
||||
</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') || $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>
|
||||
|
||||
<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"); ?></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 class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="clublog" value="1" id="clublog" <?php if ($this->input->post('clublog')) 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="band"><?= __("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'; ?> ><?= __("Every band"); ?></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>
|
||||
<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="distplot_sats"><?= __("Satellite"); ?></label>
|
||||
<div class="col-md-2">
|
||||
<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) {
|
||||
echo '<option value="' . $sat . '"';
|
||||
if ($this->input->post('sats') == $sat) echo ' selected';
|
||||
echo '>' . $sat . '</option>'."\n";
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<input id="sats" type="hidden" value="All"></input>
|
||||
<?php } ?>
|
||||
</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">
|
||||
<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
|
||||
foreach($orbits as $orbit){
|
||||
echo '<option value="' . $orbit . '"';
|
||||
if ($this->input->post('orbits') == $orbit) echo ' selected';
|
||||
echo '>' . strtoupper($orbit) . '</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-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";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</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
|
||||
$i = 1;
|
||||
if ($wae_array) {
|
||||
echo '
|
||||
<table style="width:100%" class="table-sm table tabledxcc table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>#</td>
|
||||
<td>' . __("DXCC Name") . '</td>
|
||||
<td>' . __("Prefix") . '</td>';
|
||||
foreach($bands as $band) {
|
||||
echo '<td>' . $band . '</td>';
|
||||
}
|
||||
echo '</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
foreach ($wae_array as $dxcc => $value) { // Fills the table with the data
|
||||
echo '<tr>
|
||||
<td>'. $i++ .'</td>';
|
||||
foreach ($value as $name => $key) {
|
||||
if (isset($value['Deleted']) && $value['Deleted'] == 1 && $name == "name") {
|
||||
echo '<td style="text-align: center">' . $key . ' <span class="badge text-bg-danger">'.__("Deleted DXCC").'</span></td>';
|
||||
} else if ($name == "Deleted") {
|
||||
continue;
|
||||
} else {
|
||||
echo '<td style="text-align: center">' . $key . '</td>';
|
||||
}
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>
|
||||
<h2>' . __("Summary") . '</h2>
|
||||
|
||||
<table class="table-sm tablesummary table table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>
|
||||
<tr><td></td>';
|
||||
|
||||
foreach($bands as $band) {
|
||||
echo '<td>' . $band . '</td>';
|
||||
}
|
||||
echo '<td>' . __("Total") . '</td>
|
||||
</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>';
|
||||
}
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
echo '</tr>
|
||||
</table>
|
||||
</div>';
|
||||
|
||||
}
|
||||
else {
|
||||
echo '<div class="alert alert-danger" role="alert">' . __("Nothing found!") . '</div>';
|
||||
}
|
||||
?>
|
||||
@@ -1680,7 +1680,7 @@ $(document).ready(function(){
|
||||
<script src="<?php echo base_url(); ?>assets/js/sections/webadif.js"></script>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->uri->segment(2) == "dxcc") { ?>
|
||||
<?php if ($this->uri->segment(2) == "dxcc" || $this->uri->segment(2) == "wae") { ?>
|
||||
<script>
|
||||
$('.tabledxcc').DataTable({
|
||||
"pageLength": 25,
|
||||
|
||||
@@ -200,6 +200,8 @@
|
||||
<li><a class="dropdown-item" href="<?php echo site_url('awards/dok'); ?>"><i class="fas fa-trophy"></i> <?= __("DOK"); ?></a></li>
|
||||
<div class="dropdown-divider"></div>
|
||||
<li><a class="dropdown-item" href="<?php echo site_url('awards/gridmaster/dl'); ?>"><i class="fas fa-trophy"></i> <?= __("DL Gridmaster"); ?></a></li>
|
||||
<div class="dropdown-divider"></div>
|
||||
<li><a class="dropdown-item" href="<?php echo site_url('awards/wae'); ?>"><i class="fas fa-trophy"></i> <?= __("WAE (Worked All Europe)"); ?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
||||
Reference in New Issue
Block a user