[Awards] Fixed DXCC QSO details to also filter on modes. Made a generic function to display QSOs. It's now used for DXCC, WAS, IOTA, CQ, VUCC. This is also done in preparation for adding mode filter to WAS, IOTA and CQ Award.

pull/1102/head
Andreas 2021-07-24 14:31:16 +02:00
rodzic 19c750a40c
commit 8b370c9783
9 zmienionych plików z 119 dodań i 280 usunięć

Wyświetl plik

@ -140,19 +140,6 @@ class Awards extends CI_Controller {
$this->load->view('interface_assets/footer');
}
public function dxcc_details_ajax(){
$this->load->model('logbook_model');
$country = str_replace('"', "", $this->input->post("Country"));
$band = str_replace('"', "", $this->input->post("Band"));
$data['results'] = $this->logbook_model->dxcc_qso_details($country, $band);
// Render Page
$data['page_title'] = "Log View - DXCC";
$data['filter'] = "country ".$country. " and ".$band;
$this->load->view('awards/details', $data);
}
public function vucc() {
$this->load->model('vucc');
$data['worked_bands'] = $this->vucc->get_worked_bands();
@ -195,6 +182,25 @@ class Awards extends CI_Controller {
$this->load->view('awards/details', $data);
}
/*
* Used to fetch QSOs from the logbook in the awards
*/
public function qso_details_ajax(){
$this->load->model('logbook_model');
$searchphrase = str_replace('"', "", $this->input->post("Searchphrase"));
$band = str_replace('"', "", $this->input->post("Band"));
$mode = str_replace('"', "", $this->input->post("Mode"));
$type = $this->input->post('Type');
$data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type);
// Render Page
$data['page_title'] = "Log View - " . $type;
$data['filter'] = $type . " " . $searchphrase . " and band ".$band . " and mode ".$mode;
$this->load->view('awards/details', $data);
}
/*
Handles showing worked SOTAs
Comment field - SOTA:#
@ -262,19 +268,6 @@ class Awards extends CI_Controller {
$this->load->view('interface_assets/footer');
}
public function cq_details_ajax(){
$this->load->model('logbook_model');
$cqzone = str_replace('"', "", $this->input->post("CQZone"));
$band = str_replace('"', "", $this->input->post("Band"));
$data['results'] = $this->logbook_model->cq_qso_details($cqzone, $band);
// Render Page
$data['page_title'] = "Log View - DXCC";
$data['filter'] = "CQZone ".$cqzone. " and ".$band;;
$this->load->view('awards/details', $data);
}
public function was() {
$this->load->model('was');
$data['worked_bands'] = $this->was->get_worked_bands();
@ -320,19 +313,6 @@ class Awards extends CI_Controller {
$this->load->view('interface_assets/footer');
}
public function was_details_ajax() {
$this->load->model('logbook_model');
$state = str_replace('"', "", $this->input->post("State"));
$band = str_replace('"', "", $this->input->post("Band"));
$data['results'] = $this->logbook_model->was_qso_details($state, $band);
// Render Page
$data['page_title'] = "Log View - WAS";
$data['filter'] = "state ".$state. " and ".$band;
$this->load->view('awards/details', $data);
}
public function iota () {
$this->load->model('iota');
$data['worked_bands'] = $this->iota->get_worked_bands(); // Used in the view for band select
@ -391,19 +371,6 @@ class Awards extends CI_Controller {
$this->load->view('interface_assets/footer');
}
public function iota_details_ajax(){
$this->load->model('logbook_model');
$iota = str_replace('"', "", $this->input->post("Iota"));
$band = str_replace('"', "", $this->input->post("Band"));
$data['results'] = $this->logbook_model->iota_qso_details($iota, $band);
// Render Page
$data['page_title'] = "Log View - IOTA";
$data['filter'] = "iota ".$iota. " and ".$band;
$this->load->view('awards/details', $data);
}
public function counties() {
$this->load->model('counties');
$data['counties_array'] = $this->counties->get_counties_array();

Wyświetl plik

@ -89,14 +89,14 @@ class CQ extends CI_Model{
if ($postdata['worked'] != NULL) {
$cqBand = $this->getCQWorked($station_id, $band, $postdata);
foreach ($cqBand as $line) {
$bandCq[$line->col_cqz][$band] = '<div class="alert-danger"><a href=\'javascript:displayCqContacts("' . str_replace("&", "%26", $line->col_cqz) . '","' . $band . '")\'>W</a></div>';
$bandCq[$line->col_cqz][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $line->col_cqz) . '","' . $band . '","All","CQZone")\'>W</a></div>';
$cqZ[$line->col_cqz]['count']++;
}
}
if ($postdata['confirmed'] != NULL) {
$cqBand = $this->getCQConfirmed($station_id, $band, $postdata);
foreach ($cqBand as $line) {
$bandCq[$line->col_cqz][$band] = '<div class="alert-success"><a href=\'javascript:displayCqContacts("' . str_replace("&", "%26", $line->col_cqz) . '","' . $band . '")\'>C</a></div>';
$bandCq[$line->col_cqz][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $line->col_cqz) . '","' . $band . '","All","CQZone")\'>C</a></div>';
$cqZ[$line->col_cqz]['count']++;
}
}

Wyświetl plik

@ -60,7 +60,7 @@ class DXCC extends CI_Model {
foreach(array_keys($this->bandslots) as $slot) {
if(in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
}
return $results;
@ -89,10 +89,10 @@ class DXCC extends CI_Model {
// update stats
if (!isset($results[$row->COL_COUNTRY]))
$results[$row->COL_COUNTRY] = [];
$results[$row->COL_COUNTRY] = [];
if (!isset($results[$row->COL_COUNTRY][$row->COL_BAND]))
$results[$row->COL_COUNTRY][$row->COL_BAND] = 0;
$results[$row->COL_COUNTRY][$row->COL_BAND] = 0;
$results[$row->COL_COUNTRY][$row->COL_BAND] += $row->cnt;
}
@ -115,10 +115,10 @@ class DXCC extends CI_Model {
// update stats
if (!isset($results[$row->COL_COUNTRY]))
$results[$row->COL_COUNTRY] = [];
$results[$row->COL_COUNTRY] = [];
if (!isset($results[$row->COL_COUNTRY][$row->COL_PROP_MODE]))
$results[$row->COL_COUNTRY][$row->COL_PROP_MODE] = 0;
$results[$row->COL_COUNTRY][$row->COL_PROP_MODE] = 0;
$results[$row->COL_COUNTRY][$row->COL_PROP_MODE] += $row->cnt;
}
@ -203,7 +203,8 @@ class DXCC extends CI_Model {
if ($postdata['worked'] != NULL) {
$workedDXCC = $this->getDxccBandWorked($station_id, $band, $postdata);
foreach ($workedDXCC as $wdxcc) {
$dxccMatrix[$wdxcc->dxcc][$band] = '<div class="alert-danger"><a href=\'javascript:displayDxccContacts("'.str_replace("&", "%26", $wdxcc->name).'","'. $band . '")\'>W</a></div>';
//function displayContacts(searchphrase, band, mode, type) {
$dxccMatrix[$wdxcc->dxcc][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("'.str_replace("&", "%26", $wdxcc->name).'","'. $band . '","'. $postdata['mode'] . '","DXCC")\'>W</a></div>';
}
}
@ -211,7 +212,7 @@ class DXCC extends CI_Model {
if ($postdata['confirmed'] != NULL) {
$confirmedDXCC = $this->getDxccBandConfirmed($station_id, $band, $postdata);
foreach ($confirmedDXCC as $cdxcc) {
$dxccMatrix[$cdxcc->dxcc][$band] = '<div class="alert-success"><a href=\'javascript:displayDxccContacts("'.str_replace("&", "%26", $cdxcc->name).'","'. $band . '")\'>C</a></div>';
$dxccMatrix[$cdxcc->dxcc][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("'.str_replace("&", "%26", $cdxcc->name).'","'. $band . '","'. $postdata['mode'] . '","DXCC")\'>C</a></div>';
}
}
}
@ -317,7 +318,7 @@ class DXCC extends CI_Model {
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$sql = "select adif, prefix, name, date(end) Enddate, date(start) Startdate
$sql = "select adif, prefix, name, date(end) Enddate, date(start) Startdate
from dxcc_entities";
if ($postdata['notworked'] == NULL) {
@ -357,7 +358,7 @@ class DXCC extends CI_Model {
function getDxccWorked($station_id, $postdata) {
$sql = "SELECT adif as dxcc FROM dxcc_entities
join (
select col_dxcc
select col_dxcc
from ".$this->config->item('table_name')." thcv
where station_id = " . $station_id .
" and col_dxcc > 0";
@ -414,7 +415,7 @@ class DXCC extends CI_Model {
function getDxccConfirmed($station_id, $postdata) {
$sql = "SELECT adif as dxcc FROM dxcc_entities
join (
select col_dxcc
select col_dxcc
from ".$this->config->item('table_name')." thcv
where station_id = ". $station_id .
" and col_dxcc > 0";
@ -499,7 +500,7 @@ class DXCC extends CI_Model {
}
return $sql;
}
/*
* Function gets worked and confirmed summary on each band on the active stationprofile
*/
@ -566,7 +567,7 @@ class DXCC extends CI_Model {
return $query->result();
}
function lookup_country($country)
{
$query = $this->db->query('

Wyświetl plik

@ -81,7 +81,7 @@ class IOTA extends CI_Model {
if ($postdata['worked'] != NULL) {
$workedIota = $this->getIotaBandWorked($station_id, $band, $postdata);
foreach ($workedIota as $wiota) {
$iotaMatrix[$wiota->tag][$band] = '<div class="alert-danger"><a href=\'javascript:displayIotaContacts("'.$wiota->tag.'","'. $band . '")\'>W</a></div>';
$iotaMatrix[$wiota->tag][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("'.$wiota->tag.'","'. $band . '","All","IOTA")\'>W</a></div>';
}
}
@ -89,7 +89,7 @@ class IOTA extends CI_Model {
if ($postdata['confirmed'] != NULL) {
$confirmedIota = $this->getIotaBandConfirmed($station_id, $band, $postdata);
foreach ($confirmedIota as $ciota) {
$iotaMatrix[$ciota->tag][$band] = '<div class="alert-success"><a href=\'javascript:displayIotaContacts("'.$ciota->tag.'","'. $band . '")\'>C</a></div>';
$iotaMatrix[$ciota->tag][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("'.$ciota->tag.'","'. $band . '","All","IOTA")\'>C</a></div>';
}
}
}
@ -123,7 +123,7 @@ class IOTA extends CI_Model {
}
function getIotaBandConfirmed($station_id, $band, $postdata) {
$sql = "SELECT distinct col_iota as tag FROM " . $this->config->item('table_name') . " thcv
$sql = "SELECT distinct col_iota as tag FROM " . $this->config->item('table_name') . " thcv
join iota on thcv.col_iota = iota.tag
where station_id = " . $station_id .
" and thcv.col_iota is not null
@ -149,7 +149,7 @@ class IOTA extends CI_Model {
}
function getIotaBandWorked($station_id, $band, $postdata) {
$sql = 'SELECT distinct col_iota as tag FROM ' . $this->config->item('table_name'). ' thcv
$sql = 'SELECT distinct col_iota as tag FROM ' . $this->config->item('table_name'). ' thcv
join iota on thcv.col_iota = iota.tag
where station_id = ' . $station_id .
' and thcv.col_iota is not null';
@ -207,7 +207,7 @@ class IOTA extends CI_Model {
}
function getIotaWorked($station_id, $postdata) {
$sql = "SELECT distinct col_iota as tag FROM " . $this->config->item('table_name') . " thcv
$sql = "SELECT distinct col_iota as tag FROM " . $this->config->item('table_name') . " thcv
join iota on thcv.col_iota = iota.tag
where station_id = " . $station_id .
" and thcv.col_iota is not null
@ -248,7 +248,7 @@ class IOTA extends CI_Model {
}
function getIotaConfirmed($station_id, $postdata) {
$sql = "SELECT distinct col_iota as tag FROM " . $this->config->item('table_name') . " thcv
$sql = "SELECT distinct col_iota as tag FROM " . $this->config->item('table_name') . " thcv
join iota on thcv.col_iota = iota.tag
where station_id = " . $station_id .
" and thcv.col_iota is not null
@ -375,4 +375,4 @@ class IOTA extends CI_Model {
return $query->result();
}
}
?>
?>

Wyświetl plik

@ -232,40 +232,50 @@ class Logbook_model extends CI_Model {
return($row);
}
}
/*
* Used to fetch QSOs from the logbook in the awards
*/
public function qso_details($searchphrase, $band, $mode, $type){
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
public function dxcc_qso_details($country, $band){
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
switch ($type) {
case 'DXCC':
$this->db->where('COL_COUNTRY', $searchphrase);
break;
case 'IOTA':
$this->db->where('COL_IOTA', $searchphrase);
break;
case 'VUCC':
$this->db->where("(COL_GRIDSQUARE like '%" . $searchphrase . "%' OR COL_VUCC_GRIDS like'%" . $searchphrase ."%')");
break;
case 'CQZone':
$this->db->where('COL_CQZ', $searchphrase);
break;
case 'WAS':
$this->db->where('COL_STATE', $searchphrase);
$this->db->where_in('COL_DXCC', ['291', '6', '110']);
break;
}
$this->db->where('station_id', $station_id);
$this->db->where('COL_COUNTRY', $country);
if($band != "SAT") {
$this->db->where('COL_PROP_MODE !=', 'SAT');
$this->db->where('COL_BAND', $band);
} else {
$this->db->where('COL_PROP_MODE', "SAT");
}
$this->db->where('station_id', $station_id);
return $this->db->get($this->config->item('table_name'));
}
if ($band != 'All') {
if($band != "SAT") {
$this->db->where('COL_PROP_MODE !=', 'SAT');
$this->db->where('COL_BAND', $band);
} else {
$this->db->where('COL_PROP_MODE', "SAT");
}
}
public function iota_qso_details($iota, $band){
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
if ($mode != 'All') {
$this->db->where("(COL_MODE='" . $mode . "' OR COL_SUBMODE='" . $mode ."')");
}
$this->db->where('station_id', $station_id);
$this->db->where('COL_IOTA', $iota);
if($band != "SAT") {
$this->db->where('COL_PROP_MODE !=', 'SAT');
$this->db->where('COL_BAND', $band);
} else {
$this->db->where('COL_PROP_MODE', "SAT");
}
return $this->db->get($this->config->item('table_name'));
}
return $this->db->get($this->config->item('table_name'));
}
public function vucc_qso_details($gridsquare, $band) {
$CI =& get_instance();
@ -288,26 +298,6 @@ class Logbook_model extends CI_Model {
return $this->db->query($sql);
}
public function cq_qso_details($cqzone, $band){
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
if ($band != 'All') {
if ($band == 'SAT') {
$this->db->where('col_prop_mode', $band);
} else if ($band != '') {
$this->db->where('col_prop_mode !=', 'SAT');
$this->db->where('col_band', $band);
}
}
$this->db->where('station_id', $station_id);
$this->db->where('COL_CQZ', $cqzone);
return $this->db->get($this->config->item('table_name'));
}
public function timeline_qso_details($querystring, $band, $mode, $type){
$CI =& get_instance();
$CI->load->model('Stations');
@ -338,26 +328,6 @@ class Logbook_model extends CI_Model {
return $this->db->get($this->config->item('table_name'));
}
public function was_qso_details($state, $band){
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$this->db->where('station_id', $station_id);
$this->db->where('COL_STATE', $state);
$this->db->where_in('COL_DXCC', ['291', '6', '110']);
if($band != 'All') {
if($band != "SAT") {
$this->db->where('COL_PROP_MODE !=', 'SAT');
$this->db->where('COL_BAND', $band);
} else {
$this->db->where('COL_PROP_MODE', "SAT");
}
}
return $this->db->get($this->config->item('table_name'));
}
public function get_callsigns($callsign){
$this->db->select('COL_CALL');
$this->db->distinct();

Wyświetl plik

@ -87,14 +87,14 @@ class was extends CI_Model {
if ($postdata['worked'] != NULL) {
$wasBand = $this->getWasWorked($station_id, $band, $postdata);
foreach ($wasBand as $line) {
$bandWas[$line->col_state][$band] = '<div class="alert-danger"><a href=\'javascript:displayWasContacts("' . $line->col_state . '","' . $band . '")\'>W</a></div>';
$bandWas[$line->col_state][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","All","WAS")\'>W</a></div>';
$states[$line->col_state]['count']++;
}
}
if ($postdata['confirmed'] != NULL) {
$wasBand = $this->getWasConfirmed($station_id, $band, $postdata);
foreach ($wasBand as $line) {
$bandWas[$line->col_state][$band] = '<div class="alert-success"><a href=\'javascript:displayWasContacts("' . $line->col_state . '","' . $band . '")\'>C</a></div>';
$bandWas[$line->col_state][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","All","WAS")\'>C</a></div>';
$states[$line->col_state]['count']++;
}
}
@ -208,7 +208,7 @@ class was extends CI_Model {
* $postdata contains data from the form, in this case Lotw or QSL are used
*/
function getWasWorked($station_id, $band, $postdata) {
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
where station_id = " . $station_id;
$sql .= $this->addStateToQuery();
@ -237,7 +237,7 @@ class was extends CI_Model {
* $postdata contains data from the form, in this case Lotw or QSL are used
*/
function getWasConfirmed($station_id, $band, $postdata) {
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
where station_id = " . $station_id;
$sql .= $this->addStateToQuery();
@ -287,4 +287,4 @@ class was extends CI_Model {
return $sql;
}
}
?>
?>

Wyświetl plik

@ -23,7 +23,7 @@
foreach ($vucc_array as $vucc => $value) { // Fills the table with the data
echo '<tr>
<td>'. $i++ .'</td>
<td><a href=\'javascript:displayVuccContacts("'. $vucc .'","'. $band . '")\'>'. $vucc .'</td>';
<td><a href=\'javascript:displayContacts("'. $vucc .'","'. $band . '","All","VUCC")\'>'. $vucc .'</td>';
if ($type != 'worked') {
echo '<td>'. $value['qsl'] . '</td>

Wyświetl plik

@ -135,7 +135,7 @@
'click' : function(event, data) {
displayWasContacts(data.name,$('#band2').val());
displayContacts(data.name,$('#band2').val(), 'All', 'WAS');
}
});

Wyświetl plik

@ -991,33 +991,6 @@ $(document).ready(function(){
if (background != ('rgb(255, 255, 255)')) {
$(".buttons-csv").css("color", "white");
}
function displayDxccContacts(country, band) {
var baseURL = "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/awards/dxcc_details_ajax',
type: 'post',
data: {
'Country': country,
'Band': band
},
success: function (html) {
BootstrapDialog.show({
title: 'QSO Data',
size: BootstrapDialog.SIZE_WIDE,
cssClass: 'qso-dxcc-dialog',
nl2br: false,
message: html,
buttons: [{
label: 'Close',
action: function (dialogItself) {
dialogItself.close();
}
}]
});
}
});
}
</script>
<?php } ?>
@ -1043,32 +1016,6 @@ $(document).ready(function(){
if (background != ('rgb(255, 255, 255)')) {
$(".buttons-csv").css("color", "white");
}
function displayVuccContacts(gridsquare, band) {
var baseURL= "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/awards/vucc_details_ajax',
type: 'post',
data: {'Gridsquare': gridsquare,
'Band': band
},
success: function(html) {
BootstrapDialog.show({
title: 'QSO Data',
size: BootstrapDialog.SIZE_WIDE,
cssClass: 'qso-vucc-dialog',
nl2br: false,
message: html,
buttons: [{
label: 'Close',
action: function (dialogItself) {
dialogItself.close();
}
}]
});
}
});
}
</script>
<?php } ?>
@ -1137,32 +1084,6 @@ $(document).ready(function(){
if (background != ('rgb(255, 255, 255)')) {
$(".buttons-csv").css("color", "white");
}
function displayIotaContacts(iota, band) {
var baseURL= "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/awards/iota_details_ajax',
type: 'post',
data: {'Iota': iota,
'Band': band
},
success: function(html) {
BootstrapDialog.show({
title: 'QSO Data',
size: BootstrapDialog.SIZE_WIDE,
cssClass: 'qso-iota-dialog',
nl2br: false,
message: html,
buttons: [{
label: 'Close',
action: function (dialogItself) {
dialogItself.close();
}
}]
});
}
});
}
</script>
<?php } ?>
@ -1200,32 +1121,6 @@ $(document).ready(function(){
if (background != ('rgb(255, 255, 255)')) {
$(".buttons-csv").css("color", "white");
}
function displayCqContacts(cqzone, band) {
var baseURL= "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/awards/cq_details_ajax',
type: 'post',
data: {'CQZone': cqzone,
'Band': band
},
success: function(html) {
BootstrapDialog.show({
title: 'QSO Data',
size: BootstrapDialog.SIZE_WIDE,
cssClass: 'qso-cq-dialog',
nl2br: false,
message: html,
buttons: [{
label: 'Close',
action: function (dialogItself) {
dialogItself.close();
}
}]
});
}
});
}
</script>
<?php } ?>
@ -1262,32 +1157,6 @@ $(document).ready(function(){
if (background != ('rgb(255, 255, 255)')) {
$(".buttons-csv").css("color", "white");
}
function displayWasContacts(was, band) {
var baseURL= "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/awards/was_details_ajax',
type: 'post',
data: {'State': was,
'Band': band
},
success: function(html) {
BootstrapDialog.show({
title: 'QSO Data',
size: BootstrapDialog.SIZE_WIDE,
cssClass: 'qso-was-dialog',
nl2br: false,
message: html,
buttons: [{
label: 'Close',
action: function (dialogItself) {
dialogItself.close();
}
}]
});
}
});
}
</script>
<?php } ?>
@ -1701,6 +1570,38 @@ function deleteQsl(id) {
</script>
<script>
/*
* Used to fetch QSOs from the logbook in the awards
*/
function displayContacts(searchphrase, band, mode, type) {
var baseURL = "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/awards/qso_details_ajax',
type: 'post',
data: {
'Searchphrase': searchphrase,
'Band': band,
'Mode': mode,
'Type': type
},
success: function (html) {
BootstrapDialog.show({
title: 'QSO Data',
size: BootstrapDialog.SIZE_WIDE,
cssClass: 'qso-dialog',
nl2br: false,
message: html,
buttons: [{
label: 'Close',
action: function (dialogItself) {
dialogItself.close();
}
}]
});
}
});
}
function uploadQsl() {
var baseURL= "<?php echo base_url();?>";
var formdata = new FormData(document.getElementById("fileinfo"));