diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 89a356453..20bb51841 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -201,6 +201,17 @@ class Logbookadvanced extends CI_Controller { $this->load->view('adif/data/exportall', $data); } + function export_to_adif_params() { + $this->load->model('logbookadvanced_model'); + + $postdata = $this->input->post(); + $postdata['user_id'] = (int)$this->session->userdata('user_id'); + $postdata['qsoresults'] = 'All'; + $data['qsos'] = $this->logbookadvanced_model->getSearchResult($postdata); + + $this->load->view('adif/data/exportall', $data); + } + function update_qsl() { $this->load->model('logbookadvanced_model'); @@ -306,7 +317,7 @@ class Logbookadvanced extends CI_Controller { 'ids' => xss_clean($this->input->post('ids')) ); - $result = $this->logbookadvanced_model->searchDb($searchCriteria); + $result = $this->logbookadvanced_model->getSearchResultArray($searchCriteria); $this->prepareMappedQSos($result); } @@ -347,7 +358,7 @@ class Logbookadvanced extends CI_Controller { 'qslimages' => xss_clean($this->input->post('qslimages')), ); - $result = $this->logbookadvanced_model->searchDb($searchCriteria); + $result = $this->logbookadvanced_model->getSearchResultArray($searchCriteria); $this->prepareMappedQSos($result); } diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 6d8205caa..33ef9b1ff 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -208,7 +208,11 @@ class Logbookadvanced_model extends CI_Model { $where = "AND $where"; } - $limit = $searchCriteria['qsoresults']; + $limit = ''; + + if ($searchCriteria['qsoresults'] != 'All') { + $limit = 'limit ' . $searchCriteria['qsoresults']; + } $where2 = ''; @@ -222,7 +226,7 @@ class Logbookadvanced_model extends CI_Model { } $sql = " - SELECT * + SELECT *, dxcc_entities.name AS station_country FROM " . $this->config->item('table_name') . " qsos INNER JOIN station_profile ON qsos.station_id=station_profile.station_id LEFT OUTER JOIN satellite ON qsos.COL_SAT_NAME = satellite.name @@ -237,12 +241,19 @@ class Logbookadvanced_model extends CI_Model { $where $where2 ORDER BY qsos.COL_TIME_ON desc, qsos.COL_PRIMARY_KEY desc - LIMIT $limit + $limit "; - $data = $this->db->query($sql, $binding); + return $this->db->query($sql, $binding); - $results = $data->result('array'); - return $results; + } + + public function getSearchResult($searchCriteria) { + return $this->searchDb($searchCriteria); + } + + public function getSearchResultArray($searchCriteria) { + $result = $this->searchDb($searchCriteria); + return $result->result('array'); } /* @@ -250,7 +261,7 @@ class Logbookadvanced_model extends CI_Model { * @return array */ public function searchQsos($searchCriteria) : array { - $results = $this->searchDb($searchCriteria); + $results = $this->getSearchResultArray($searchCriteria); $qsos = []; foreach ($results as $data) { diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 7f4fe803d..efad26ebe 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -61,372 +61,377 @@ $options = json_decode($options);
-
" method="post"> - -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- - -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
+ " method="post"> + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
-
- -
- - - - - - - - - - - - - - - - -
+
+ +
+ + + + + + + + + + + + + + + +
-
-
- - dx->show ?? "true") == "true") { ?> - - dxcc->show ?? "true") == "true") { ?> - - state->show ?? "true") == "true") { ?> - - refs->show ?? "true") == "true") { ?> - - cqzone->show ?? "true") == "true") { ?> - - ituzone->show ?? "true") == "true") { ?> - - mode->show ?? "true") == "true") { ?> - - band->show ?? "true") == "true") { ?> - - iota->show ?? "true") == "true") { ?> - - refs->show ?? "true") == "true") { ?> - - refs->show ?? "true") == "true") { ?> - - refs->show ?? "true") == "true") { ?> - - operator->show ?? "true") == "true") { ?> - -
+
+
+
+ + dx->show ?? "true") == "true") { ?> + + dxcc->show ?? "true") == "true") { ?> + + state->show ?? "true") == "true") { ?> + + refs->show ?? "true") == "true") { ?> + + cqzone->show ?? "true") == "true") { ?> + + ituzone->show ?? "true") == "true") { ?> + + mode->show ?? "true") == "true") { ?> + + band->show ?? "true") == "true") { ?> + + iota->show ?? "true") == "true") { ?> + + refs->show ?? "true") == "true") { ?> + + refs->show ?? "true") == "true") { ?> + + refs->show ?? "true") == "true") { ?> + + operator->show ?? "true") == "true") { ?> +
-
-
- - - - - - - - - - - - -
- - - -
- - +
+
+
+ + + + + + + + + + + + +
+ + + +
+ +
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 332bb5a11..32fee112b 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -294,10 +294,10 @@ $(document).ready(function () { iota: this.iota.value, operator: this.operator.value, dxcc: this.dxcc.value, - propmode: this.selectPropagation.value, + propmode: this.propmode.value, gridsquare: this.gridsquare.value, state: this.state.value, - qsoresults: this.qsoResults.value, + qsoresults: this.qsoresults.value, sats: this.sats.value, orbits: this.orbits.value, cqzone: this.cqzone.value, @@ -306,7 +306,7 @@ $(document).ready(function () { lotwReceived: this.lotwReceived.value, eqslSent: this.eqslSent.value, eqslReceived: this.eqslReceived.value, - qslvia: $('[name="qslviainput"]').val(), + qslvia: $('[name="qslvia"]').val(), sota: this.sota.value, pota: this.pota.value, wwff: this.wwff.value, @@ -421,10 +421,7 @@ $(document).ready(function () { $('#exportAdif').click(function (event) { var elements = $('#qsoList tbody input:checked'); - var nElements = elements.length; - if (nElements == 0) { - return; - } + $('#exportAdif').prop("disabled", true); var id_list=[]; elements.each(function() { @@ -432,26 +429,39 @@ $(document).ready(function () { id_list.push(id); unselectQsoID(id); }); + xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = function() { - var a; - if (xhttp.readyState === 4 && xhttp.status === 200) { - // Trick for making downloadable link - a = document.createElement('a'); - a.href = window.URL.createObjectURL(xhttp.response); - // Give filename you wish to download - a.download = "logbook_export.adi"; - a.style.display = 'none'; - document.body.appendChild(a); - a.click(); - } - }; - // Post data to URL which handles post request - xhttp.open("POST", site_url+'/logbookadvanced/export_to_adif', true); - xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - // You should set responseType as blob for binary responses - xhttp.responseType = 'blob'; - xhttp.send("id=" + JSON.stringify(id_list, null, 2)+"&sortorder=" +$('.table').DataTable().order()); + xhttp.onreadystatechange = function() { + var a; + if (xhttp.readyState === 4 && xhttp.status === 200) { + // Trick for making downloadable link + a = document.createElement('a'); + a.href = window.URL.createObjectURL(xhttp.response); + // Give filename you wish to download + a.download = "logbook_export.adi"; + a.style.display = 'none'; + document.body.appendChild(a); + a.click(); + } + }; + + if (id_list.length > 0) { + // Post data to URL which handles post request + xhttp.open("POST", site_url+'/logbookadvanced/export_to_adif', true); + xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + // You should set responseType as blob for binary responses + xhttp.responseType = 'blob'; + xhttp.send("id=" + JSON.stringify(id_list, null, 2)+"&sortorder=" +$('.table').DataTable().order()); + } else { + + // Post data to URL which handles post request + xhttp.open("POST", site_url+'/logbookadvanced/export_to_adif_params', true); + xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + // You should set responseType as blob for binary responses + + xhttp.responseType = 'blob'; + xhttp.send($('#searchForm').serialize()); + } $('#exportAdif').prop("disabled", false); }); diff --git a/assets/js/sections/logbookadvanced_map.js b/assets/js/sections/logbookadvanced_map.js index 9623c6904..684516147 100644 --- a/assets/js/sections/logbookadvanced_map.js +++ b/assets/js/sections/logbookadvanced_map.js @@ -535,65 +535,65 @@ function mapQsos(form) { $("#lba_div").append('
'); } - if (id_list.length > 0) { - $.ajax({ - url: base_url + 'index.php/logbookadvanced/mapSelectedQsos', - type: 'post', - data: { - ids: id_list, - de: form.de.value - }, - success: function(data) { - loadMapOptions(data); - }, - error: function() { - $('#mapButton').prop("disabled", false).removeClass("running"); - }, - }); - } else { - $.ajax({ - url: base_url + 'index.php/logbookadvanced/mapQsos', - type: 'post', - data: { - dateFrom: form.dateFrom.value, - dateTo: form.dateTo.value, - de: form.de.value, - dx: form.dx.value, - mode: form.mode.value, - band: form.band.value, - qslSent: form.qslSent.value, - qslReceived: form.qslReceived.value, - qslSentMethod: this.qslSentMethod.value, - qslReceivedMethod: this.qslReceivedMethod.value, - iota: form.iota.value, - dxcc: form.dxcc.value, - propmode: form.selectPropagation.value, - gridsquare: form.gridsquare.value, - state: form.state.value, - qsoresults: form.qsoResults.value, - sats: form.sats.value, - orbits: form.orbits.value, - cqzone: form.cqzone.value, - lotwSent: form.lotwSent.value, - lotwReceived: form.lotwReceived.value, - eqslSent: form.eqslSent.value, - eqslReceived: form.eqslReceived.value, - qslvia: $('[name="qslviainput"]').val(), - sota: form.sota.value, - pota: form.pota.value, - operator: form.operator.value, - wwff: form.wwff.value, - qslimages: form.qslimages.value, - }, - success: function(data) { - loadMapOptions(data); - }, - error: function() { - $('#mapButton').prop("disabled", false).removeClass("running"); - }, - }); - } -}; + if (id_list.length > 0) { + $.ajax({ + url: base_url + 'index.php/logbookadvanced/mapSelectedQsos', + type: 'post', + data: { + ids: id_list, + de: form.de.value + }, + success: function(data) { + loadMapOptions(data); + }, + error: function() { + $('#mapButton').prop("disabled", false).removeClass("running"); + }, + }); + } else { + $.ajax({ + url: base_url + 'index.php/logbookadvanced/mapQsos', + type: 'post', + data: { + dateFrom: form.dateFrom.value, + dateTo: form.dateTo.value, + de: form.de.value, + dx: form.dx.value, + mode: form.mode.value, + band: form.band.value, + qslSent: form.qslSent.value, + qslReceived: form.qslReceived.value, + qslSentMethod: this.qslSentMethod.value, + qslReceivedMethod: this.qslReceivedMethod.value, + iota: form.iota.value, + dxcc: form.dxcc.value, + propmode: form.propmode.value, + gridsquare: form.gridsquare.value, + state: form.state.value, + qsoresults: form.qsoresults.value, + sats: form.sats.value, + orbits: form.orbits.value, + cqzone: form.cqzone.value, + lotwSent: form.lotwSent.value, + lotwReceived: form.lotwReceived.value, + eqslSent: form.eqslSent.value, + eqslReceived: form.eqslReceived.value, + qslvia: $('[name="qslvia"]').val(), + sota: form.sota.value, + pota: form.pota.value, + operator: form.operator.value, + wwff: form.wwff.value, + qslimages: form.qslimages.value, + }, + success: function(data) { + loadMapOptions(data); + }, + error: function() { + $('#mapButton').prop("disabled", false).removeClass("running"); + }, + }); + } + }; function mapGlobeQsos(form) { var container = L.DomUtil.get('advancedmap'); @@ -635,47 +635,47 @@ function mapGlobeQsos(form) { }, error: function() { - }, - }); - } else { - $.ajax({ - url: base_url + 'index.php/logbookadvanced/mapQsos', - type: 'post', - data: { - dateFrom: form.dateFrom.value, - dateTo: form.dateTo.value, - de: form.de.value, - dx: form.dx.value, - mode: form.mode.value, - band: form.band.value, - qslSent: form.qslSent.value, - qslReceived: form.qslReceived.value, - qslSentMethod: this.qslSentMethod.value, - qslReceivedMethod: this.qslReceivedMethod.value, - iota: form.iota.value, - dxcc: form.dxcc.value, - propmode: form.selectPropagation.value, - gridsquare: form.gridsquare.value, - state: form.state.value, - qsoresults: form.qsoResults.value, - sats: form.sats.value, - orbits: form.orbits.value, - cqzone: form.cqzone.value, - lotwSent: form.lotwSent.value, - lotwReceived: form.lotwReceived.value, - eqslSent: form.eqslSent.value, - eqslReceived: form.eqslReceived.value, - qslvia: $('[name="qslviainput"]').val(), - sota: form.sota.value, - pota: form.pota.value, - operator: form.operator.value, - wwff: form.wwff.value, - qslimages: form.qslimages.value, - }, - success: function(data) { - globemap(data); - }, - error: function() { + }, + }); + } else { + $.ajax({ + url: base_url + 'index.php/logbookadvanced/mapQsos', + type: 'post', + data: { + dateFrom: form.dateFrom.value, + dateTo: form.dateTo.value, + de: form.de.value, + dx: form.dx.value, + mode: form.mode.value, + band: form.band.value, + qslSent: form.qslSent.value, + qslReceived: form.qslReceived.value, + qslSentMethod: this.qslSentMethod.value, + qslReceivedMethod: this.qslReceivedMethod.value, + iota: form.iota.value, + dxcc: form.dxcc.value, + propmode: form.propmode.value, + gridsquare: form.gridsquare.value, + state: form.state.value, + qsoresults: form.qsoresults.value, + sats: form.sats.value, + orbits: form.orbits.value, + cqzone: form.cqzone.value, + lotwSent: form.lotwSent.value, + lotwReceived: form.lotwReceived.value, + eqslSent: form.eqslSent.value, + eqslReceived: form.eqslReceived.value, + qslvia: $('[name="qslvia"]').val(), + sota: form.sota.value, + pota: form.pota.value, + operator: form.operator.value, + wwff: form.wwff.value, + qslimages: form.qslimages.value, + }, + success: function(data) { + globemap(data); + }, + error: function() { }, });