[SIG Award] Updated code to support station logbooks

pull/1158/head
Andreas 2021-09-09 22:29:59 +02:00
rodzic a6422fa341
commit 5cfa97af8a
3 zmienionych plików z 17 dodań i 14 usunięć

Wyświetl plik

@ -477,7 +477,7 @@ class Awards extends CI_Controller {
ini_set('memory_limit', '-1');
$this->load->model('adif_data');
//$type = str_replace('"', "", $this->input->get("type"));
$type = $this->uri->segment(3);
$data['qsos'] = $this->adif_data->sig_all($type);

Wyświetl plik

@ -128,12 +128,13 @@ class adif_data extends CI_Model {
}
function sig_all($type) {
$this->load->model('stations');
$active_station_id = $this->stations->find_active();
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*');
$this->db->from($this->config->item('table_name'));
$this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
$this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array);
$this->db->where($this->config->item('table_name').'.COL_SIG', $type);
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");

Wyświetl plik

@ -6,27 +6,29 @@ class Sig extends CI_Model {
{
parent::__construct();
}
function get_all($type) {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->where("station_id", $station_id);
$this->db->where_in("station_id", $logbooks_locations_array);
$this->db->order_by("COL_SIG_INFO", "ASC");
$this->db->where('COL_SIG =', $type);
return $this->db->get($this->config->item('table_name'));
}
function get_all_sig_types() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$sql = "select col_sig, count(*) qsos, count(distinct col_sig_info) refs from " . $this->config->item('table_name') .
" where col_sig <> ''" .
" and station_id = " . $station_id .
" and station_id in (" . $location_list . ")" .
" group by col_sig";
$query = $this->db->query($sql);
@ -37,4 +39,4 @@ class Sig extends CI_Model {
}
?>
?>