diff --git a/application/models/Cq.php b/application/models/Cq.php index d75f22c5..a47a9907 100644 --- a/application/models/Cq.php +++ b/application/models/Cq.php @@ -9,10 +9,14 @@ class CQ extends CI_Model{ function get_zones(){ + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); + $data = $this->db->query( "select COL_CQZ, count(COL_CQZ) from ".$this->config->item('table_name')." - where COL_CQZ is not null + where COL_CQZ is not null and station_id = ".$station_id." group by COL_CQZ order by COL_CQZ" ); diff --git a/application/models/Dok.php b/application/models/Dok.php index 271b8370..4e7618a8 100644 --- a/application/models/Dok.php +++ b/application/models/Dok.php @@ -30,9 +30,13 @@ class DOK extends CI_Model { } function get_worked_bands() { + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); + // get all worked slots from database $data = $this->db->query( - "SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 " + "SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id = ".$station_id." AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 " ); $worked_slots = array(); foreach($data->result() as $row){ @@ -51,10 +55,13 @@ class DOK extends CI_Model { } function show_stats(){ + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); $data = $this->db->query( "select upper(COL_DARC_DOK) as COL_DARC_DOK, COL_MODE, lcase(COL_BAND) as COL_BAND, count(COL_DARC_DOK) as cnt - from ".$this->config->item('table_name')." WHERE COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 + from ".$this->config->item('table_name')." WHERE station_id = ".$station_id." AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 group by COL_DARC_DOK, COL_MODE, COL_BAND" ); diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index 4cf8052e..232c52a5 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -27,12 +27,17 @@ class DXCC extends CI_Model { { // Call the Model constructor parent::__construct(); + } function get_worked_bands() { + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); + // get all worked slots from database $data = $this->db->query( - "SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."`" + "SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id = ".$station_id."" ); $worked_slots = array(); foreach($data->result() as $row){ @@ -51,10 +56,14 @@ class DXCC extends CI_Model { } function show_stats(){ + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); $data = $this->db->query( "select COL_COUNTRY, COL_MODE, lcase(COL_BAND) as COL_BAND, count(COL_COUNTRY) as cnt - from ".$this->config->item('table_name')." + from ".$this->config->item('table_name')." + where station_id = ".$station_id." group by COL_COUNTRY, COL_MODE, COL_BAND" ); diff --git a/application/models/Sota.php b/application/models/Sota.php index 9088115a..9cb885de 100644 --- a/application/models/Sota.php +++ b/application/models/Sota.php @@ -8,6 +8,11 @@ class Sota extends CI_Model { } function get_all() { + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); + + $this->db->where("station_id", $station_id); $this->db->order_by("COL_SOTA_REF", "ASC"); $this->db->where('COL_SOTA_REF !=', ''); diff --git a/application/models/Wab.php b/application/models/Wab.php index f4d26d2b..14223a2d 100644 --- a/application/models/Wab.php +++ b/application/models/Wab.php @@ -5,9 +5,15 @@ class Wab extends CI_Model { function __construct() { parent::__construct(); + } function get_all() { + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); + + $this->db->where("station_id", $station_id); $this->db->order_by("COL_COMMENT", "ASC"); $this->db->like('COL_COMMENT', 'WAB:'); diff --git a/application/models/Wacral.php b/application/models/Wacral.php index bbe5cf9e..1f0bfcd2 100644 --- a/application/models/Wacral.php +++ b/application/models/Wacral.php @@ -13,6 +13,11 @@ class Wacral extends CI_Model { } function get_all() { + $CI =& get_instance(); + $CI->load->model('Stations'); + $station_id = $CI->Stations->find_active(); + + $this->db->where("station_id", $station_id); $this->db->order_by("COL_COMMENT", "ASC"); $this->db->like('COL_COMMENT', 'WACRAL:');