[ITU Zones] Added a checker

This commit is contained in:
Andreas Kristiansen
2024-09-10 13:17:08 +02:00
parent b1ff0489dd
commit d3b10001d2
9 changed files with 193 additions and 2 deletions

View File

@@ -27,10 +27,10 @@ class Logbook extends CI_Controller {
$config['cur_tag_close'] = '</a></strong>';
$this->pagination->initialize($config);
//load the model and get results
$data['results'] = $this->logbook_model->get_qsos($config['per_page'],$this->uri->segment(3));
$data['user_map_custom'] = $this->optionslib->get_map_custom();
if(!$data['results']) {
@@ -1089,6 +1089,45 @@ class Logbook extends CI_Controller {
$this->load->view('search/cqzones_result.php', $data);
}
function search_incorrect_itu_zones($station_id) {
$clean_station_id = $this->security->xss_clean($station_id);
if (!is_numeric($clean_station_id) && $clean_station_id !== 'All') {
show_404();
}
$this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
}
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$sql = "select *, (select group_concat(distinct ituzone order by ituzone) from dxcc_master where countrycode = thcv.col_dxcc and ituzone <> '' order by ituzone asc) as correctituzone from " . $this->config->item('table_name') .
" thcv join station_profile on thcv.station_id = station_profile.station_id where thcv.station_id in (". $location_list . ")
and not exists (select 1 from dxcc_master where countrycode = thcv.col_dxcc and ituzone = col_ituz) and col_dxcc > 0
";
$params = [];
if ($clean_station_id != 'All') {
$sql .= ' and station_profile.station_id = ?';
$params[] = $clean_station_id;
}
$query = $this->db->query($sql, $params);
$data['qsos'] = $query;
$this->load->view('search/ituzones_result.php', $data);
}
/*
* Provide a dxcc search, returning results json encoded
*/

View File

@@ -62,6 +62,18 @@ class Search extends CI_Controller {
$this->load->view('interface_assets/footer');
}
// Searches for incorrect ITU Zones
public function incorrect_itu_zones() {
$this->load->model('stations');
$data['station_profile'] = $this->stations->all_of_user();
$data['page_title'] = __("Incorrectly logged ITU zones");
$this->load->view('interface_assets/header', $data);
$this->load->view('search/ituzones');
$this->load->view('interface_assets/footer');
}
// Searches for unconfirmed Lotw QSOs where QSO partner has uploaded to LoTW after the QSO date
public function lotw_unconfirmed() {
$this->load->model('stations');

View File

@@ -850,6 +850,32 @@ function findincorrectcqzones() {
});
}
function findincorrectituzones() {
event.preventDefault();
$('#partial_view').load(base_url+"index.php/logbook/search_incorrect_itu_zones/"+$("#station_id").val(), function() {
$('.qsolist').DataTable({
"pageLength": 25,
responsive: false,
ordering: false,
"scrollY": "500px",
"scrollCollapse": true,
"paging": false,
"scrollX": true,
"language": {
url: getDataTablesLanguageUrl(),
},
dom: 'Bfrtip',
buttons: [
'csv'
]
});
// change color of csv-button if dark mode is chosen
if (isDarkModeTheme()) {
$(".buttons-csv").css("color", "white");
}
});
}
function searchButtonPress() {
if (event) { event.preventDefault(); }
if ($('#callsign').val()) {

View File

@@ -16,6 +16,9 @@
</li>
<li class="nav-item">
<a class="nav-link active" href="<?php echo site_url('search/incorrect_cq_zones'); ?>"><?= __("Incorrect CQ Zones"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/incorrect_itu_zones'); ?>"><?= __("Incorrect ITU Zones"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/lotw_unconfirmed'); ?>"><?= __("QSOs unconfirmed on LoTW"); ?></a>

View File

@@ -24,6 +24,9 @@
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/incorrect_cq_zones'); ?>"><?= __("Incorrect CQ Zones"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/incorrect_itu_zones'); ?>"><?= __("Incorrect ITU Zones"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/lotw_unconfirmed'); ?>"><?= __("QSOs unconfirmed on LoTW"); ?></a>

View File

@@ -0,0 +1,49 @@
<div class="container search">
<h1>
<?= __("Search"); ?>
<small class="text-muted"><?= __("Ready to find a QSO?"); ?></small>
</h1>
<div class="card text-center">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search'); ?>"><?= __("Search"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/filter'); ?>"><?= __("Advanced Search"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/incorrect_cq_zones'); ?>"><?= __("Incorrect CQ Zones"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link active" href="<?php echo site_url('search/incorrect_itu_zones'); ?>"><?= __("Incorrect ITU Zones"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/lotw_unconfirmed'); ?>"><?= __("QSOs unconfirmed on LoTW"); ?></a>
</li>
</ul>
</div>
<div class="card-body">
<form method="post" action="" id="search_box" name="test">
<div class="mb-3 row">
<label for="callsign" class="col-sm-2 col-form-label"><?= __("Station location:"); ?></label>
<select id="station_id" name="station_profile" class="form-select col-sm-3 mb-3 me-sm-3 w-auto">
<option value="All"><?= __("All"); ?></option>
<?php foreach ($station_profile->result() as $station) { ?>
<option value="<?php echo $station->station_id; ?>"><?= __("Callsign"); ?>: <?php echo $station->station_callsign; ?> (<?php echo $station->station_profile_name; ?>)</option>
<?php } ?>
</select>
<div class="col-sm-2">
<button onclick="findincorrectituzones();" class="btn btn-outline-success my-2 my-sm-0" type="submit"><i class="fas fa-search"></i> <?= __("Search"); ?></button>
</div>
</div>
</form>
<div id="partial_view"></div>
</div>
</div>
</div>

View File

@@ -0,0 +1,53 @@
<?php
if ($qsos->result() != NULL) {
echo __("The following QSOs were found to have an incorrect CQ zone that this DXCC normally has:");
echo '<table style="width:100%" class="qsolist table table-sm table-bordered table-hover table-striped table-condensed">
<thead>
<tr>
<th style=\'text-align: center\'>' . __("Date") . '</th>
<th style=\'text-align: center\'>' . __("Time") . '</th>
<th style=\'text-align: center\'>' . __("Callsign") . '</th>
<th style=\'text-align: center\'>' . __("Mode") . '</th>
<th style=\'text-align: center\'>' . __("Band") . '</th>
<th style=\'text-align: center\'>' . __("Gridsquare") . '</th>
<th style=\'text-align: center\'>' . __("ITU Zone") . '</th>
<th style=\'text-align: center\'>' . __("DXCC ITU Zone") . '</th>
<th style=\'text-align: center\'>' . __("DXCC") . '</th>
<th style=\'text-align: center\'>' . __("Station") . '</th>
</tr>
</thead><tbody>';
// Get Date format
if($this->session->userdata('user_date_format')) {
// If Logged in and session exists
$custom_date_format = $this->session->userdata('user_date_format');
} else {
// Get Default date format from /config/wavelog.php
$custom_date_format = $this->config->item('qso_date_format');
}
$i = 0;
foreach ($qsos->result() as $qso) {
echo '<tr>';
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qso->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo '</td>';
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qso->COL_TIME_ON); echo date('H:i', $timestamp); echo '</td>';
echo '<td style=\'text-align: center\'><a id="edit_qso" href="javascript:displayQso(' . $qso->COL_PRIMARY_KEY . ')">' . str_replace("0","&Oslash;",strtoupper($qso->COL_CALL)) . '</a></td>';
echo '<td style=\'text-align: center\'>'; echo $qso->COL_SUBMODE==null?$qso->COL_MODE:$qso->COL_SUBMODE; echo '</td>';
echo '<td style=\'text-align: center\'>'; if($qso->COL_SAT_NAME != null) { echo $qso->COL_SAT_NAME; } else { echo strtolower($qso->COL_BAND); }; echo '</td>';
echo '<td style=\'text-align: center\'>'; echo strlen($qso->COL_GRIDSQUARE ?? '')==0?$qso->COL_VUCC_GRIDS:$qso->COL_GRIDSQUARE; echo '</td>';
echo '<td style=\'text-align: center\'>' . $qso->COL_ITUZ . '</td>';
echo '<td style=\'text-align: center\'>' . $qso->correctituzone . '</td>';
echo '<td style=\'text-align: center\'>' . ucwords(strtolower($qso->COL_COUNTRY), "- (/") . '</td>';
echo '<td style=\'text-align: center\'><span class="badge text-bg-light">' . $qso->station_callsign . '</span></td>';
echo '</tr>';
}
echo '</tbody></table>';
?>
<?php
} else {
echo '<div class="alert alert-success">' . __("No incorrect CQ Zones were found.") . '</div>';
}
?>

View File

@@ -16,6 +16,9 @@
</li>
<li class="nav-item">
<a class="nav-link " href="<?php echo site_url('search/incorrect_cq_zones'); ?>"><?= __("Incorrect CQ Zones"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/incorrect_itu_zones'); ?>"><?= __("Incorrect ITU Zones"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link active" href="<?php echo site_url('search/lotw_unconfirmed'); ?>"><?= __("QSOs unconfirmed on LoTW"); ?></a>

View File

@@ -16,6 +16,9 @@
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/incorrect_cq_zones'); ?>"><?= __("Incorrect CQ Zones"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/incorrect_itu_zones'); ?>"><?= __("Incorrect ITU Zones"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('search/lotw_unconfirmed'); ?>"><?= __("QSOs unconfirmed on LoTW"); ?></a>