Add SAT summary to table

This commit is contained in:
phl0
2025-07-03 15:48:59 +02:00
parent 2a413907e4
commit 66cf7aae26
5 changed files with 114 additions and 43 deletions

View File

@@ -74,6 +74,18 @@ class Lookup extends CI_Controller {
}
public function sat() {
$this->load->model('lookup_model');
$this->load->model('bands');
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$data['location_list'] = "'".implode("','",$logbooks_locations_array)."'";
$data['callsign'] = xss_clean($this->input->post('callsign'));
$data['sats'] = $this->bands->get_worked_sats();
$data['result'] = $this->lookup_model->getSatResult($data);
$this->load->view('lookup/satresult', $data);
}
public function scp() {
session_write_close();
$uppercase_callsign = strtoupper($this->input->post('callsign', TRUE) ?? '');

View File

@@ -583,6 +583,11 @@ class Logbook_model extends CI_Model {
}
}
break;
case 'SAT':
$this->db->where('COL_CALL', $searchphrase);
$this->db->where('COL_PROP_MODE', 'SAT');
$this->db->where('COL_SAT_NAME', $sat);
break;
case 'CQZone':
$this->db->where('COL_CQZ', $searchphrase);
break;

View File

@@ -2,6 +2,25 @@
class Lookup_model extends CI_Model{
function getSatResult($queryinfo){
foreach ($queryinfo['sats'] as $sat) {
$resultArray[$sat] = '-';
}
$sql = "SELECT DISTINCT(COL_SAT_NAME) FROM ".$this->config->item('table_name')." WHERE COL_PROP_MODE = 'SAT' AND COL_CALL = ?;";
$binds[] = $queryinfo['callsign'];
$query = $this->db->query($sql,$binds);
foreach ($query->result() as $workedsat) {
$resultArray[$workedsat->COL_SAT_NAME] = 'W';
}
$sql = "SELECT DISTINCT(COL_SAT_NAME) FROM ".$this->config->item('table_name')." WHERE COL_PROP_MODE = 'SAT' AND COL_CALL = ?";
$sql .= $this->buildConfirmationString('confirmed');
$query = $this->db->query($sql,$binds);
foreach ($query->result() as $confirmedsat) {
$resultArray[$confirmedsat->COL_SAT_NAME] = 'C';
}
return $resultArray;
}
function getSearchResult($queryinfo){
$modes = $this->get_worked_modes($queryinfo['location_list']);
@@ -107,41 +126,8 @@ class Lookup_model extends CI_Model{
$binds = [];
$sqlquerytypestring = '';
$sqlqueryconfirmationstring = $this->buildConfirmationString($confirmedtype);
if ($confirmedtype == 'confirmed') {
$user_default_confirmation = $this->session->userdata('user_default_confirmation');
$extrawhere='';
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) {
$extrawhere="COL_QSL_RCVD='Y'";
}
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'L') !== false) {
if ($extrawhere!='') {
$extrawhere.=" OR";
}
$extrawhere.=" COL_LOTW_QSL_RCVD='Y'";
}
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'E') !== false) {
if ($extrawhere!='') {
$extrawhere.=" OR";
}
$extrawhere.=" COL_EQSL_QSL_RCVD='Y'";
}
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Z') !== false) {
if ($extrawhere!='') {
$extrawhere.=" OR";
}
$extrawhere.=" COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y'";
}
if (($confirmedtype == 'confirmed') && ($extrawhere != '')){
$sqlqueryconfirmationstring = " and (".$extrawhere.")";
} else {
$sqlqueryconfirmationstring = ' and (1=0)';
}
} else {
$sqlqueryconfirmationstring = '';
}
// Fetching info for all modes and bands except satellite
$sql = "SELECT distinct col_band, lower(col_mode) as col_mode FROM " . $this->config->item('table_name') . " thcv";
@@ -199,6 +185,44 @@ class Lookup_model extends CI_Model{
return $query->result();
}
function buildConfirmationString ($confirmedtype) {
if ($confirmedtype == 'confirmed') {
$user_default_confirmation = $this->session->userdata('user_default_confirmation');
$extrawhere='';
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) {
$extrawhere="COL_QSL_RCVD='Y'";
}
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'L') !== false) {
if ($extrawhere!='') {
$extrawhere.=" OR";
}
$extrawhere.=" COL_LOTW_QSL_RCVD='Y'";
}
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'E') !== false) {
if ($extrawhere!='') {
$extrawhere.=" OR";
}
$extrawhere.=" COL_EQSL_QSL_RCVD='Y'";
}
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Z') !== false) {
if ($extrawhere!='') {
$extrawhere.=" OR";
}
$extrawhere.=" COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y'";
}
if (($confirmedtype == 'confirmed') && ($extrawhere != '')){
$sqlqueryconfirmationstring = " and (".$extrawhere.")";
} else {
$sqlqueryconfirmationstring = ' and (1=0)';
}
} else {
$sqlqueryconfirmationstring = '';
}
return $sqlqueryconfirmationstring;
}
/*
* Get's the worked modes from the log
*/

View File

@@ -1,20 +1,22 @@
<script type="text/javascript">
var lang_summary_dxcc = '<?= __("Showing summary for DXCC"); ?>';
var lang_summary_state = '<?= __("Showing summary for US State"); ?>';
var lang_summary_cq = '<?= __("Showing summary for CQ zone"); ?>';
var lang_summary_wwff = '<?= __("Showing summary for WWFF"); ?>';
var lang_summary_pota = '<?= __("Showing summary for POTA"); ?>';
var lang_summary_sota = '<?= __("Showing summary for SOTA"); ?>';
var lang_summary_iota = '<?= __("Showing summary for IOTA"); ?>';
var lang_summary_dxcc = '<?= __("Showing summary for DXCC"); ?>';
var lang_summary_state = '<?= __("Showing summary for US State"); ?>';
var lang_summary_cq = '<?= __("Showing summary for CQ zone"); ?>';
var lang_summary_wwff = '<?= __("Showing summary for WWFF"); ?>';
var lang_summary_pota = '<?= __("Showing summary for POTA"); ?>';
var lang_summary_sota = '<?= __("Showing summary for SOTA"); ?>';
var lang_summary_iota = '<?= __("Showing summary for IOTA"); ?>';
var lang_summary_dok = '<?= __("Showing summary for DOK"); ?>';
var lang_summary_continent = '<?= __("Showing summary for continent"); ?>';
var lang_summary_gridsquare = '<?= __("Showing summary for gridsquare"); ?>';
var lang_summary_sat = '<?= __("Showing summary for satellite QSOs with"); ?>';
var lang_summary_continent = '<?= __("Showing summary for continent"); ?>';
var lang_summary_gridsquare = '<?= __("Showing summary for gridsquare"); ?>';
var lang_summary_warning_empty_state = '<?= __("State input needs to be filled to show a summary!"); ?>';
var lang_summary_warning_empty_sota = '<?= __("SOTA input needs to be filled to show a summary!"); ?>';
var lang_summary_warning_empty_pota = '<?= __("POTA input needs to be filled to show a summary!"); ?>';
var lang_summary_warning_empty_iota = '<?= __("IOTA input needs to be filled to show a summary!"); ?>';
var lang_summary_warning_empty_dok = '<?= __("DOK input needs to be filled to show a summary!"); ?>';
var lang_summary_warning_empty_wwff = '<?= __("WWFF input needs to be filled to show a summary!"); ?>';
var lang_summary_warning_empty_sat = '<?= __("Propagation mode needs to be 'SAT' to show a summary!"); ?>';
var lang_summary_warning_empty_gridsquare = '<?= __("Gridsquare input needs to be filled to show a summary!"); ?>';
var lang_summary_info_only_first_pota = '<?= __("Summary only shows for the first POTA entered."); ?>';
var lang_summary_info_only_first_gridsquare = '<?= __("Summary only shows for the first gridsquare entered."); ?>';
@@ -62,6 +64,10 @@
<li class="nav-item">
<a class="nav-link" id="wwff-summary-tab" data-bs-toggle="tab" href="#wwff-summary" role="tab" aria-controls="wwff-summary" aria-selected="false"><?= __("WWFF"); ?> <i class="wwff-summary-reload fas fa-sync"></i></a>
</li>
<li class="nav-item">
<a class="nav-link" id="sat-summary-tab" data-bs-toggle="tab" href="#sat-summary" role="tab" aria-controls="sat-summary" aria-selected="false"><?= __("Satellite"); ?> <i class="sat-summary-reload fas fa-sync"></i></a>
</li>
</ul>
</div>
<div class="card-body">
@@ -76,6 +82,7 @@
<div class="tab-pane fade" id="pota-summary" role="tabpanel" aria-labelledby="pota-summary-tab"></div>
<div class="tab-pane fade" id="sota-summary" role="tabpanel" aria-labelledby="sota-summary-tab"></div>
<div class="tab-pane fade" id="wwff-summary" role="tabpanel" aria-labelledby="wwff-summary-tab"></div>
<div class="tab-pane fade" id="sat-summary" role="tabpanel" aria-labelledby="sat-summary-tab"></div>
</div>
</div>
</div>

View File

@@ -1330,6 +1330,26 @@ function getDokResult() {
});
}
// This function executes the call to the backend for fetching SAT summary and inserts table below qso entry
function getSatResult() {
$('#sat-summary').empty();
if ($('#selectPropagation').val() != 'SAT') {
$('#sat-summary').append(lang_summary_warning_empty_sat);
return;
}
$.ajax({
url: base_url + 'index.php/lookup/sat',
type: 'post',
data: {
callsign: $('#callsign').val().replace('Ø', '0'),
},
success: function (html) {
$('#sat-summary').append(lang_summary_sat + ' ' + $('#callsign').val().toUpperCase() + '.');
$('#sat-summary').append(html);
}
});
}
// This function executes the call to the backend for fetching iota summary and inserts table below qso entry
function getIotaResult() {
satOrBand = $('#band').val();
@@ -1591,6 +1611,9 @@ function loadAwardTabs(callback) {
$('.gridsquare-summary-reload').click(function (event) {
getGridsquareResult();
});
$('.sat-summary-reload').click(function (event) {
getSatResult();
});
}
});
}