From 90e9016ea7629dfc93de2f00cb5cd40454c26b26 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 20 May 2024 11:22:11 +0200 Subject: [PATCH] Added contest column --- application/controllers/Logbookadvanced.php | 1 + application/views/logbookadvanced/index.php | 11 ++++++++++- application/views/logbookadvanced/useroptions.php | 4 ++++ assets/js/sections/logbookadvanced.js | 7 +++++++ src/QSLManager/QSO.php | 6 +++++- 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index c7ea79796..dda72f4f5 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -509,6 +509,7 @@ class Logbookadvanced extends CI_Controller { $json_string['operator']['show'] = $this->input->post('operator'); $json_string['comment']['show'] = $this->input->post('comment'); $json_string['propagation']['show'] = $this->input->post('propagation'); + $json_string['contest']['show'] = $this->input->post('contest'); $obj['column_settings']= json_encode($json_string); diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 1814b89f7..f11b7f177 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -37,7 +37,8 @@ \"pota\":{\"show\":\"true\"}, \"operator\":{\"show\":\"true\"}, \"comment\":{\"show\":\"true\"}, - \"propagation\":{\"show\":\"true\"} + \"propagation\":{\"show\":\"true\"}, + \"contest\":{\"show\":\"true\"} }"; } $current_opts = json_decode($options); @@ -62,6 +63,11 @@ echo "\nvar o_template = { propagation: {show: 'true'}};"; echo "\nuser_options={...user_options, ...o_template};"; } + if (!isset($current_opts->contest)) { + echo "\nvar o_template = { contest: {show: 'true'}};"; + echo "\nuser_options={...user_options, ...o_template};"; + } + foreach ($mapoptions as $mo) { if ($mo != null) { @@ -542,6 +548,9 @@ $options = json_decode($options); } ?> propagation->show ?? "true") == "true") { echo '' . lang('filter_general_propagation') . ''; + } ?> + contest->show ?? "true") == "true") { + echo 'Contest'; } ?> diff --git a/application/views/logbookadvanced/useroptions.php b/application/views/logbookadvanced/useroptions.php index 8061f47f1..e2fe71528 100644 --- a/application/views/logbookadvanced/useroptions.php +++ b/application/views/logbookadvanced/useroptions.php @@ -118,6 +118,10 @@
propagation->show ?? "true") == "true") { echo 'checked'; } ?>>
+ + Contest +
contest->show ?? "true") == "true") { echo 'checked'; } ?>>
+ diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index aaa06dc51..170831da1 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -100,6 +100,9 @@ function updateRow(qso) { if ( (user_options.propagation) && (user_options.propagation.show == "true")){ cells.eq(c++).html(qso.propagation); } + if ( (user_options.contest) && (user_options.contest.show == "true")){ + cells.eq(c++).html(qso.contest); + } $('[data-bs-toggle="tooltip"]').tooltip(); return row; @@ -211,6 +214,9 @@ function loadQSOTable(rows) { if (user_options.propagation.show == "true"){ data.push(qso.propagation); } + if (user_options.contest.show == "true"){ + data.push(qso.contest); + } let createdRow = table.row.add(data).index(); table.rows(createdRow).nodes().to$().data('qsoID', qso.qsoID); @@ -915,6 +921,7 @@ function saveOptions() { operator: $('input[name="operator"]').is(':checked') ? true : false, comment: $('input[name="comment"]').is(':checked') ? true : false, propagation: $('input[name="propagation"]').is(':checked') ? true : false, + contest: $('input[name="contest"]').is(':checked') ? true : false, gridsquare_layer: $('input[name="gridsquareoverlay"]').is(':checked') ? true : false, path_lines: $('input[name="pathlines"]').is(':checked') ? true : false, cqzone_layer: $('input[name="cqzones"]').is(':checked') ? true : false, diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php index 68b8451ec..60e784e90 100644 --- a/src/QSLManager/QSO.php +++ b/src/QSLManager/QSO.php @@ -69,6 +69,7 @@ class QSO private string $lotw_hint; private string $operator; private string $comment; + private string $contest; /** Orbit type **/ private string $orbit; @@ -202,7 +203,7 @@ class QSO $this->cqzone = ($data['COL_CQZ'] === null) ? '' : $this->geCqLink($data['COL_CQZ']); $this->ituzone = $data['COL_ITUZ'] ?? ''; $this->state = ($data['COL_STATE'] === null) ? '' :$data['COL_STATE']; - $this->dxcc = (($data['name'] ?? null) === null) ? '- NONE -' : ''.ucwords(strtolower($data['name']), "- (/").''; + $this->dxcc = (($data['dxccname'] ?? null) === null) ? '- NONE -' : ''.ucwords(strtolower($data['dxccname']), "- (/").''; $this->iota = ($data['COL_IOTA'] === null) ? '' : $this->getIotaLink($data['COL_IOTA']); if (array_key_exists('end', $data)) { $this->end = ($data['end'] === null) ? null : DateTime::createFromFormat("Y-m-d", $data['end'], new DateTimeZone('UTC')); @@ -217,6 +218,8 @@ class QSO $this->comment = $data['COL_COMMENT'] ?? ''; $this->orbit = $data['orbit'] ?? ''; + + $this->contest = $data['contestname'] ?? ''; } /** @@ -841,6 +844,7 @@ class QSO 'comment' => $this->comment, 'orbit' => $this->orbit, 'propagation' => $this->getPropagationMode(), + 'contest' => $this->contest ]; }