diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index a3e8d80cb..ac3a0d618 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -1538,7 +1538,6 @@ class Awards extends CI_Controller { $qrz = $this->security->xss_clean($this->input->post('qrz')); $sat = $this->security->xss_clean($this->input->post('sat')); $orbit = $this->security->xss_clean($this->input->post('orbit')); - $this->load->model('gridmap_model'); $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -1557,4 +1556,36 @@ class Awards extends CI_Controller { echo json_encode($wab_array); } + public function wab_list() { + $band = $this->security->xss_clean($this->input->post('band')); + $mode = $this->security->xss_clean($this->input->post('mode')); + $qsl = $this->security->xss_clean($this->input->post('qsl')); + $lotw = $this->security->xss_clean($this->input->post('lotw')); + $eqsl = $this->security->xss_clean($this->input->post('eqsl')); + $qrz = $this->security->xss_clean($this->input->post('qrz')); + $sat = $this->security->xss_clean($this->input->post('sat')); + $orbit = $this->security->xss_clean($this->input->post('orbit')); + + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $this->load->model('wab'); + + if ($logbooks_locations_array) { + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $wab_array = $this->wab->get_wab_list($band, $location_list, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); + } else { + $location_list = null; + $wab_array = null; + } + + $data['wab_array'] = $wab_array; + $data['postdata']['band'] = $band; + $data['postdata']['mode'] = $mode; + $data['postdata']['sat'] = $sat; + $data['postdata']['orbit'] = $orbit; + + $this->load->view('awards/wab/list', $data); + } + } diff --git a/application/models/Wab.php b/application/models/Wab.php index 0a917ddbd..e97980da3 100644 --- a/application/models/Wab.php +++ b/application/models/Wab.php @@ -40,6 +40,42 @@ class Wab extends CI_Model { return $wabarray; } + function get_wab_list($band, $location_list, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) { + $worked = array(); + $confirmed = array(); + + $worked = $this->getWabWorked($location_list, $band, $mode, $sat, $orbit); + + $confirmed = $this->getWabConfirmed($location_list, $band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); + + $wabarray = array(); + + $workedGridArray = array(); + foreach ($worked as $w) { + array_push($workedGridArray, $w->col_sig_info); + $wabarray += array( + $w->col_sig_info => 'W' + ); + } + + $confirmedGridArray = array(); + foreach ($confirmed as $c) { + array_push($confirmedGridArray, $c->col_sig_info); + + if(array_key_exists($c->col_sig_info, $wabarray)){ + $wabarray[$c->col_sig_info] = 'C'; + } else { + $wabarray += array( + $c->col_sig_info => 'C' + ); + } + } + + ksort($wabarray); + + return $wabarray; + } + /* * Function returns all worked, but not confirmed states * $postdata contains data from the form, in this case Lotw or QSL are used diff --git a/application/views/awards/wab/index.php b/application/views/awards/wab/index.php index 001e7b694..858d69c89 100644 --- a/application/views/awards/wab/index.php +++ b/application/views/awards/wab/index.php @@ -88,7 +88,7 @@
-
- + +
diff --git a/application/views/awards/wab/list.php b/application/views/awards/wab/list.php new file mode 100644 index 000000000..7e2a9656f --- /dev/null +++ b/application/views/awards/wab/list.php @@ -0,0 +1,19 @@ +
+ + + + + + + + + $key) { ?> + + + + + + + +
WAB SquareConfirmed
'. $wab; ?>
+
diff --git a/assets/js/sections/wab.js b/assets/js/sections/wab.js index 16781f21d..fda61e918 100644 --- a/assets/js/sections/wab.js +++ b/assets/js/sections/wab.js @@ -24,7 +24,64 @@ var wab_squares = $.ajax({ } }) +function showlist() { + $(".ld-ext-right-list").addClass('running'); + $(".ld-ext-right-list").prop('disabled', true); + $('#list').prop("disabled", true); + $.ajax({ + url: site_url + '/awards/wab_list', + type: 'post', + data: { + band: $("#band").val(), + mode: $("#mode").val(), + qsl: $("#qsl").is(":checked"), + lotw: $("#lotw").is(":checked"), + eqsl: $("#eqsl").is(":checked"), + qrz: $("#qrz").is(":checked"), + sat: $("#sats").val(), + orbit: $("#orbits").val(), + }, + success: function (data) { + wablist(data); + }, + error: function (data) { + }, + }) +} + +function wablist(data) { + $('#wablist').remove(); + var container = L.DomUtil.get('wabmap'); + + if(container != null){ + container._leaflet_id = null; + container.remove(); + } + $("#mapcontainer").append('
'); + $("#wablist").append(data); + $(".ld-ext-right-list").removeClass('running'); + $(".ld-ext-right-list").prop('disabled', false); + $('#list').prop("disabled", false); + $('.wabtable').DataTable({ + "pageLength": 25, + responsive: false, + ordering: false, + "scrollY": "550px", + "scrollCollapse": true, + "paging": false, + "scrollX": true, + "language": { + url: getDataTablesLanguageUrl(), + }, + dom: 'Bfrtip', + buttons: [ + 'csv' + ] + }); +} + function plotmap() { + $('#wablist').remove(); $(".ld-ext-right-plot").addClass('running'); $(".ld-ext-right-plot").prop('disabled', true); $('#plot').prop("disabled", true); @@ -55,8 +112,8 @@ function wabmap(data) { if(container != null){ container._leaflet_id = null; container.remove(); - $("#mapcontainer").append('
'); } + $("#mapcontainer").append('
'); $(".ld-ext-right-plot").removeClass('running'); $(".ld-ext-right-plot").prop('disabled', false); @@ -66,7 +123,7 @@ function wabmap(data) { fullscreenControlOptions: { position: 'topleft' }, - }).setView([51.5074, -0.1278], 9); + }).setView([51.5074, -1], 9); var confirmedcount = 0; var workedcount = 0; @@ -114,7 +171,7 @@ function wabmap(data) { onEachFeature: function(feature, layer) { layer.on('click', function() { // Code to execute when the area is clicked - displayContactsOnMap($("#wabmap"), feature.properties.name, 'All', 'All', 'All', 'All', 'WAB'); + displayContactsOnMap($("#wabmap"), feature.properties.name, $('#band').val(), $('#sats').val(), $('#orbits').val(), $('#mode').val(), 'WAB'); }); } }).addTo(map); @@ -158,8 +215,4 @@ function wabmap(data) { }; legend.addTo(map); -}; - -$(document).ready(function(){ - plotmap(); - }) +}; \ No newline at end of file