Merge pull request #657 from AndreasK79/qslstats

Added a page for QSL statistics, just numbers
This commit is contained in:
Andreas Kristiansen
2024-07-30 14:45:00 +02:00
committed by GitHub
6 changed files with 415 additions and 121 deletions

View File

@@ -20,21 +20,21 @@ class Statistics extends CI_Controller {
} else {
redirect('user/login');
}
}
}
// Render User Interface
// Set Page Title
$data['page_title'] = __("Statistics");
$data['sat_active'] = array_search("SAT", $this->bands->get_user_bands(), true);
// Load Views
$this->load->view('interface_assets/header', $data);
$this->load->view('statistics/index');
$this->load->view('interface_assets/footer');
}
function custom() {
$this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) {
if($this->user_model->validate_session()) {
@@ -44,12 +44,12 @@ class Statistics extends CI_Controller {
redirect('user/login');
}
}
$this->load->model('logbook_model');
$data['page_title'] = __("Custom Statistics");
$data['modes'] = $this->logbook_model->get_modes();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
@@ -65,16 +65,16 @@ class Statistics extends CI_Controller {
}
else
{
$this->load->model('stats');
$data['result'] = $this->stats->result();
$this->load->view('interface_assets/header', $data);
$this->load->view('statistics/custom_result');
$this->load->view('interface_assets/footer');
}
}
public function get_year() {
@@ -84,7 +84,7 @@ class Statistics extends CI_Controller {
$totals_year = $this->logbook_model->totals_year();
$yearstats = array();
$i = 0;
if ($totals_year) {
foreach($totals_year->result() as $qso_numbers) {
@@ -92,7 +92,7 @@ class Statistics extends CI_Controller {
$yearstats[$i++]['total'] = $qso_numbers->total;
}
}
header('Content-Type: application/json');
echo json_encode($yearstats);
}
@@ -101,7 +101,7 @@ class Statistics extends CI_Controller {
$this->load->model('logbook_model');
$modestats = array();
$i = 0;
$modestats[$i]['mode'] = 'ssb';
$modestats[$i++]['total'] = $this->logbook_model->total_ssb();
@@ -112,7 +112,7 @@ class Statistics extends CI_Controller {
$modestats[$i]['mode'] = 'digi';
$modestats[$i]['total'] = $this->logbook_model->total_digi();
usort($modestats, fn($a, $b) => $b['total'] <=> $a['total']);
header('Content-Type: application/json');
echo json_encode($modestats);
@@ -124,9 +124,9 @@ class Statistics extends CI_Controller {
$bandstats = array();
$total_bands = $this->logbook_model->total_bands();
$i = 0;
if ($total_bands) {
foreach($total_bands->result() as $qso_numbers) {
$bandstats[$i]['band'] = $qso_numbers->band;
@@ -145,7 +145,7 @@ class Statistics extends CI_Controller {
$total_sat = $this->logbook_model->total_sat();
$i = 0;
if ($total_sat) {
foreach($total_sat->result() as $qso_numbers) {
$satstats[$i]['sat'] = $qso_numbers->COL_SAT_NAME;
@@ -160,6 +160,8 @@ class Statistics extends CI_Controller {
public function get_unique_sat_callsigns() {
$this->load->model('stats');
$total_qsos = array();
$result = $this->stats->unique_sat_callsigns();
$total_qsos['qsoarray'] = $result['qsoView'];
$total_qsos['satunique'] = $result['satunique'];
@@ -174,6 +176,8 @@ class Statistics extends CI_Controller {
public function get_unique_callsigns() {
$this->load->model('stats');
$total_qsos = array();
$result = $this->stats->unique_callsigns();
$total_qsos['qsoarray'] = $result['qsoView'];
$total_qsos['bandunique'] = $result['bandunique'];
@@ -187,7 +191,7 @@ class Statistics extends CI_Controller {
public function get_total_sat_qsos() {
$this->load->model('stats');
$totalqsos = array();
$total_qsos = array();
$result = $this->stats->total_sat_qsos();
$total_qsos['qsoarray'] = $result['qsoView'];
@@ -202,7 +206,7 @@ class Statistics extends CI_Controller {
public function get_total_qsos() {
$this->load->model('stats');
$totalqsos = array();
$total_qsos = array();
$result = $this->stats->total_qsos();
$total_qsos['qsoarray'] = $result['qsoView'];
@@ -212,4 +216,24 @@ class Statistics extends CI_Controller {
$this->load->view('statistics/qsotable', $total_qsos);
}
public function qslstats() {
$this->load->model('stats');
$total_qsos = array();
$result = $this->stats->total_qsls();
$total_qsos['qsoarray'] = $result['qsoView'];
$total_qsos['qsosatarray'] = $result['qsoSatView'];
$total_qsos['bands'] = $this->stats->get_bands();
$total_qsos['sats'] = $this->stats->get_sats();
// Set Page Title
$data['page_title'] = __("QSL Statistics");
// Load Views
$this->load->view('interface_assets/header');
$this->load->view('statistics/qsltable', $total_qsos);
$this->load->view('interface_assets/footer');
}
}

View File

@@ -4,30 +4,30 @@
function result() {
$this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME');
$this->db->where('COL_TIME_ON >=', $this->input->post('start_date'));
$this->db->where('COL_TIME_OFF <=', $this->input->post('end_date'));
$this->db->where('COL_TIME_ON >=', $this->input->post('start_date'));
$this->db->where('COL_TIME_OFF <=', $this->input->post('end_date'));
if($this->input->post('band_6m') == "6m") {
$this->db->where('COL_BAND', $this->input->post('band_6m'));
$this->db->where('COL_BAND', $this->input->post('band_6m'));
}
if($this->input->post('band_2m') == "2m") {
$this->db->where('COL_BAND', $this->input->post('band_2m'));
$this->db->where('COL_BAND', $this->input->post('band_2m'));
}
if($this->input->post('band_70cm') == "70cm") {
$this->db->where('COL_BAND', $this->input->post('band_70cm'));
$this->db->where('COL_BAND', $this->input->post('band_70cm'));
}
if($this->input->post('band_23cm') == "23cm") {
$this->db->where('COL_BAND', $this->input->post('band_23cm'));
$this->db->where('COL_BAND', $this->input->post('band_23cm'));
}
if($this->input->post('band_3cm') == "3cm") {
$this->db->where('COL_BAND', $this->input->post('band_3cm'));
$this->db->where('COL_BAND', $this->input->post('band_3cm'));
}
// Select Voice QSOs
if($this->input->post('mode_data') == "data") {
if($this->input->post('mode_ssb') != "ssb") {
@@ -45,29 +45,29 @@
$this->db->where('COL_MODE !=', 'AM');
}
}
// Select Voice QSOs
if($this->input->post('mode_ssb') == "ssb") {
$this->db->where('COL_MODE', $this->input->post('mode_ssb'));
$this->db->where('COL_MODE', $this->input->post('mode_ssb'));
$this->db->or_where('COL_MODE', 'USB');
$this->db->or_where('COL_MODE', 'LSB');
$this->db->or_where('COL_MODE', 'LSB');
}
// Select CW QSOs
if($this->input->post('mode_cw') == "cw") {
$this->db->where('COL_MODE', $this->input->post('mode_ssb'));
$this->db->where('COL_MODE', $this->input->post('mode_ssb'));
}
// Select FM QSOs
if($this->input->post('mode_fm') == "fm") {
$this->db->where('COL_MODE', $this->input->post('mode_ssb'));
$this->db->where('COL_MODE', $this->input->post('mode_ssb'));
}
// Select AM QSOs
if($this->input->post('mode_am') == "am") {
$this->db->where('COL_MODE', $this->input->post('mode_am'));
$this->db->where('COL_MODE', $this->input->post('mode_am'));
}
return $this->db->get($this->config->item('table_name'));
}
@@ -79,7 +79,7 @@
$satunique = $this->getUniqueSatCallsignsSat();
$modeunique = $this->getUniqueSatCallsignsModes();
// Generating the band/mode table
foreach ($sats as $sat) {
$sattotal[$sat] = 0;
@@ -133,7 +133,7 @@
$modecalls=[];
$bandcalls=[];
// Generating the band/mode table
foreach ($bands as $band) {
$bandtotal[$band] = 0;
@@ -178,19 +178,19 @@
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();
@@ -199,59 +199,57 @@
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');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$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, lower(col_band) as band, col_mode, coalesce(col_submode, "") col_submode', FALSE);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->group_by('lower(col_band), col_mode, coalesce(col_submode, "")');
$query = $this->db->get($this->config->item('table_name'));
return $query->result();
}
function getUniqueCallsignsModes() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$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_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();
@@ -260,39 +258,38 @@
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');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$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_band as band', FALSE);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->group_by('col_band');
$query = $this->db->get($this->config->item('table_name'));
return $query->result();
@@ -301,37 +298,36 @@
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');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$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_in('station_id', $logbooks_locations_array);
$query = $this->db->get($this->config->item('table_name'));
return $query->row();
@@ -412,42 +408,167 @@
return $result;
}
function total_qsls() {
$qsoView = array();
$qsoSatView = array();
$bands = $this->get_bands();
$modes = $this->get_modes();
$sats = $this->get_sats();
$satmodes = $this->get_sat_modes();
// Generating the band/mode table
foreach ($bands as $band) {
foreach ($modes as $mode) {
$qsoView [$mode][$band]['qso'] = '0';
$qsoView [$mode][$band]['qsl'] = '0';
$qsoView [$mode][$band]['lotw'] = '0';
$qsoView [$mode][$band]['qrz'] = '0';
$qsoView [$mode][$band]['eqsl'] = '0';
$qsoView [$mode][$band]['clublog'] = '0';
}
}
// Populating array with numbers
$workedQso = $this->modeBandQsl();
foreach ($workedQso as $line) {
if ($line->col_submode == null || $line->col_submode == "") {
$qsoView [$line->col_mode] [$line->band] ['qso'] = $line->qsos;
$qsoView [$line->col_mode] [$line->band] ['qsl'] = $line->qsl;
$qsoView [$line->col_mode] [$line->band] ['lotw'] = $line->lotw;
$qsoView [$line->col_mode] [$line->band] ['qrz'] = $line->qrz;
$qsoView [$line->col_mode] [$line->band] ['eqsl'] = $line->eqsl;
$qsoView [$line->col_mode] [$line->band] ['clublog'] = $line->clublog;
} else {
$qsoView [$line->col_submode] [$line->band] ['qso'] = $line->qsos;
$qsoView [$line->col_submode] [$line->band] ['qsl'] = $line->qsl;
$qsoView [$line->col_submode] [$line->band] ['lotw'] = $line->lotw;
$qsoView [$line->col_submode] [$line->band] ['qrz'] = $line->qrz;
$qsoView [$line->col_submode] [$line->band] ['eqsl'] = $line->eqsl;
$qsoView [$line->col_submode] [$line->band] ['clublog'] = $line->clublog;
}
}
// Generating the band/mode table
foreach ($sats as $sat) {
foreach ($satmodes as $mode) {
$qsoSatView [$mode][$sat]['qso'] = '0';
$qsoSatView [$mode][$sat]['qsl'] = '0';
$qsoSatView [$mode][$sat]['lotw'] = '0';
$qsoSatView [$mode][$sat]['qrz'] = '0';
$qsoSatView [$mode][$sat]['eqsl'] = '0';
$qsoSatView [$mode][$sat]['clublog'] = '0';
}
}
// Populating array with numbers
$workedSatQso = $this->modeSatQsl();
foreach ($workedSatQso as $line) {
if ($line->col_submode == null || $line->col_submode == "") {
$qsoSatView [$line->col_mode] [$line->sat] ['qso'] = $line->qsos;
$qsoSatView [$line->col_mode] [$line->sat] ['qsl'] = $line->qsl;
$qsoSatView [$line->col_mode] [$line->sat] ['lotw'] = $line->lotw;
$qsoSatView [$line->col_mode] [$line->sat] ['qrz'] = $line->qrz;
$qsoSatView [$line->col_mode] [$line->sat] ['eqsl'] = $line->eqsl;
$qsoSatView [$line->col_mode] [$line->sat] ['clublog'] = $line->clublog;
} else {
$qsoSatView [$line->col_submode] [$line->sat] ['qso'] = $line->qsos;
$qsoSatView [$line->col_submode] [$line->sat] ['qsl'] = $line->qsl;
$qsoSatView [$line->col_submode] [$line->sat] ['lotw'] = $line->lotw;
$qsoSatView [$line->col_submode] [$line->sat] ['qrz'] = $line->qrz;
$qsoSatView [$line->col_submode] [$line->sat] ['eqsl'] = $line->eqsl;
$qsoSatView [$line->col_submode] [$line->sat] ['clublog'] = $line->clublog;
}
}
$result['qsoView'] = $qsoView;
$result['qsoSatView'] = $qsoSatView;
return $result;
}
function modeBandQsl() {
$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;
}
$sql = "select lower(col_band) as band, col_mode, coalesce(col_submode, '') col_submode,
count(*) qsos,
count(case when COL_QSL_RCVD='Y' then 1 end) qsl,
count(case when COL_EQSL_QSL_RCVD='Y' then 1 end) eqsl,
count(case when COL_LOTW_QSL_RCVD='Y' then 1 end) lotw,
count(case when COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y' then 1 end) qrz,
count(case when COL_CLUBLOG_QSO_DOWNLOAD_STATUS='Y' then 1 end) clublog
from " . $this->config->item('table_name') . "
where station_id in (". implode(',', $logbooks_locations_array) .")
and col_prop_mode <> 'SAT'
group by lower(col_band), col_mode, coalesce(col_submode, '')";
$result = $this->db->query($sql);
return $result->result();
}
function modeSatQsl() {
$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;
}
$sql = "select upper(col_sat_name) as sat, col_mode, coalesce(col_submode, '') col_submode,
count(*) qsos,
count(case when COL_QSL_RCVD='Y' then 1 end) qsl,
count(case when COL_EQSL_QSL_RCVD='Y' then 1 end) eqsl,
count(case when COL_LOTW_QSL_RCVD='Y' then 1 end) lotw,
count(case when COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y' then 1 end) qrz,
count(case when COL_CLUBLOG_QSO_DOWNLOAD_STATUS='Y' then 1 end) clublog
from " . $this->config->item('table_name') . "
where station_id in (". implode(',', $logbooks_locations_array) .")
and col_prop_mode = 'SAT'
group by upper(col_sat_name), col_mode, coalesce(col_submode, '')";
$result = $this->db->query($sql);
return $result->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;
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');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$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;
return null;
}
$bands = array();
$this->db->select('count(*) as count, lower(col_band) as band, col_mode, coalesce(col_submode, "") col_submode', FALSE);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->group_by('lower(col_band), col_mode, coalesce(col_submode, "")');
$query = $this->db->get($this->config->item('table_name'));
return $query->result();
@@ -456,62 +577,72 @@
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;
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');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$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;
return null;
}
$bands = array();
$this->db->select('distinct col_band+0 as bandsort, lower(col_band) as band', FALSE);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->order_by('bandsort', 'desc');
$query = $this->db->get($this->config->item('table_name'));
foreach($query->result() as $band){
array_push($bands, $band->band);
}
usort(
$bands,
function($b, $a) {
sscanf($a, '%f%s', $ac, $ar);
sscanf($b, '%f%s', $bc, $br);
if ($ar == $br) {
return ($ac < $bc) ? -1 : 1;
}
return ($ar < $br) ? -1 : 1;
}
);
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;
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');
@@ -519,7 +650,7 @@
$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);
@@ -530,24 +661,23 @@
return $modes;
}
function get_modes() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$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;
return null;
}
$modes = array();
$this->db->select('distinct col_mode, coalesce(col_submode, "") col_submode', FALSE);
$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);

View File

@@ -200,7 +200,7 @@ if($this->session->userdata('user_id') != null) {
<script id="dxccmapjs" type="text/javascript" src="<?php echo base_url(); ?>assets/js/sections/dxccmap.js" tileUrl="<?php echo $this->optionslib->get_option('option_map_tile_server');?>"></script>
<?php } ?>
<?php if ($this->uri->segment(1) == "statistics") { ?>
<?php if ($this->uri->segment(1) == "statistics" && $this->uri->segment(2) == "") { ?>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/chart.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/chartjs-plugin-piechart-outlabels.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/sections/statistics.js"></script>

View File

@@ -133,6 +133,8 @@
<ul class="dropdown-menu header-dropdown">
<li><a class="dropdown-item" href="<?php echo site_url('statistics'); ?>" title="Statistics"><i class="fas fa-chart-area"></i> <?= __("Statistics"); ?></a></li>
<div class="dropdown-divider"></div>
<li><a class="dropdown-item" href="<?php echo site_url('statistics/qslstats'); ?>" title="QSL Statistics"><i class="fas fa-chart-area"></i> <?= __("QSL Statistics"); ?></a></li>
<div class="dropdown-divider"></div>
<li><a class="dropdown-item" href="<?php echo site_url('gridmap'); ?>" title="Gridmap"><i class="fas fa-globe-europe"></i> <?= __("Gridsquare Map"); ?></a></li>
<div class="dropdown-divider"></div>
<li><a class="dropdown-item" href="<?php echo site_url('activated_gridmap'); ?>" title="Activated Gridsquares"><i class="fas fa-globe-europe"></i> <?= __("Activated Gridsquares"); ?></a></li>
@@ -402,7 +404,7 @@
if (!($this->config->item('disable_oqrs') ?? false)) {
$oqrs_requests = $this->oqrs_model->oqrs_requests($location_list);
?>
<li><a class="dropdown-item" href="<?php echo site_url('oqrs/requests'); ?>" title="OQRS Requests"><i class="fa fa-id-card"></i> <?= __("OQRS Requests"); ?>
<li><a class="dropdown-item" href="<?php echo site_url('oqrs/requests'); ?>" title="OQRS Requests"><i class="fa fa-id-card"></i> <?= __("OQRS Requests"); ?>
<?php if ($oqrs_requests > 0) {
echo "<span class=\"badge text-bg-light\">" . $oqrs_requests . "</span>";
} ?></a></li>

View File

@@ -0,0 +1,122 @@
<div class="container">
<br />
<div class="card">
<div class="card-header">
<?= __("QSL Statistics"); ?>
</div>
<div class="tables-container mx-2">
<?php
if ($qsoarray) {
foreach($bands as $band) {
echo '
<div class="table-wrapper">
<table style="width: 100%" class="flex-wrap table-sm table table-bordered table-hover table-striped table-condensed text-center">
<thead>';
echo '<tr>';
echo '<th colspan = 7>' . $band . '</th>';
echo '</tr>
</thead>
<tbody>';
echo '<tr><th></th>';
echo '<th>QSO</th>';
echo '<th>QSL</th>';
echo '<th>LoTW</th>';
echo '<th>eQSL</th>';
echo '<th>QRZ</th>';
echo '<th>Clublog</th>';
echo '</tr>';
$qsototal = 0;
$qsltotal = 0;
$lotwtotal = 0;
$eqsltotal = 0;
$qrztotal = 0;
$clublogtotal = 0;
foreach ($qsoarray as $mode => $value) {
$qsototal += $value[$band]['qso'];
$qsltotal += $value[$band]['qsl'];
$lotwtotal += $value[$band]['lotw'];
$eqsltotal += $value[$band]['eqsl'];
$qrztotal += $value[$band]['qrz'];
$clublogtotal += $value[$band]['clublog'];
$total = $value[$band]['qso'] + $value[$band]['qsl'] + $value[$band]['lotw'] + $value[$band]['eqsl'] + $value[$band]['qrz'] + $value[$band]['clublog'];
if ($total > 0) {
echo '<tr>
<th>'. $mode .'</th>';
echo '<td>' . $value[$band]['qso'] . '</td>';
echo '<td>' . $value[$band]['qsl'] . '</td>';
echo '<td>' . $value[$band]['lotw'] . '</td>';
echo '<td>' . $value[$band]['eqsl'] . '</td>';
echo '<td>' . $value[$band]['qrz'] . '</td>';
echo '<td>' . $value[$band]['clublog'] . '</td>';
echo '</tr>';
}
}
echo '</tbody><tfoot><tr><th>'.__("Total").'</th>';
echo '<th>' . $qsototal . '</th>';
echo '<th>' . $qsltotal . '</th>';
echo '<th>' . $lotwtotal . '</th>';
echo '<th>' . $eqsltotal . '</th>';
echo '<th>' . $qrztotal . '</th>';
echo '<th>' . $clublogtotal . '</th>';
echo '</tr></tfoot></table></div>';
}
}
if ($qsosatarray) {
foreach($sats as $sat) {
echo '
<div class="table-wrapper">
<table style="width: 100%" class="mx-2 flex-wrap table-sm table table-bordered table-hover table-striped table-condensed text-center">
<thead>';
echo '<tr>';
echo '<th colspan = 7>' . $sat . '</th>';
echo '</tr>
</thead>
<tbody>';
echo '<tr><th></th>';
echo '<th>QSO</th>';
echo '<th>QSL</th>';
echo '<th>LoTW</th>';
echo '<th>eQSL</th>';
echo '<th>QRZ</th>';
echo '<th>Clublog</th>';
echo '</tr>';
$qsototal = 0;
$qsltotal = 0;
$lotwtotal = 0;
$eqsltotal = 0;
$qrztotal = 0;
$clublogtotal = 0;
foreach ($qsosatarray as $mode => $value) {
$qsototal += $value[$sat]['qso'];
$qsltotal += $value[$sat]['qsl'];
$lotwtotal += $value[$sat]['lotw'];
$eqsltotal += $value[$sat]['eqsl'];
$qrztotal += $value[$sat]['qrz'];
$clublogtotal += $value[$sat]['clublog'];
$total = $value[$sat]['qso'] + $value[$sat]['qsl'] + $value[$sat]['lotw'] + $value[$sat]['eqsl'] + $value[$sat]['qrz'] + $value[$sat]['clublog'];
if ($total > 0) {
echo '<tr>
<th>'. $mode .'</th>';
echo '<td>' . $value[$sat]['qso'] . '</td>';
echo '<td>' . $value[$sat]['qsl'] . '</td>';
echo '<td>' . $value[$sat]['lotw'] . '</td>';
echo '<td>' . $value[$sat]['eqsl'] . '</td>';
echo '<td>' . $value[$sat]['qrz'] . '</td>';
echo '<td>' . $value[$sat]['clublog'] . '</td>';
echo '</tr>';
}
}
echo '</tbody><tfoot><tr><th>'.__("Total").'</th>';
echo '<th>' . $qsototal . '</th>';
echo '<th>' . $qsltotal . '</th>';
echo '<th>' . $lotwtotal . '</th>';
echo '<th>' . $eqsltotal . '</th>';
echo '<th>' . $qrztotal . '</th>';
echo '<th>' . $clublogtotal . '</th>';
echo '</tr></tfoot></table></div>';
}
}
?>
</div>
</div>
</div>

View File

@@ -1048,10 +1048,26 @@ label {
text-transform: uppercase;
}
.tables-container {
display: flex;
flex-wrap: wrap;
gap: 10px; /* Optional: add some space between tables */
justify-content: center;
overflow-x: auto; /* Enable horizontal scrolling if needed */
max-width: 100%; /* Ensure the container doesn't exceed the viewport width */
padding: 10px; /* Optional: add some padding */
box-sizing: border-box;
}
.table-wrapper {
flex: 1 1 400px; /* Adjust the base width of tables */
box-sizing: border-box;
}
.multiselect-container.dropdown-menu {
--bs-dropdown-padding-y: 0;
}
#dxcc + .btn-group .multiselect-container .multiselect-option input[type="radio"] {
display: none;
}
}