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'); ?>
+