diff --git a/application/controllers/Dashboard.php b/application/controllers/Dashboard.php
index 6c0a773e..2d868c50 100644
--- a/application/controllers/Dashboard.php
+++ b/application/controllers/Dashboard.php
@@ -50,10 +50,10 @@ class Dashboard extends CI_Controller {
$data['month_qsos'] = $this->logbook_model->month_qsos();
$data['year_qsos'] = $this->logbook_model->year_qsos();
- $data['total_countrys'] = $this->logbook_model->total_countrys();
- $data['total_countrys_confirmed_paper'] = $this->logbook_model->total_countrys_confirmed_paper();
- $data['total_countrys_confirmed_eqsl'] = $this->logbook_model->total_countrys_confirmed_eqsl();
- $data['total_countrys_confirmed_lotw'] = $this->logbook_model->total_countrys_confirmed_lotw();
+ $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();
@@ -63,6 +63,13 @@ class Dashboard extends CI_Controller {
$data['page_title'] = "Dashboard";
+ $this->load->model('dxcc');
+ $dxcc = $this->dxcc->list_current();
+
+ $current = $this->logbook_model->total_countries_current();
+
+ $data['total_countries_needed'] = count($dxcc->result()) - $current;
+
$this->load->view('interface_assets/header', $data);
$this->load->view('dashboard/index');
$this->load->view('interface_assets/footer');
diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php
index c63927af..0d0f3e74 100644
--- a/application/models/Dxcc.php
+++ b/application/models/Dxcc.php
@@ -168,11 +168,23 @@ class DXCC extends CI_Model {
$this->db->empty_table($table);
}
+ /*
+ * Fethes a list of all dxcc's, both current and deleted
+ */
function list() {
$this->db->order_by('name', 'ASC');
return $this->db->get('dxcc_entities');
}
+ /*
+ * Fetches a list of all current dxcc's (non-deleted)
+ */
+ function list_current() {
+ $this->db->where('end', null);
+ $this->db->order_by('name', 'ASC');
+ return $this->db->get('dxcc_entities');
+ }
+
function get_dxcc_array($dxccArray, $bands, $postdata) {
$CI =& get_instance();
$CI->load->model('Stations');
diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php
index 745fdcbc..74c96547 100755
--- a/application/models/Logbook_model.php
+++ b/application/models/Logbook_model.php
@@ -1226,46 +1226,84 @@ class Logbook_model extends CI_Model {
}
}
- /* Return total number of countrys worked */
- function total_countrys() {
+ /* Return total number of countries worked */
+ function total_countries() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
- $query = $this->db->query('SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' WHERE COL_COUNTRY != "Invalid" AND station_id = '.$station_id.'');
+ $sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
+ WHERE COL_COUNTRY != "Invalid"
+ AND col_dxcc > 0
+ AND station_id = '.$station_id ;
+
+ $query = $this->db->query($sql);
return $query->num_rows();
}
- /* Return total number of countrys confirmed with paper QSL */
- function total_countrys_confirmed_paper() {
- $CI =& get_instance();
- $CI->load->model('Stations');
- $station_id = $CI->Stations->find_active();
+ /* Return total number of countries worked */
+ function total_countries_current() {
+ $CI =& get_instance();
+ $CI->load->model('Stations');
+ $station_id = $CI->Stations->find_active();
- $query = $this->db->query('SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' WHERE COL_COUNTRY != "Invalid" AND station_id = '.$station_id.' AND COL_QSL_RCVD =\'Y\'');
+ $sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' thcv
+ join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif
+ WHERE COL_COUNTRY != "Invalid"
+ AND dxcc_entities.end is null
+ AND station_id = '.$station_id;
+
+ $query = $this->db->query($sql);
return $query->num_rows();
}
- /* Return total number of countrys confirmed with eQSL */
- function total_countrys_confirmed_eqsl() {
+ /* Return total number of countries confirmed with paper QSL */
+ function total_countries_confirmed_paper() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
- $query = $this->db->query('SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' WHERE COL_COUNTRY != "Invalid" AND station_id = '.$station_id.' AND COL_EQSL_QSL_RCVD =\'Y\'');
+ $sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
+ WHERE COL_COUNTRY != "Invalid"
+ AND COL_DXCC > 0
+ AND station_id = '.$station_id.' AND COL_QSL_RCVD =\'Y\'';
+
+ $query = $this->db->query($sql);
return $query->num_rows();
}
- /* Return total number of countrys confirmed with LoTW */
- function total_countrys_confirmed_lotw() {
+ /* Return total number of countries confirmed with eQSL */
+ function total_countries_confirmed_eqsl() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
- $query = $this->db->query('SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' WHERE COL_COUNTRY != "Invalid" AND station_id = '.$station_id.' AND COL_LOTW_QSL_RCVD =\'Y\'');
+ $sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
+ WHERE COL_COUNTRY != "Invalid"
+ AND COL_DXCC > 0
+ AND station_id = '.$station_id.' AND COL_EQSL_QSL_RCVD =\'Y\'';
+
+ $query = $this->db->query($sql);
+
+ return $query->num_rows();
+ }
+
+ /* Return total number of countries confirmed with LoTW */
+ function total_countries_confirmed_lotw() {
+ $CI =& get_instance();
+ $CI->load->model('Stations');
+ $station_id = $CI->Stations->find_active();
+
+ $sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
+ WHERE COL_COUNTRY != "Invalid"
+ AND COL_DXCC > 0
+ AND station_id = '.$station_id.'
+ AND COL_LOTW_QSL_RCVD =\'Y\'';
+
+ $query = $this->db->query($sql);
return $query->num_rows();
}
diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php
index 637ca3c2..08603d66 100644
--- a/application/views/dashboard/index.php
+++ b/application/views/dashboard/index.php
@@ -119,20 +119,20 @@
lang->line('general_word_worked'); ?> |
- |
+ |
lang->line('general_word_confirmed'); ?> |
- /
- /
-
+ /
+ /
+
|
lang->line('general_word_needed'); ?> |
- |
+ |
diff --git a/application/views/view_log/partial/log.php b/application/views/view_log/partial/log.php
index 272e3944..b21ef4aa 100644
--- a/application/views/view_log/partial/log.php
+++ b/application/views/view_log/partial/log.php
@@ -1,5 +1,5 @@
-
+
Date |
config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?>
diff --git a/application/views/view_log/partial/log_ajax.php b/application/views/view_log/partial/log_ajax.php
index 1b895f79..6532976e 100644
--- a/application/views/view_log/partial/log_ajax.php
+++ b/application/views/view_log/partial/log_ajax.php
@@ -1,5 +1,5 @@
-
+
Date |
config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?>