From 602a63d8c1a1675ce651a18c79f5a181aa44225c Mon Sep 17 00:00:00 2001 From: Thomas Werzmirzowsky Date: Fri, 19 Nov 2021 22:34:58 +0100 Subject: [PATCH 1/2] added eQSL and LotW to the dashboard --- application/controllers/Dashboard.php | 16 ++- .../language/english/general_words_lang.php | 2 + application/models/Logbook_model.php | 100 ++++++++++++++++++ application/views/dashboard/index.php | 38 ++++++- 4 files changed, 150 insertions(+), 6 deletions(-) diff --git a/application/controllers/Dashboard.php b/application/controllers/Dashboard.php index f8aadada..78c21aed 100644 --- a/application/controllers/Dashboard.php +++ b/application/controllers/Dashboard.php @@ -66,17 +66,23 @@ class Dashboard extends CI_Controller { $data['total_qsos'] = $this->logbook_model->total_qsos(); $data['month_qsos'] = $this->logbook_model->month_qsos(); $data['year_qsos'] = $this->logbook_model->year_qsos(); - + $data['total_countries'] = $this->logbook_model->total_countries(); $data['total_countries_confirmed_paper'] = $this->logbook_model->total_countries_confirmed_paper(); $data['total_countries_confirmed_eqsl'] = $this->logbook_model->total_countries_confirmed_eqsl(); $data['total_countries_confirmed_lotw'] = $this->logbook_model->total_countries_confirmed_lotw(); - + $data['total_qsl_sent'] = $this->logbook_model->total_qsl_sent(); $data['total_qsl_recv'] = $this->logbook_model->total_qsl_recv(); $data['total_qsl_requested'] = $this->logbook_model->total_qsl_requested(); - - $data['last_five_qsos'] = $this->logbook_model->get_last_qsos('11'); + + $data['total_eqsl_sent'] = $this->logbook_model->total_eqsl_sent(); + $data['total_eqsl_recv'] = $this->logbook_model->total_eqsl_recv(); + + $data['total_lotw_sent'] = $this->logbook_model->total_lotw_sent(); + $data['total_lotw_recv'] = $this->logbook_model->total_lotw_recv(); + + $data['last_five_qsos'] = $this->logbook_model->get_last_qsos('18'); $data['page_title'] = "Dashboard"; @@ -99,7 +105,7 @@ class Dashboard extends CI_Controller { $this->load->library('qra'); - $qsos = $this->logbook_model->get_last_qsos('11'); + $qsos = $this->logbook_model->get_last_qsos('18'); echo "{\"markers\": ["; $count = 1; diff --git a/application/language/english/general_words_lang.php b/application/language/english/general_words_lang.php index 178d3e40..9bc4e7d4 100644 --- a/application/language/english/general_words_lang.php +++ b/application/language/english/general_words_lang.php @@ -44,6 +44,8 @@ $lang['general_word_qslcards'] = 'QSL Cards'; $lang['general_word_qslcard_direct'] = 'Direct'; $lang['general_word_qslcard_bureau'] = 'Bureau'; $lang['general_word_qslcard_via'] = 'Via'; +$lang['general_word_eqslcards'] = 'eQSL Cards'; +$lang['general_word_lotw'] = 'Logbook of the World'; $lang['general_edit_qso'] = 'Edit QSO'; $lang['general_mark_qsl_rx_bureau'] = 'Mark QSL Received (Bureau)'; diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 3879173e..99bad94f 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1468,6 +1468,106 @@ class Logbook_model extends CI_Model { } } + /* Return total number of eQSL Cards sent */ + function total_eqsl_sent() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if(!empty($logbooks_locations_array)) { + $this->db->select('count(COL_EQSL_QSL_SENT) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_EQSL_QSL_SENT =', 'Y'); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + + /* Return total number of eQSL Cards received */ + function total_eqsl_recv() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if(!empty($logbooks_locations_array)) { + $this->db->select('count(COL_EQSL_QSL_RCVD) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_EQSL_QSL_RCVD =', 'Y'); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + + /* Return total number of LotW sent */ + function total_lotw_sent() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if(!empty($logbooks_locations_array)) { + $this->db->select('count(COL_LOTW_QSL_SENT) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_LOTW_QSL_SENT =', 'Y'); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + + /* Return total number of LotW received */ + function total_lotw_recv() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if(!empty($logbooks_locations_array)) { + $this->db->select('count(COL_LOTW_QSL_RCVD) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_LOTW_QSL_RCVD =', 'Y'); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + /* Return total number of countries worked */ function total_countries() { $CI =& get_instance(); diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index a6c1e386..23529033 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -193,7 +193,7 @@ function echo_table_col($row, $name) { - config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) { ?> + config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) && ($total_qsl_sent != 0 || $total_qsl_recv != 0 || $total_qsl_requested != 0)) { ?> @@ -215,6 +215,42 @@ function echo_table_col($row, $name) {
lang->line('general_word_qslcards'); ?>
+ + config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) && ($total_eqsl_sent != 0 || $total_eqsl_recv != 0)) { ?> + + + + + + + + + + + + + + +
lang->line('general_word_eqslcards'); ?>
lang->line('general_word_sent'); ?>
lang->line('general_word_received'); ?>
+ + + config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) && ($total_lotw_sent != 0 || $total_lotw_recv != 0)) { ?> + + + + + + + + + + + + + + +
lang->line('general_word_lotw'); ?>
lang->line('general_word_sent'); ?>
lang->line('general_word_received'); ?>
+ From 3b76fb35728aa02b7516155ab4db21742f5f0825 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 31 Dec 2021 15:25:42 +0100 Subject: [PATCH 2/2] [Dashboard] Added 50% width to the bottom right tables, as this makes them align. --- application/views/dashboard/index.php | 52 +++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index 23529033..43d7c65b 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -152,18 +152,18 @@ function echo_table_col($row, $name) { - lang->line('general_word_total'); ?> - + lang->line('general_word_total'); ?> + - lang->line('general_word_year'); ?> - + lang->line('general_word_year'); ?> + - lang->line('general_word_month'); ?> - + lang->line('general_word_month'); ?> + @@ -175,12 +175,12 @@ function echo_table_col($row, $name) { - lang->line('general_word_worked'); ?> - + lang->line('general_word_worked'); ?> + - lang->line('general_word_confirmed'); ?> - + lang->line('general_word_confirmed'); ?> + / / @@ -188,8 +188,8 @@ function echo_table_col($row, $name) { - lang->line('general_word_needed'); ?> - + lang->line('general_word_needed'); ?> + @@ -200,18 +200,18 @@ function echo_table_col($row, $name) { - lang->line('general_word_sent'); ?> - + lang->line('general_word_sent'); ?> + - lang->line('general_word_received'); ?> - + lang->line('general_word_received'); ?> + - lang->line('general_word_requested'); ?> - + lang->line('general_word_requested'); ?> + @@ -223,13 +223,13 @@ function echo_table_col($row, $name) { - lang->line('general_word_sent'); ?> - + lang->line('general_word_sent'); ?> + - lang->line('general_word_received'); ?> - + lang->line('general_word_received'); ?> + @@ -241,13 +241,13 @@ function echo_table_col($row, $name) { - lang->line('general_word_sent'); ?> - + lang->line('general_word_sent'); ?> + - lang->line('general_word_received'); ?> - + lang->line('general_word_received'); ?> +