mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge branch 'dev' into new_logo
This commit is contained in:
@@ -162,6 +162,20 @@ class Statistics extends CI_Controller {
|
||||
echo json_encode($satstats);
|
||||
}
|
||||
|
||||
public function get_unique_sat_callsigns() {
|
||||
$this->load->model('stats');
|
||||
|
||||
$result = $this->stats->unique_sat_callsigns();
|
||||
$total_qsos['qsoarray'] = $result['qsoView'];
|
||||
$total_qsos['satunique'] = $result['satunique'];
|
||||
$total_qsos['modeunique'] = $result['modeunique'];
|
||||
$total_qsos['total'] = $result['total'];
|
||||
$total_qsos['sats'] = $this->stats->get_sats();
|
||||
$total_qsos['modes'] = $this->stats->get_sat_modes();
|
||||
|
||||
$this->load->view('statistics/satuniquetable', $total_qsos);
|
||||
}
|
||||
|
||||
public function get_unique_callsigns() {
|
||||
$this->load->model('stats');
|
||||
|
||||
@@ -175,6 +189,21 @@ class Statistics extends CI_Controller {
|
||||
$this->load->view('statistics/uniquetable', $total_qsos);
|
||||
}
|
||||
|
||||
public function get_total_sat_qsos() {
|
||||
$this->load->model('stats');
|
||||
|
||||
$totalqsos = array();
|
||||
|
||||
$result = $this->stats->total_sat_qsos();
|
||||
$total_qsos['qsoarray'] = $result['qsoView'];
|
||||
$total_qsos['sattotal'] = $result['sattotal'];
|
||||
$total_qsos['modetotal'] = $result['modetotal'];
|
||||
$total_qsos['modes'] = $result['modes'];
|
||||
$total_qsos['sats'] = $this->stats->get_sats();
|
||||
|
||||
$this->load->view('statistics/satqsotable', $total_qsos);
|
||||
}
|
||||
|
||||
public function get_total_qsos() {
|
||||
$this->load->model('stats');
|
||||
|
||||
|
||||
@@ -71,6 +71,57 @@
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
function unique_sat_callsigns() {
|
||||
$qsoView = array();
|
||||
|
||||
$sats = $this->get_sats();
|
||||
$modes = $this->get_sat_modes();
|
||||
|
||||
$satunique = $this->getUniqueSatCallsignsSat();
|
||||
$modeunique = $this->getUniqueSatCallsignsModes();
|
||||
|
||||
// Generating the band/mode table
|
||||
foreach ($sats as $sat) {
|
||||
$sattotal[$sat] = 0;
|
||||
foreach ($modes as $mode) {
|
||||
$qsoView [$sat][$mode] = '-';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($satunique as $sat) {
|
||||
$satcalls[$sat->sat] = $sat->calls;
|
||||
}
|
||||
|
||||
foreach ($modeunique as $mode) {
|
||||
//if ($mode->col_submode == null) {
|
||||
if ($mode->col_submode == null || $mode->col_submode == "") {
|
||||
$modecalls[$mode->col_mode] = $mode->calls;
|
||||
} else {
|
||||
$modecalls[$mode->col_submode] = $mode->calls;
|
||||
}
|
||||
}
|
||||
|
||||
// Populating array with worked
|
||||
$workedQso = $this->getUniqueSatCallsigns();
|
||||
|
||||
foreach ($workedQso as $line) {
|
||||
//if ($line->col_submode == null) {
|
||||
if ($line->col_submode == null || $line->col_submode == "") {
|
||||
$qsoView [$line->sat] [$line->col_mode] = $line->calls;
|
||||
} else {
|
||||
$qsoView [$line->sat] [$line->col_submode] = $line->calls;
|
||||
}
|
||||
}
|
||||
|
||||
$result['qsoView'] = $qsoView;
|
||||
$result['satunique'] = $satcalls;
|
||||
$result['modeunique'] = $modecalls;
|
||||
$result['total'] = $this->getUniqueSatCallsignsTotal();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function unique_callsigns() {
|
||||
$qsoView = array();
|
||||
|
||||
@@ -79,6 +130,9 @@
|
||||
|
||||
$bandunique = $this->getUniqueCallsignsBands();
|
||||
$modeunique = $this->getUniqueCallsignsModes();
|
||||
|
||||
$modecalls=[];
|
||||
$bandcalls=[];
|
||||
|
||||
// Generating the band/mode table
|
||||
foreach ($bands as $band) {
|
||||
@@ -121,6 +175,48 @@
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getUniqueSatCallsignsSat() {
|
||||
$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;
|
||||
}
|
||||
|
||||
$bands = array();
|
||||
|
||||
$this->db->select('count(distinct col_call) as calls, upper(col_sat_name) as sat', FALSE);
|
||||
$this->db->where('col_prop_mode', 'SAT');
|
||||
$this->db->where('coalesce(col_sat_name,"") != ""');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->group_by('upper(col_sat_name)');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getUniqueSatCallsigns() {
|
||||
$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;
|
||||
}
|
||||
|
||||
$bands = array();
|
||||
|
||||
$this->db->select('count(distinct col_call) as calls, upper(col_sat_name) as sat, col_mode, coalesce(col_submode, "") col_submode', FALSE);
|
||||
$this->db->where('col_prop_mode', 'SAT');
|
||||
$this->db->where('coalesce(col_sat_name,"") != ""');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->group_by('upper(col_sat_name), col_mode, coalesce(col_submode, "")');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getUniqueCallsigns() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
@@ -161,6 +257,27 @@
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getUniqueSatCallsignsModes() {
|
||||
$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;
|
||||
}
|
||||
|
||||
$bands = array();
|
||||
|
||||
$this->db->select('count(distinct col_call) as calls, col_mode, coalesce(col_submode, "") col_submode', FALSE);
|
||||
$this->db->where('coalesce(col_sat_name,"") != ""');
|
||||
$this->db->where('col_prop_mode', 'SAT');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->group_by('col_mode, coalesce(col_submode, "")');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getUniqueCallsignsBands() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
@@ -181,6 +298,26 @@
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getUniqueSatCallsignsTotal() {
|
||||
$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;
|
||||
}
|
||||
|
||||
$bands = array();
|
||||
|
||||
$this->db->select('count(distinct col_call) as calls', FALSE);
|
||||
$this->db->where('coalesce(col_sat_name,"") != ""');
|
||||
$this->db->where('col_prop_mode', 'SAT');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query->row();
|
||||
}
|
||||
|
||||
function getUniqueCallsignsTotal() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
@@ -200,6 +337,44 @@
|
||||
return $query->row();
|
||||
}
|
||||
|
||||
function total_sat_qsos() {
|
||||
$qsoView = array();
|
||||
|
||||
$sats = $this->get_sats();
|
||||
$modes = $this->get_sat_modes();
|
||||
|
||||
$sattotal = array();
|
||||
$modetotal = array();
|
||||
// Generating the band/mode table
|
||||
foreach ($sats as $sat) {
|
||||
$sattotal[$sat] = 0;
|
||||
foreach ($modes as $mode) {
|
||||
$qsoView [$sat][$mode] = '-';
|
||||
$modetotal[$mode] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Populating array with worked
|
||||
$workedQso = $this->modeSatQso();
|
||||
foreach ($workedQso as $line) {
|
||||
if ($line->col_submode == null || $line->col_submode == "") {
|
||||
$qsoView [$line->sat] [$line->col_mode] = $line->count;
|
||||
$modetotal[$line->col_mode] += $line->count;
|
||||
} else {
|
||||
$qsoView [$line->sat] [$line->col_submode] = $line->count;
|
||||
$modetotal[$line->col_submode] += $line->count;
|
||||
}
|
||||
$sattotal[$line->sat] += $line->count;
|
||||
}
|
||||
|
||||
$result['qsoView'] = $qsoView;
|
||||
$result['sattotal'] = $sattotal;
|
||||
$result['modetotal'] = $modetotal;
|
||||
$result['modes'] = $modes;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function total_qsos() {
|
||||
$qsoView = array();
|
||||
|
||||
@@ -237,6 +412,27 @@
|
||||
return $result;
|
||||
}
|
||||
|
||||
function modeSatQso() {
|
||||
$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;
|
||||
}
|
||||
|
||||
$bands = array();
|
||||
|
||||
$this->db->select('count(*) as count, upper(col_sat_name) as sat, col_mode, coalesce(col_submode, "") col_submode', FALSE);
|
||||
$this->db->where('coalesce(col_sat_name,"") != ""');
|
||||
$this->db->where('col_prop_mode', 'SAT');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->group_by('upper(col_sat_name), col_mode, coalesce(col_submode, "")');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function modeBandQso() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
@@ -257,6 +453,31 @@
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function get_sats() {
|
||||
$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;
|
||||
}
|
||||
|
||||
$sats = array();
|
||||
|
||||
$this->db->select('distinct col_sat_name as satsort, upper(col_sat_name) as sat', FALSE);
|
||||
$this->db->where('coalesce(col_sat_name,"") != ""');
|
||||
$this->db->where('col_prop_mode', 'SAT');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->order_by('satsort', 'asc');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
foreach($query->result() as $sat){
|
||||
array_push($sats, $sat->sat);
|
||||
}
|
||||
|
||||
return $sats;
|
||||
}
|
||||
|
||||
function get_bands() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
@@ -281,6 +502,35 @@
|
||||
return $bands;
|
||||
}
|
||||
|
||||
function get_sat_modes() {
|
||||
$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;
|
||||
}
|
||||
|
||||
$modes = array();
|
||||
|
||||
$this->db->select('distinct col_mode, coalesce(col_submode, "") col_submode', FALSE);
|
||||
$this->db->where('coalesce(col_sat_name,"") != ""');
|
||||
$this->db->where('col_prop_mode', 'SAT');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->order_by('col_mode, col_submode', 'ASC');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
foreach($query->result() as $mode){
|
||||
if ($mode->col_submode == null || $mode->col_submode == "") {
|
||||
array_push($modes, $mode->col_mode);
|
||||
} else {
|
||||
array_push($modes, $mode->col_submode);
|
||||
}
|
||||
}
|
||||
|
||||
return $modes;
|
||||
}
|
||||
|
||||
function get_modes() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
@@ -310,4 +560,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -87,18 +87,46 @@
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="satellite" role="tabpanel" aria-labelledby="satellite-tab">
|
||||
<br/>
|
||||
<div style="display: flex;" id="satContainer"><div style="flex: 1;"><canvas id="satChart" width="500" height="500"></canvas></div><div style="flex: 1;" id="satTable">
|
||||
|
||||
<table style="width:100%" class="sattable table table-sm table-bordered table-hover table-striped table-condensed text-center"><thead>
|
||||
<tr>
|
||||
<td>#</td>
|
||||
<td>Satellite</td>
|
||||
<td># of QSO's worked</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table></div></div>
|
||||
<br />
|
||||
<ul class="nav nav-pills" id="myTab3" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" id="sat-tab" data-bs-toggle="tab" href="#sattab" role="tab" aria-controls="sattab" aria-selected="true">Satellites</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="satqsos-tab" data-bs-toggle="tab" href="#satqsostab" role="tab" aria-controls="satqsostab" aria-selected="false"><?php echo lang('statistics_qsos'); ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="satunique-tab" data-bs-toggle="tab" href="#satuniquetab" role="tab" aria-controls="satuniquetab" aria-selected="false"><?php echo lang('statistics_unique_callsigns'); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade show active" id="sattab" role="tabpanel" aria-labelledby="sat-tab">
|
||||
<div style="display: flex;" id="satContainer">
|
||||
<div style="flex: 1;">
|
||||
<canvas id="satChart" width="500" height="500"></canvas>
|
||||
</div>
|
||||
<div style="flex: 1;" id="satTable">
|
||||
<table style="width:100%" class="sattable table table-sm table-bordered table-hover table-striped table-condensed text-center"><thead>
|
||||
<tr>
|
||||
<td>#</td>
|
||||
<td>Satellite</td>
|
||||
<td># of QSO's worked</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="satqsostab" role="tabpanel" aria-labelledby="satqsos-tab">
|
||||
<div class="satqsos" style="margin-top: 20px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="satuniquetab" role="tabpanel" aria-labelledby="satunique-tab">
|
||||
<div class="satunique" style="margin-top: 20px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
30
application/views/statistics/satqsotable.php
Normal file
30
application/views/statistics/satqsotable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
if ($qsoarray) {
|
||||
echo '<br />
|
||||
<table style="width:100%" class="satuniquetable table-sm table table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>';
|
||||
echo '<tr><th></th>';
|
||||
foreach($modes as $mode) {
|
||||
echo '<th>' . $mode . '</th>';
|
||||
}
|
||||
echo '<th>'.lang('statistics_total').'</th>';
|
||||
echo '</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
foreach ($qsoarray as $sat => $mode) {
|
||||
echo '<tr><th>'. $sat .'</th>';
|
||||
foreach ($mode as $singlemode) {
|
||||
echo '<td>'.$singlemode.'</td>';
|
||||
}
|
||||
echo '<th>' . $sattotal[$sat] . '</th>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tbody><tfoot><tr><th>'.lang('statistics_total').'</th>';
|
||||
$grandtotal=0;
|
||||
foreach($modes as $mode) {
|
||||
echo '<th>' . $modetotal[$mode] . '</th>';
|
||||
$grandtotal += $modetotal[$mode];
|
||||
}
|
||||
echo '<th>' . $grandtotal . '</th>';
|
||||
echo '</tr></tfoot></table>';
|
||||
}
|
||||
28
application/views/statistics/satuniquetable.php
Normal file
28
application/views/statistics/satuniquetable.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
if ($qsoarray) {
|
||||
echo '<br />
|
||||
<table style="width:100%" class="satuniquetable table-sm table table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>';
|
||||
echo '<tr><th></th>';
|
||||
foreach($modes as $mode) {
|
||||
echo '<th>' . $mode . '</th>';
|
||||
}
|
||||
echo '<th>'.lang('statistics_total').'</th>';
|
||||
echo '</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
foreach ($qsoarray as $sat => $mode) {
|
||||
echo '<tr><th>'. $sat .'</th>';
|
||||
foreach ($mode as $singlemode) {
|
||||
echo '<td>'.$singlemode.'</td>';
|
||||
}
|
||||
echo '<th>' . $satunique[$sat] . '</th>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tbody><tfoot><tr><th>'.lang('statistics_total').'</th>';
|
||||
foreach($modes as $mode) {
|
||||
echo '<th>' . $modeunique[$mode] . '</th>';
|
||||
}
|
||||
echo '<th>' . $total->calls . '</th>';
|
||||
echo '</tr></tfoot></table>';
|
||||
}
|
||||
Reference in New Issue
Block a user