Merge pull request #1286 from Werzi2001/version_2_dashboard_todos

Version 2 dashboard todos
这个提交包含在:
Peter Goodhall 2021-11-14 11:58:27 +00:00 提交者 GitHub
当前提交 454b3b96f3
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23

查看文件

@ -1319,70 +1319,78 @@ class Logbook_model extends CI_Model {
/* Return total number of QSL Cards sent */ /* Return total number of QSL Cards sent */
function total_qsl_sent() { function total_qsl_sent() {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('logbooks_model');
$station_id = $CI->Stations->find_active(); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$query = $this->db->query('SELECT count(COL_QSL_SENT) AS count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_QSL_SENT = "Y"'); $this->db->select('count(COL_QSL_SENT) AS count');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_QSL_SENT =', 'Y');
$row = $query->row(); $query = $this->db->get($this->config->item('table_name'));
if($row == null) { $row = $query->row();
return 0;
} else { if($row == null) {
return $row->count; return 0;
} } else {
return $row->count;
}
} }
/* Return total number of QSL Cards requested for printing - that means "requested" or "queued" */ /* Return total number of QSL Cards requested for printing - that means "requested" or "queued" */
function total_qsl_requested() { function total_qsl_requested() {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('logbooks_model');
$station_id = $CI->Stations->find_active(); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$query = $this->db->query('SELECT count(COL_QSL_SENT) AS count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_QSL_SENT in ("Q", "R")'); $this->db->select('count(COL_QSL_SENT) AS count');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where_in('COL_QSL_SENT', array('Q', 'R'));
$row = $query->row(); $query = $this->db->get($this->config->item('table_name'));
if($row == null) { $row = $query->row();
return 0;
} else { if($row == null) {
return $row->count; return 0;
} } else {
return $row->count;
}
} }
/* Return total number of QSL Cards received */ /* Return total number of QSL Cards received */
function total_qsl_recv() { function total_qsl_recv() {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('logbooks_model');
$station_id = $CI->Stations->find_active(); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$query = $this->db->query('SELECT count(COL_QSL_RCVD) AS count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_QSL_RCVD = "Y"'); $this->db->select('count(COL_QSL_RCVD) AS count');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_QSL_RCVD =', 'Y');
$row = $query->row(); $query = $this->db->get($this->config->item('table_name'));
if($row == null) { $row = $query->row();
return 0;
} else { if($row == null) {
return $row->count; return 0;
} } else {
return $row->count;
}
} }
/* Return total number of countries worked */ /* Return total number of countries worked */
function total_countries() { function total_countries() {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('logbooks_model');
$station_id = $CI->Stations->find_active(); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' $this->db->select('DISTINCT (COL_COUNTRY)');
WHERE COL_COUNTRY != "Invalid" $this->db->where_in('station_id', $logbooks_locations_array);
AND col_dxcc > 0 $this->db->where('COL_COUNTRY !=', 'Invalid');
AND station_id = '.$station_id ; $this->db->where('COL_DXCC >', '0');
$query = $this->db->get($this->config->item('table_name'));
$query = $this->db->query($sql);
return $query->num_rows(); return $query->num_rows();
} }
@ -1390,16 +1398,15 @@ class Logbook_model extends CI_Model {
/* Return total number of countries worked */ /* Return total number of countries worked */
function total_countries_current() { function total_countries_current() {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('logbooks_model');
$station_id = $CI->Stations->find_active(); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' thcv $this->db->select('DISTINCT ('.$this->config->item('table_name').'.COL_COUNTRY)');
join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif $this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.col_dxcc');
WHERE COL_COUNTRY != "Invalid" $this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array);
AND dxcc_entities.end is null $this->db->where($this->config->item('table_name').'.COL_COUNTRY !=', 'Invalid');
AND station_id = '.$station_id; $this->db->where('dxcc_entities.end is null');
$query = $this->db->get($this->config->item('table_name'));
$query = $this->db->query($sql);
return $query->num_rows(); return $query->num_rows();
} }
@ -1407,50 +1414,49 @@ class Logbook_model extends CI_Model {
/* Return total number of countries confirmed with paper QSL */ /* Return total number of countries confirmed with paper QSL */
function total_countries_confirmed_paper() { function total_countries_confirmed_paper() {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('logbooks_model');
$station_id = $CI->Stations->find_active(); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' $this->db->select('DISTINCT (COL_COUNTRY)');
WHERE COL_COUNTRY != "Invalid" $this->db->where_in('station_id', $logbooks_locations_array);
AND COL_DXCC > 0 $this->db->where('COL_COUNTRY !=', 'Invalid');
AND station_id = '.$station_id.' AND COL_QSL_RCVD =\'Y\''; $this->db->where('COL_DXCC >', '0');
$this->db->where('COL_QSL_RCVD =', 'Y');
$query = $this->db->get($this->config->item('table_name'));
$query = $this->db->query($sql); return $query->num_rows();
return $query->num_rows();
} }
/* Return total number of countries confirmed with eQSL */ /* Return total number of countries confirmed with eQSL */
function total_countries_confirmed_eqsl() { function total_countries_confirmed_eqsl() {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('logbooks_model');
$station_id = $CI->Stations->find_active(); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' $this->db->select('DISTINCT (COL_COUNTRY)');
WHERE COL_COUNTRY != "Invalid" $this->db->where_in('station_id', $logbooks_locations_array);
AND COL_DXCC > 0 $this->db->where('COL_COUNTRY !=', 'Invalid');
AND station_id = '.$station_id.' AND COL_EQSL_QSL_RCVD =\'Y\''; $this->db->where('COL_DXCC >', '0');
$this->db->where('COL_EQSL_QSL_RCVD =', 'Y');
$query = $this->db->get($this->config->item('table_name'));
$query = $this->db->query($sql); return $query->num_rows();
return $query->num_rows();
} }
/* Return total number of countries confirmed with LoTW */ /* Return total number of countries confirmed with LoTW */
function total_countries_confirmed_lotw() { function total_countries_confirmed_lotw() {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('logbooks_model');
$station_id = $CI->Stations->find_active(); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' $this->db->select('DISTINCT (COL_COUNTRY)');
WHERE COL_COUNTRY != "Invalid" $this->db->where_in('station_id', $logbooks_locations_array);
AND COL_DXCC > 0 $this->db->where('COL_COUNTRY !=', 'Invalid');
AND station_id = '.$station_id.' $this->db->where('COL_DXCC >', '0');
AND COL_LOTW_QSL_RCVD =\'Y\''; $this->db->where('COL_LOTW_QSL_RCVD =', 'Y');
$query = $this->db->get($this->config->item('table_name'));
$query = $this->db->query($sql); return $query->num_rows();
return $query->num_rows();
} }
function api_search_query($query) { function api_search_query($query) {