[Search] Added tab to check for duplicate QSOs

这个提交包含在:
Andreas 2022-10-31 12:25:56 +01:00
父节点 7a81d98dd6
当前提交 349545fe48
共有 7 个文件被更改,包括 164 次插入0 次删除

查看文件

@ -698,7 +698,38 @@ class Logbook extends CI_Controller {
}
}
function search_duplicates($station_id) {
$station_id = $this->security->xss_clean($station_id);
$this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
$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;
}
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$sql = 'select count(*) as occurence, COL_CALL, COL_MODE, COL_SUBMODE, station_callsign, COL_SAT_NAME, COL_BAND, min(col_time_on) Mintime, max(col_time_on) Maxtime from ' . $this->config->item('table_name') .
' join station_profile on ' . $this->config->item('table_name') . '.station_id = station_profile.station_id where ' . $this->config->item('table_name') .'.station_id in ('. $location_list . ')';
if ($station_id != 'All') {
$sql .= ' and station_profile.station_id = ' . $station_id;
}
$sql .= ' group by col_call, col_mode, COL_SUBMODE, STATION_CALLSIGN, col_band, COL_SAT_NAME having count(*) > 1 and timediff(maxtime, mintime) < 3000';
$query = $this->db->query($sql);
$data['qsos'] = $query;
$this->load->view('search/duplicates_result.php', $data);
}
/*
* Provide a dxcc search, returning results json encoded

查看文件

@ -56,6 +56,18 @@ class Search extends CI_Controller {
}
}
// Searches for duplicate QSOs within 30m of time difference
public function duplicates() {
$this->load->model('stations');
$data['station_profile'] = $this->stations->all_of_user();
$data['page_title'] = "Duplicate QSOs within 30m time difference";
$this->load->view('interface_assets/header', $data);
$this->load->view('search/duplicates');
$this->load->view('interface_assets/footer');
}
function json_result() {
if(isset($_POST['search'])) {
$result = $this->fetchQueryResult($_POST['search'], false);

查看文件

@ -895,6 +895,29 @@ function getLookupResult() {
<script type="text/javascript">
i=0;
function findduplicates(){
event.preventDefault();
$('#partial_view').load(base_url+"index.php/logbook/search_duplicates/"+$("#station_id").val(), function() {
$('.qsolist').DataTable({
"pageLength": 25,
responsive: false,
ordering: false,
"scrollY": "500px",
"scrollCollapse": true,
"paging": false,
"scrollX": true,
dom: 'Bfrtip',
buttons: [
'csv'
]
});
// change color of csv-button if dark mode is chosen
if (isDarkModeTheme()) {
$(".buttons-csv").css("color", "white");
}
});
}
function searchButtonPress(){
event.preventDefault()
if ($('#callsign').val()) {

查看文件

@ -0,0 +1,43 @@
<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 active" href="<?php echo site_url('search/duplicates'); ?>">Duplicate QSOs</a>
</li>
</ul>
</div>
<div class="card-body">
<form method="post" action="" id="search_box" name="test">
<div class="form-group row">
<label for="callsign" class="col-sm-2 col-form-label">Station location:</label>
<select id="station_id" name="station_profile" class="custom-select col-sm-3 mb-3 mr-sm-3">
<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="findduplicates();" 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>

查看文件

@ -0,0 +1,49 @@
<?php
if ($qsos->result() != NULL) {
Echo 'The following QSOs were found on the same band, mode, date and time difference 30 minutes:';
echo '<table style="width:100%" class="qsolist table-sm table-bordered table-hover table-striped table-condensed">
<thead>
<tr>
<th style=\'text-align: center\'>Occurrence</th>
<th style=\'text-align: center\'>'.$this->lang->line('gen_hamradio_callsign').'</th>
<th style=\'text-align: center\'>Min date</th>
<th style=\'text-align: center\'>Min time</th>
<th style=\'text-align: center\'>Max date</th>
<th style=\'text-align: center\'>Max time</th>
<th style=\'text-align: center\'>' . $this->lang->line('gen_hamradio_mode') . '</th>
<th style=\'text-align: center\'>' . $this->lang->line('gen_hamradio_band') . '</th>
<th style=\'text-align: center\'>' . $this->lang->line('gen_hamradio_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/cloudlog.php
$custom_date_format = $this->config->item('qso_date_format');
}
foreach ($qsos->result() as $qso) {
echo '<tr>';
echo '<td style=\'text-align: center\'>' . $qso->occurence . '</td>';
echo '<td style=\'text-align: center\'><form id="searchcall" method="POST" action="'.site_url('search'). '"><input type="hidden" value="'. strtoupper($qso->COL_CALL) .'" name="callsign"><a href="javascript:$(\'#searchcall\').submit()">' . $qso->COL_CALL . '</a></form></td>';
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qso->Mintime); echo date($custom_date_format, $timestamp); echo '</td>';
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qso->Mintime); echo date('H:i', $timestamp); echo '</td>';
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qso->Maxtime); echo date($custom_date_format, $timestamp); echo '</td>';
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qso->Maxtime); echo date('H:i', $timestamp); echo '</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\'><span class="badge badge-light">' . $qso->station_callsign . '</span></td>';
echo '</tr>';
}
echo '</tbody></table>';
?>
<?php
} else {
echo '<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>No duplicate QSO\'s were found.</div>';
}
?>

查看文件

@ -21,6 +21,9 @@
</li>
<li class="nav-item">
<a class="nav-link active" 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/duplicates'); ?>">Duplicate QSOs</a>
</li>
</ul>
</div>

查看文件

@ -13,6 +13,9 @@
</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/duplicates'); ?>">Duplicate QSOs</a>
</li>
</ul>
</div>