From 6fc021f14c34ef57df7dbed5d372dbc0db045d1d Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Fri, 7 Jul 2023 10:03:52 +0200
Subject: [PATCH] [Advanced Logbook] Added SOTA, POTA, WWFF searches and refs
---
application/controllers/Logbookadvanced.php | 16 ++-
application/models/Logbookadvanced_model.php | 34 ++++-
application/views/logbookadvanced/index.php | 32 ++++-
assets/js/sections/logbookadvanced.js | 29 +++-
src/QSLManager/QSO.php | 140 +++++++++++--------
5 files changed, 174 insertions(+), 77 deletions(-)
diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php
index 1bb0432c3..384889f3c 100644
--- a/application/controllers/Logbookadvanced.php
+++ b/application/controllers/Logbookadvanced.php
@@ -1,4 +1,4 @@
-logbook_model->fetchDxcc();
$pageData['iotaarray'] = $this->logbook_model->fetchIota();
$pageData['sats'] = $this->bands->get_worked_sats();
-
+
$pageData['bands'] = $this->bands->get_worked_bands();
- $CI =& get_instance();
+ $CI =& get_instance();
// Get Date format
if($CI->session->userdata('user_date_format')) {
// If Logged in and session exists
@@ -111,6 +111,10 @@ class Logbookadvanced extends CI_Controller {
'lotwReceived' => xss_clean($this->input->post('lotwReceived')),
'eqslSent' => xss_clean($this->input->post('eqslSent')),
'eqslReceived' => xss_clean($this->input->post('eqslReceived')),
+ 'qslvia' => xss_clean($this->input->post('qslvia')),
+ 'sota' => xss_clean($this->input->post('sota')),
+ 'pota' => xss_clean($this->input->post('pota')),
+ 'wwff' => xss_clean($this->input->post('wwff')),
);
$qsos = [];
@@ -175,7 +179,7 @@ class Logbookadvanced extends CI_Controller {
$data = $this->logbookadvanced_model->getQsosForAdif($ids, $user_id);
$results = $data->result('array');
-
+
$qsos = [];
foreach ($results as $data) {
$qsos[] = new QSO($data);
@@ -203,7 +207,7 @@ class Logbookadvanced extends CI_Controller {
$data = $this->logbookadvanced_model->getQsosForAdif($ids, $user_id);
$results = $data->result('array');
-
+
$qsos = [];
foreach ($results as $data) {
$qsos[] = new QSO($data);
@@ -217,4 +221,4 @@ class Logbookadvanced extends CI_Controller {
header("Content-Type: application/json");
print json_encode($q);
}
-}
\ No newline at end of file
+}
diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php
index 8fb7f61db..c6cfe6d4d 100644
--- a/application/models/Logbookadvanced_model.php
+++ b/application/models/Logbookadvanced_model.php
@@ -94,6 +94,26 @@ class Logbookadvanced_model extends CI_Model {
$binding[] = $searchCriteria['cqzone'];
}
+ if ($searchCriteria['qslvia'] !== '') {
+ $conditions[] = "COL_QSL_VIA like ?";
+ $binding[] = $searchCriteria['qslvia'].'%';
+ }
+
+ if ($searchCriteria['sota'] !== '') {
+ $conditions[] = "COL_SOTA_REF like ?";
+ $binding[] = $searchCriteria['sota'].'%';
+ }
+
+ if ($searchCriteria['pota'] !== '') {
+ $conditions[] = "COL_POTA_REF like ?";
+ $binding[] = $searchCriteria['pota'].'%';
+ }
+
+ if ($searchCriteria['wwff'] !== '') {
+ $conditions[] = "COL_WWFF_REF like ?";
+ $binding[] = $searchCriteria['wwff'].'%';
+ }
+
if ($searchCriteria['gridsquare'] !== '') {
$conditions[] = "(COL_GRIDSQUARE like ? or COL_VUCC_GRIDS like ?)";
$binding[] = '%' . $searchCriteria['gridsquare'] . '%';
@@ -138,12 +158,12 @@ class Logbookadvanced_model extends CI_Model {
$data = $this->db->query($sql, $binding);
$results = $data->result('array');
-
+
$qsos = [];
foreach ($results as $data) {
$qsos[] = new QSO($data);
}
-
+
return $qsos;
}
@@ -245,7 +265,7 @@ class Logbookadvanced_model extends CI_Model {
);
$this->db->where_in('COL_PRIMARY_KEY', json_decode($ids, true));
$this->db->update($this->config->item('table_name'), $data);
-
+
return array('message' => 'OK');
}
}
@@ -263,7 +283,7 @@ class Logbookadvanced_model extends CI_Model {
);
$this->db->where_in('COL_PRIMARY_KEY', json_decode($ids, true));
$this->db->update($this->config->item('table_name'), $data);
-
+
return array('message' => 'OK');
}
}
@@ -315,19 +335,19 @@ class Logbookadvanced_model extends CI_Model {
$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;
}
$modes = array();
-
+
$this->db->select('distinct col_mode, coalesce(col_submode, "") col_submode', FALSE);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->order_by('col_mode, col_submode', 'ASC');
$query = $this->db->get($this->config->item('table_name'));
-
+
foreach($query->result() as $mode){
if ($mode->col_submode == null || $mode->col_submode == "") {
array_push($modes, $mode->col_mode);
diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php
index 894e24831..13528f306 100644
--- a/application/views/logbookadvanced/index.php
+++ b/application/views/logbookadvanced/index.php
@@ -55,7 +55,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
+
With selected :
@@ -257,6 +280,9 @@
+
+
+
@@ -309,4 +335,4 @@
-
\ No newline at end of file
+
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js
index 308821998..5a639c5bd 100644
--- a/assets/js/sections/logbookadvanced.js
+++ b/assets/js/sections/logbookadvanced.js
@@ -73,7 +73,7 @@ function loadQSOTable(rows) {
var table = $('#qsoList').DataTable();
table.clear();
-
+
for (i = 0; i < rows.length; i++) {
let qso = rows[i];
@@ -102,7 +102,7 @@ function loadQSOTable(rows) {
data.push(qso.state);
data.push(qso.cqzone);
data.push(qso.iota);
-
+
let createdRow = table.row.add(data).index();
table.rows(createdRow).nodes().to$().data('qsoID', qso.qsoID);
table.row(createdRow).node().id = 'qsoID-' + qso.qsoID;
@@ -193,6 +193,10 @@ $(document).ready(function () {
lotwReceived: this.lotwReceived.value,
eqslSent: this.eqslSent.value,
eqslReceived: this.eqslReceived.value,
+ qslvia: $('[name="qslviainput"]').val(),
+ sota: this.sota.value,
+ pota: this.pota.value,
+ wwff: this.wwff.value,
},
dataType: 'json',
success: function (data) {
@@ -392,6 +396,18 @@ $(document).ready(function () {
quickSearch('band');
});
+ $('#searchSota').click(function (event) {
+ quickSearch('sota');
+ });
+
+ $('#searchWwff').click(function (event) {
+ quickSearch('wwff');
+ });
+
+ $('#searchPota').click(function (event) {
+ quickSearch('pota');
+ });
+
function quickSearch(type) {
var elements = $('#qsoList tbody input:checked');
var nElements = elements.length;
@@ -419,7 +435,7 @@ $(document).ready(function () {
}
elements.each(function() {
var currentRow = $(this).first().closest('tr');
- var col1 = '';
+ var col1 = '';
switch (type) {
case 'dxcc': var tdoffset = (offset + 16); col1 = currentRow.find("td:eq("+tdoffset+")").html(); col1 = col1.match(/\d/g); col1 = col1.join(""); break;
case 'cqzone': var tdoffset = (offset + 18); col1 = currentRow.find("td:eq("+tdoffset+")").text(); break;
@@ -427,6 +443,9 @@ $(document).ready(function () {
case 'state': var tdoffset = (offset + 17); col1 = currentRow.find("td:eq("+tdoffset+")").text(); break;
case 'dx': col1 = currentRow.find("td:eq(3)").text(); col1 = col1.match(/^([^\s]+)/gm); break;
case 'gridsquare': col1 = $(currentRow).find('#dxgrid').text(); col1 = col1.substring(0, 4); break;
+ case 'sota': col1 = $(currentRow).find('#dxsota').text(); break;
+ case 'wwff': col1 = $(currentRow).find('#dxwwff').text(); break;
+ case 'pota': col1 = $(currentRow).find('#dxpota').text(); break;
case 'mode': col1 = currentRow.find("td:eq(4)").text(); break;
case 'band': col1 = currentRow.find("td:eq(7)").text(); col1 = col1.match(/\S\w*/); break;
}
@@ -462,10 +481,10 @@ $(document).ready(function () {
return xhr;
},
success: function(data) {
- if(data){
+ if(data){
var file = new Blob([data], {type: 'application/pdf'});
var fileURL = URL.createObjectURL(file);
- window.open(fileURL);
+ window.open(fileURL);
}
$.each(id_list, function(k, v) {
unselectQsoID(this);
diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php
index a86524610..3b00aa065 100644
--- a/src/QSLManager/QSO.php
+++ b/src/QSLManager/QSO.php
@@ -45,6 +45,8 @@ class QSO
private string $dxSigInfo;
private string $dxDARCDOK;
private string $dxSOTAReference;
+ private string $dxPOTAReference;
+ private string $dxWWFFReference;
/** @var string[] */
private string $dxVUCCGridsquares;
private string $QSLMsg;
@@ -107,6 +109,8 @@ class QSO
'COL_MY_SOTA_REF',
'COL_MY_VUCC_GRIDS',
'COL_SOTA_REF',
+ 'COL_POTA_REF',
+ 'COL_WWFF_REF',
'COL_SUBMODE',
'COL_VUCC_GRIDS',
'COL_CQZ',
@@ -125,7 +129,7 @@ class QSO
$this->qsoID = $data['COL_PRIMARY_KEY'];
- $CI =& get_instance();
+ $CI =& get_instance();
// Get Date format
if($CI->session->userdata('user_date_format')) {
// If Logged in and session exists
@@ -134,7 +138,7 @@ class QSO
// Get Default date format from /config/cloudlog.php
$custom_date_format = $CI->config->item('qso_date_format');
}
- $this->qsoDateTime = date($custom_date_format . " H:i", strtotime($data['COL_TIME_ON']));
+ $this->qsoDateTime = date($custom_date_format . " H:i", strtotime($data['COL_TIME_ON']));
$this->de = $data['COL_STATION_CALLSIGN'];
$this->dx = $data['COL_CALL'];
@@ -171,6 +175,8 @@ class QSO
$this->dxDARCDOK = $data['COL_DARC_DOK'] ?? '';
$this->dxSOTAReference = $data['COL_SOTA_REF'] ?? '';
+ $this->dxPOTAReference = $data['COL_POTA_REF'] ?? '';
+ $this->dxWWFFReference = $data['COL_WWFF_REF'] ?? '';
$this->dxVUCCGridsquares = $data['COL_VUCC_GRIDS'] ?? '';
@@ -183,11 +189,11 @@ class QSO
$this->QSLSent = ($data['COL_QSL_SENT'] === null) ? '' : $data['COL_QSL_SENT'];
$this->QSLSentVia = ($data['COL_QSL_SENT_VIA'] === null) ? '' : $data['COL_QSL_SENT_VIA'];
$this->QSLVia = ($data['COL_QSL_VIA'] === null) ? '' : $data['COL_QSL_VIA'];
-
+
$this->qsl = $this->getQslString($data, $custom_date_format);
$this->lotw = $this->getLotwString($data, $custom_date_format);
$this->eqsl = $this->getEqslString($data, $custom_date_format);
-
+
$this->cqzone = ($data['COL_CQZ'] === null) ? '' : ''.$data['COL_CQZ'].'';
$this->state = ($data['COL_STATE'] === null) ? '' :$data['COL_STATE'];
$this->dxcc = ($data['name'] === null) ? '- NONE -' : ''.ucwords(strtolower($data['name']), "- (/").'';
@@ -227,7 +233,7 @@ class QSO
*/
function getQSLString($data, $custom_date_format): string
{
- $CI =& get_instance();
+ $CI =& get_instance();
$qslstring = 'lang->line('general_word_qslcard_electronic').")";
break;
}
- }
+ }
$qslstring .= '">▲lang->line('general_word_qslcard_electronic').")";
break;
}
- }
+ }
$qslstring .= '">▼';
if ($data['qslcount'] != null) {
$qslstring .= ' ';
}
return $qslstring;
}
-
+
/**
* @return string
*/
function getLotwString($data, $custom_date_format): string
{
- $CI =& get_instance();
+ $CI =& get_instance();
$lotwstring = 'lang->line('lotw_short')." ".$CI->lang->line('general_word_sent');
- if ($data['COL_LOTW_QSLSDATE'] != null) {
- $timestamp = strtotime($data['COL_LOTW_QSLSDATE']);
- $lotwstring .= " ". ($timestamp != '' ? date($custom_date_format, $timestamp) : '');
- }
- $lotwstring .= "\" data-toggle=\"tooltip\"";
- }
+ if ($data['COL_LOTW_QSL_SENT'] == "Y") {
+ $lotwstring .= "data-original-title=\"" . $CI->lang->line('lotw_short')." ".$CI->lang->line('general_word_sent');
+ if ($data['COL_LOTW_QSLSDATE'] != null) {
+ $timestamp = strtotime($data['COL_LOTW_QSLSDATE']);
+ $lotwstring .= " ". ($timestamp != '' ? date($custom_date_format, $timestamp) : '');
+ }
+ $lotwstring .= "\" data-toggle=\"tooltip\"";
+ }
$lotwstring .= ' class="lotw-' . (($data['COL_LOTW_QSL_SENT']=='Y') ? 'green' : 'red') . '">▲';
$lotwstring .= 'lang->line('lotw_short') ." ". $CI->lang->line('general_word_received');
-
- if ($data['COL_LOTW_QSLRDATE'] != null) {
- $timestamp = strtotime($data['COL_LOTW_QSLRDATE']);
- $lotwstring .= " ". ($timestamp != '' ? date($custom_date_format, $timestamp) : '');
- }
-
- $lotwstring .= "\" data-toggle=\"tooltip\"";
- }
+ if ($data['COL_LOTW_QSL_RCVD'] == "Y") {
+ $lotwstring .= "data-original-title=\"". $CI->lang->line('lotw_short') ." ". $CI->lang->line('general_word_received');
+
+ if ($data['COL_LOTW_QSLRDATE'] != null) {
+ $timestamp = strtotime($data['COL_LOTW_QSLRDATE']);
+ $lotwstring .= " ". ($timestamp != '' ? date($custom_date_format, $timestamp) : '');
+ }
+
+ $lotwstring .= "\" data-toggle=\"tooltip\"";
+ }
$lotwstring .= ' class="lotw-' . (($data['COL_LOTW_QSL_RCVD']=='Y') ? 'green':'red') . '">▼';
@@ -365,32 +371,32 @@ class QSO
*/
function getEqslString($data, $custom_date_format): string
{
- $CI =& get_instance();
+ $CI =& get_instance();
$eqslstring = 'lang->line('eqsl_short')." ".$CI->lang->line('general_word_sent');
-
- if ($data['COL_EQSL_QSLSDATE'] != null) {
- $timestamp = strtotime($data['COL_EQSL_QSLSDATE']);
- $eqslstring .= " ".($timestamp!=''?date($custom_date_format, $timestamp):'');
- }
-
- $eqslstring .= "\" data-toggle=\"tooltip\"";
- }
-
+ if ($data['COL_EQSL_QSL_SENT'] == "Y") {
+ $eqslstring .= "data-original-title=\"".$CI->lang->line('eqsl_short')." ".$CI->lang->line('general_word_sent');
+
+ if ($data['COL_EQSL_QSLSDATE'] != null) {
+ $timestamp = strtotime($data['COL_EQSL_QSLSDATE']);
+ $eqslstring .= " ".($timestamp!=''?date($custom_date_format, $timestamp):'');
+ }
+
+ $eqslstring .= "\" data-toggle=\"tooltip\"";
+ }
+
$eqslstring .= ' class="eqsl-' . (($data['COL_EQSL_QSL_SENT'] =='Y') ? 'green':'red') . '">▲lang->line('eqsl_short')." ".$CI->lang->line('general_word_received');
-
- if ($data['COL_EQSL_QSLRDATE'] != null) {
- $timestamp = strtotime($data['COL_EQSL_QSLRDATE']);
- $eqslstring .= " ".($timestamp!=''?date($custom_date_format, $timestamp):'');
- }
- $eqslstring .= "\" data-toggle=\"tooltip\"";
- }
+ if ($data['COL_EQSL_QSL_RCVD'] == "Y") {
+ $eqslstring .= "data-original-title=\"".$CI->lang->line('eqsl_short')." ".$CI->lang->line('general_word_received');
+
+ if ($data['COL_EQSL_QSLRDATE'] != null) {
+ $timestamp = strtotime($data['COL_EQSL_QSLRDATE']);
+ $eqslstring .= " ".($timestamp!=''?date($custom_date_format, $timestamp):'');
+ }
+ $eqslstring .= "\" data-toggle=\"tooltip\"";
+ }
$eqslstring .= ' class="eqsl-' . (($data['COL_EQSL_QSL_RCVD'] =='Y')?'green':'red') . '">';
@@ -637,6 +643,22 @@ class QSO
return $this->dxSOTAReference;
}
+ /**
+ * @return string
+ */
+ public function getDxPOTAReference(): string
+ {
+ return $this->dxPOTAReference;
+ }
+
+ /**
+ * @return string
+ */
+ public function getWWFFReference(): string
+ {
+ return $this->dxWWFFReference;
+ }
+
/**
* @return string[]
*/
@@ -846,7 +868,13 @@ class QSO
$refs[] = '' . $this->dxGridsquare . ' ' .$this->getQrbLink($this->stationGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare);
}
if ($this->dxSOTAReference !== '') {
- $refs[] = "SOTA:" . $this->dxSOTAReference;
+ $refs[] = "SOTA: " . '' . $this->dxSOTAReference. '';
+ }
+ if ($this->dxPOTAReference !== '') {
+ $refs[] = "POTA: " . '' . $this->dxPOTAReference. '';
+ }
+ if ($this->dxWWFFReference !== '') {
+ $refs[] = "WWFF: " . '' . $this->dxWWFFReference. '';
}
if ($this->dxSig !== '') {
$refs[] = $this->dxSig . ":" . $this->dxSigInfo;