Added "All" to Bandchooser at List

这个提交包含在:
int2001 2023-07-26 08:22:53 +00:00
父节点 4717ca2252
当前提交 e1003e07d7
找不到此签名对应的密钥
GPG 密钥 ID: DFB1C13CD2DB037B
共有 3 个文件被更改,包括 99 次插入74 次删除

查看文件

@ -3,78 +3,82 @@
use Cloudlog\Dxcc\Dxcc; use Cloudlog\Dxcc\Dxcc;
class Dxcluster_model extends CI_Model { class Dxcluster_model extends CI_Model {
public function dxc_spotlist($band = '20m', $maxage = 60, $de = '') { public function dxc_spotlist($band = '20m', $maxage = 60, $de = '') {
$this->load->helper(array('psr4_autoloader')); $this->load->helper(array('psr4_autoloader'));
$CI =& get_instance(); $CI =& get_instance();
if ( ($this->optionslib->get_option('dxcache_url') != '') ) { if ( ($this->optionslib->get_option('dxcache_url') != '') ) {
if($CI->session->userdata('user_date_format')) { if($CI->session->userdata('user_date_format')) {
$custom_date_format = $CI->session->userdata('user_date_format'); $custom_date_format = $CI->session->userdata('user_date_format');
} else { } else {
$custom_date_format = $CI->config->item('qso_date_format'); $custom_date_format = $CI->config->item('qso_date_format');
} }
$dxcache_url = $this->optionslib->get_option('dxcache_url').'/spots/'.$band; if ($band == "All") {
$CI->load->model('logbooks_model'); $dxcache_url = $this->optionslib->get_option('dxcache_url').'/spots/';
} else {
$dxcache_url = $this->optionslib->get_option('dxcache_url').'/spots/'.$band;
}
$CI->load->model('logbooks_model');
$CI->load->model('logbook_model'); $CI->load->model('logbook_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
// CURL Functions // CURL Functions
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $dxcache_url); curl_setopt($ch, CURLOPT_URL, $dxcache_url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Cloudlog DXLookup'); curl_setopt($ch, CURLOPT_USERAGENT, 'Cloudlog DXLookup');
curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$jsonraw = curl_exec($ch); $jsonraw = curl_exec($ch);
curl_close($ch); curl_close($ch);
$json = json_decode($jsonraw); $json = json_decode($jsonraw);
$date = date('Ymd', time()); $date = date('Ymd', time());
$dxccObj = new DXCC($date); $dxccObj = new DXCC($date);
// Create JSON object // Create JSON object
if (strlen($jsonraw)>20) { if (strlen($jsonraw)>20) {
$spotsout=[]; $spotsout=[];
foreach($json as $singlespot){ foreach($json as $singlespot){
$spotband = $CI->frequency->GetBand($singlespot->frequency*1000); $spotband = $CI->frequency->GetBand($singlespot->frequency*1000);
$singlespot->band=$spotband; $singlespot->band=$spotband;
if ($band != $spotband) { continue; } if (($band != 'All') && ($band != $spotband)) { continue; }
$datetimecurrent = new DateTime("now", new DateTimeZone('UTC')); // Today's Date/Time $datetimecurrent = new DateTime("now", new DateTimeZone('UTC')); // Today's Date/Time
$datetimespot = new DateTime($singlespot->when, new DateTimeZone('UTC')); $datetimespot = new DateTime($singlespot->when, new DateTimeZone('UTC'));
$spotage = $datetimecurrent->diff($datetimespot); $spotage = $datetimecurrent->diff($datetimespot);
$minutes = $spotage->days * 24 * 60; $minutes = $spotage->days * 24 * 60;
$minutes += $spotage->h * 60; $minutes += $spotage->h * 60;
$minutes += $spotage->i; $minutes += $spotage->i;
$singlespot->age=$minutes; $singlespot->age=$minutes;
$singlespot->when_pretty=date($custom_date_format . " H:i", strtotime($singlespot->when)); $singlespot->when_pretty=date($custom_date_format . " H:i", strtotime($singlespot->when));
if ($minutes<=$maxage) { if ($minutes<=$maxage) {
if (!(property_exists($singlespot,'dxcc_spotted'))) { // Check if we already have dxcc of spotted if (!(property_exists($singlespot,'dxcc_spotted'))) { // Check if we already have dxcc of spotted
$dxcc=$dxccObj->dxcc_lookup($singlespot->spotted,date('Ymd', time())); $dxcc=$dxccObj->dxcc_lookup($singlespot->spotted,date('Ymd', time()));
$singlespot->dxcc_spotted=$dxcc; $singlespot->dxcc_spotted=$dxcc;
} }
if (!(property_exists($singlespot,'dxcc_spotter'))) { // Check if we already have dxcc of spotter if (!(property_exists($singlespot,'dxcc_spotter'))) { // Check if we already have dxcc of spotter
$dxcc=$dxccObj->dxcc_lookup($singlespot->spotter,date('Ymd', time())); $dxcc=$dxccObj->dxcc_lookup($singlespot->spotter,date('Ymd', time()));
$singlespot->dxcc_spotter=$dxcc; $singlespot->dxcc_spotter=$dxcc;
} }
if ( ($de != '') && ($de != 'Any') && (property_exists($singlespot->dxcc_spotter,'cont')) ){ // If we have a "de continent" and a filter-wish filter on that if ( ($de != '') && ($de != 'Any') && (property_exists($singlespot->dxcc_spotter,'cont')) ){ // If we have a "de continent" and a filter-wish filter on that
if (strtolower($de) == strtolower($singlespot->dxcc_spotter->cont)) { if (strtolower($de) == strtolower($singlespot->dxcc_spotter->cont)) {
$singlespot->worked_call = ($this->logbook_model->check_if_callsign_worked_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) == 1); $singlespot->worked_call = ($this->logbook_model->check_if_callsign_worked_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) == 1);
array_push($spotsout,$singlespot); array_push($spotsout,$singlespot);
} }
} else { // No de continent? No Filter --> Just push } else { // No de continent? No Filter --> Just push
$singlespot->worked_call = ($this->logbook_model->check_if_callsign_worked_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) == 1); $singlespot->worked_call = ($this->logbook_model->check_if_callsign_worked_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) == 1);
array_push($spotsout,$singlespot); array_push($spotsout,$singlespot);
} }
} }
} }
return ($spotsout); return ($spotsout);
} else { } else {
return ''; return '';
} }
} else { } else {
return ''; return '';
} }
} }
public function dxc_qrg_lookup($qrg, $maxage = 120) { public function dxc_qrg_lookup($qrg, $maxage = 120) {
$this->load->helper(array('psr4_autoloader')); $this->load->helper(array('psr4_autoloader'));

查看文件

@ -6,6 +6,9 @@
</script> </script>
<style> <style>
.kHz::after {
content: " kHz";
}
.fresh{ .fresh{
-webkit-transition: all 15s ease; -webkit-transition: all 15s ease;
-moz-transition: all 15s ease; -moz-transition: all 15s ease;
@ -56,6 +59,7 @@
<label class="my-1 mr-2" for="band"><?php echo lang('gen_hamradio_band'); ?></label> <label class="my-1 mr-2" for="band"><?php echo lang('gen_hamradio_band'); ?></label>
<select id="band" class="form-control-sm my-1 mr-sm-2" name="band"> <select id="band" class="form-control-sm my-1 mr-sm-2" name="band">
<option value="All">All</option>
<?php foreach($bands as $key=>$bandgroup) { <?php foreach($bands as $key=>$bandgroup) {
echo '<optgroup label="' . strtoupper($key) . '">'; echo '<optgroup label="' . strtoupper($key) . '">';
foreach($bandgroup as $band) { foreach($bandgroup as $band) {

查看文件

@ -6,9 +6,24 @@ $(function() {
return ((a< b) ? -1 : ((a> b) ? 1 : 0)); return ((a< b) ? -1 : ((a> b) ? 1 : 0));
} }
function get_dtable () {
var table = $('.spottable').DataTable({
"retrieve":true,
'columnDefs': [
{
'targets': 1, "type":"num",
'createdCell': function (td, cellData, rowData, row, col) {
$(td).addClass("kHz");
}
}
]
});
return table;
}
function fill_list(band,de,maxAgeMinutes) { function fill_list(band,de,maxAgeMinutes) {
var table = $('.spottable').DataTable(); // var table = $('.spottable').DataTable();
var table = get_dtable();
if ((band != '') && (band !== undefined)) { if ((band != '') && (band !== undefined)) {
let dxurl = dxcluster_provider + "/spots/" + band + "/" +maxAgeMinutes + "/" + de; let dxurl = dxcluster_provider + "/spots/" + band + "/" +maxAgeMinutes + "/" + de;
$.ajax({ $.ajax({
@ -25,7 +40,7 @@ $(function() {
var data=[]; var data=[];
data[0]=[]; data[0]=[];
data[0].push(single.when_pretty); data[0].push(single.when_pretty);
data[0].push(single.frequency + " kHz"); data[0].push(single.frequency*1);
data[0].push((single.worked_call ?'<span class="text-success">' : '')+single.spotted+(single.worked_call ? '</span>' : '')); data[0].push((single.worked_call ?'<span class="text-success">' : '')+single.spotted+(single.worked_call ? '</span>' : ''));
data[0].push(single.dxcc_spotted.entity); data[0].push(single.dxcc_spotted.entity);
data[0].push(single.spotter); data[0].push(single.spotter);
@ -57,7 +72,8 @@ $(function() {
} }
function highlight_current_qrg(qrg) { function highlight_current_qrg(qrg) {
var table=$('.spottable').DataTable(); var table=get_dtable();
// var table=$('.spottable').DataTable();
table.rows().every(function() { table.rows().every(function() {
var d=this.data(); var d=this.data();
var distance=Math.abs(parseInt(d[1].substring(0,d[1].length-4))-qrg); var distance=Math.abs(parseInt(d[1].substring(0,d[1].length-4))-qrg);
@ -71,27 +87,28 @@ $(function() {
}); });
} }
$('.spottable').DataTable().order([1, 'asc']); var table=get_dtable();
$('.spottable').DataTable().clear(); table.order([1, 'asc']);
table.clear();
fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(),dxcluster_maxage); fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(),dxcluster_maxage);
setInterval(function () { fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(),dxcluster_maxage); },60000); setInterval(function () { fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(),dxcluster_maxage); },60000);
$("#decontSelect").on("change",function() { $("#decontSelect").on("change",function() {
$('.spottable').DataTable().clear(); table.clear();
fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(),dxcluster_maxage); fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(),dxcluster_maxage);
}); });
$("#band").on("change",function() { $("#band").on("change",function() {
$('.spottable').DataTable().order([1, 'asc']); table.order([1, 'asc']);
$('.spottable').DataTable().clear(); table.clear();
fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(),dxcluster_maxage); fill_list($('#band option:selected').val(), $('#decontSelect option:selected').val(),dxcluster_maxage);
}); });
$("#spottertoggle").on("click", function() { $("#spottertoggle").on("click", function() {
if ($('.spottable').DataTable().column(4).visible()) { if (table.column(4).visible()) {
$('.spottable').DataTable().column(4).visible(false); table.column(4).visible(false);
} else { } else {
$('.spottable').DataTable().column(4).visible(true); table.column(4).visible(true);
} }
}); });