kopia lustrzana https://github.com/magicbug/Cloudlog
Merge pull request #1158 from AndreasK79/sig_station_logbooks
[SIG Award] Updated code to support station logbookspull/1162/head
commit
ab9553883d
|
@ -477,7 +477,7 @@ class Awards extends CI_Controller {
|
||||||
ini_set('memory_limit', '-1');
|
ini_set('memory_limit', '-1');
|
||||||
|
|
||||||
$this->load->model('adif_data');
|
$this->load->model('adif_data');
|
||||||
//$type = str_replace('"', "", $this->input->get("type"));
|
|
||||||
$type = $this->uri->segment(3);
|
$type = $this->uri->segment(3);
|
||||||
$data['qsos'] = $this->adif_data->sig_all($type);
|
$data['qsos'] = $this->adif_data->sig_all($type);
|
||||||
|
|
||||||
|
|
|
@ -128,12 +128,13 @@ class adif_data extends CI_Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sig_all($type) {
|
function sig_all($type) {
|
||||||
$this->load->model('stations');
|
$CI =& get_instance();
|
||||||
$active_station_id = $this->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->select(''.$this->config->item('table_name').'.*, station_profile.*');
|
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*');
|
||||||
$this->db->from($this->config->item('table_name'));
|
$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->where($this->config->item('table_name').'.COL_SIG', $type);
|
||||||
|
|
||||||
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
|
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
|
||||||
|
|
|
@ -6,27 +6,29 @@ class Sig extends CI_Model {
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_all($type) {
|
function get_all($type) {
|
||||||
$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'));
|
||||||
|
|
||||||
$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->order_by("COL_SIG_INFO", "ASC");
|
||||||
$this->db->where('COL_SIG =', $type);
|
$this->db->where('COL_SIG =', $type);
|
||||||
|
|
||||||
return $this->db->get($this->config->item('table_name'));
|
return $this->db->get($this->config->item('table_name'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_all_sig_types() {
|
function get_all_sig_types() {
|
||||||
$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'));
|
||||||
|
|
||||||
|
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||||
|
|
||||||
$sql = "select col_sig, count(*) qsos, count(distinct col_sig_info) refs from " . $this->config->item('table_name') .
|
$sql = "select col_sig, count(*) qsos, count(distinct col_sig_info) refs from " . $this->config->item('table_name') .
|
||||||
" where col_sig <> ''" .
|
" where col_sig <> ''" .
|
||||||
" and station_id = " . $station_id .
|
" and station_id in (" . $location_list . ")" .
|
||||||
" group by col_sig";
|
" group by col_sig";
|
||||||
|
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
|
@ -37,4 +39,4 @@ class Sig extends CI_Model {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Ładowanie…
Reference in New Issue