From 939434090d97b1f07450a5cfd23b403a4fe0668b Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Sat, 13 Nov 2021 15:55:17 +0100 Subject: [PATCH] [Bands] Consolidated get_worked_bands to it's own model. This will make it easier to have everything in one place, and perhaps also move bands to db. --- application/controllers/Accumulated.php | 4 +- application/controllers/Awards.php | 20 +++- application/controllers/Distances.php | 6 +- application/controllers/Dxatlas.php | 4 +- application/controllers/Kml.php | 4 +- application/controllers/Lookup.php | 3 +- application/controllers/Map.php | 4 +- application/controllers/Timeline.php | 3 +- application/controllers/Timeplotter.php | 4 +- application/models/Accumulate_model.php | 58 +-------- application/models/Bands.php | 145 +++++++++++++++++++++++ application/models/Cq.php | 52 -------- application/models/Distances_model.php | 67 ----------- application/models/Dok.php | 52 +------- application/models/Dxcc.php | 59 --------- application/models/Iota.php | 59 +-------- application/models/Lookup_model.php | 55 --------- application/models/Timeline_model.php | 60 +--------- application/models/Timeplotter_model.php | 56 --------- application/models/Vucc.php | 59 --------- application/models/Was.php | 57 --------- 21 files changed, 182 insertions(+), 649 deletions(-) create mode 100644 application/models/Bands.php diff --git a/application/controllers/Accumulated.php b/application/controllers/Accumulated.php index c299d4bf..152d5abf 100644 --- a/application/controllers/Accumulated.php +++ b/application/controllers/Accumulated.php @@ -16,9 +16,9 @@ class Accumulated extends CI_Controller { // Render Page $data['page_title'] = "Accumulated Statistics"; - $this->load->model('Accumulate_model'); + $this->load->model('bands'); - $data['worked_bands'] = $this->Accumulate_model->get_worked_bands(); + $data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select $this->load->model('modes'); diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 5e3550d1..625a9ca6 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -28,8 +28,11 @@ class Awards extends CI_Controller { public function dok () { $this->load->model('dok'); + $this->load->model('bands'); + $data['doks'] = $this->dok->show_stats(); - $data['worked_bands'] = $this->dok->get_worked_bands(); + + $data['worked_bands'] = $this->bands->get_worked_bands_dok(); // Used in the view for band select // Render Page $data['page_title'] = "Awards - DOK"; @@ -75,8 +78,9 @@ class Awards extends CI_Controller { public function dxcc () { $this->load->model('dxcc'); $this->load->model('modes'); + $this->load->model('bands'); - $data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select + $data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select $data['modes'] = $this->modes->active(); // Used in the view for mode select if ($this->input->post('band') != NULL) { // Band is not set when page first loads. @@ -141,7 +145,8 @@ class Awards extends CI_Controller { public function vucc() { $this->load->model('vucc'); - $data['worked_bands'] = $this->vucc->get_worked_bands(); + $this->load->model('bands'); + $data['worked_bands'] = $this->bands->get_worked_bands(); $data['vucc_array'] = $this->vucc->get_vucc_array($data); @@ -234,8 +239,9 @@ class Awards extends CI_Controller { $this->load->model('cq'); $this->load->model('modes'); + $this->load->model('bands'); - $data['worked_bands'] = $this->cq->get_worked_bands($location_list); + $data['worked_bands'] = $this->bands->get_worked_bands($location_list); $data['modes'] = $this->modes->active(); // Used in the view for mode select if ($this->input->post('band') != NULL) { // Band is not set when page first loads. @@ -284,8 +290,9 @@ class Awards extends CI_Controller { public function was() { $this->load->model('was'); $this->load->model('modes'); + $this->load->model('bands'); - $data['worked_bands'] = $this->was->get_worked_bands(); + $data['worked_bands'] = $this->bands->get_worked_bands(); $data['modes'] = $this->modes->active(); // Used in the view for mode select if ($this->input->post('band') != NULL) { // Band is not set when page first loads. @@ -334,8 +341,9 @@ class Awards extends CI_Controller { public function iota () { $this->load->model('iota'); $this->load->model('modes'); + $this->load->model('bands'); - $data['worked_bands'] = $this->iota->get_worked_bands(); // Used in the view for band select + $data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select if ($this->input->post('band') != NULL) { // Band is not set when page first loads. if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands diff --git a/application/controllers/Distances.php b/application/controllers/Distances.php index 8c1865f2..812d548c 100644 --- a/application/controllers/Distances.php +++ b/application/controllers/Distances.php @@ -16,9 +16,9 @@ class Distances extends CI_Controller { // Render Page $data['page_title'] = "Distances Worked"; - $this->load->model('Distances_model'); - $data['bands_available'] = $this->Distances_model->get_worked_bands(); - $data['sats_available'] = $this->Distances_model->get_worked_sats(); + $this->load->model('bands'); + $data['bands_available'] = $this->bands->get_worked_bands_distances(); + $data['sats_available'] = $this->bands->get_worked_sats(); $this->load->view('interface_assets/header', $data); $this->load->view('distances/index'); diff --git a/application/controllers/Dxatlas.php b/application/controllers/Dxatlas.php index a749b257..cf290bd2 100644 --- a/application/controllers/Dxatlas.php +++ b/application/controllers/Dxatlas.php @@ -8,12 +8,12 @@ class Dxatlas extends CI_Controller { if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } $this->load->model('modes'); - $this->load->model('dxcc'); $this->load->model('logbook_model'); $this->load->model('stations'); + $this->load->model('bands'); $data['station_profile'] = $this->stations->all(); // Used in the view for station location select - $data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select + $data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select $data['modes'] = $this->modes->active(); // Used in the view for mode select $data['dxcc'] = $this->logbook_model->fetchDxcc(); // Used in the view for dxcc select diff --git a/application/controllers/Kml.php b/application/controllers/Kml.php index e404f6fb..72db490d 100644 --- a/application/controllers/Kml.php +++ b/application/controllers/Kml.php @@ -13,12 +13,12 @@ class Kml extends CI_Controller { { $this->load->model('user_model'); $this->load->model('modes'); - $this->load->model('dxcc'); $this->load->model('logbook_model'); + $this->load->model('bands'); if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } - $data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select + $data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select $data['modes'] = $this->modes->active(); // Used in the view for mode select $data['dxcc'] = $this->logbook_model->fetchDxcc(); // Used in the view for dxcc select diff --git a/application/controllers/Lookup.php b/application/controllers/Lookup.php index d154e9cb..f935cb6d 100644 --- a/application/controllers/Lookup.php +++ b/application/controllers/Lookup.php @@ -34,8 +34,9 @@ class Lookup extends CI_Controller { $location_list = "'".implode("','",$logbooks_locations_array)."'"; $this->load->model('lookup_model'); + $this->load->model('bands'); - $data['bands'] = $this->lookup_model->get_Worked_Bands($location_list); + $data['bands'] = $this->bands->get_worked_bands(); $data['type'] = xss_clean($this->input->post('type')); $data['dxcc'] = xss_clean($this->input->post('dxcc')); diff --git a/application/controllers/Map.php b/application/controllers/Map.php index 94c133c0..bfb47767 100644 --- a/application/controllers/Map.php +++ b/application/controllers/Map.php @@ -34,10 +34,10 @@ class Map extends CI_Controller { function custom() { - $this->load->model('dxcc'); + $this->load->model('bands'); //$this->load->model('modes'); - $data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select + $data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select //$data['modes'] = $this->modes->active(); // Used in the view for mode select if ($this->input->post('band') != NULL) { // Band is not set when page first loads. diff --git a/application/controllers/Timeline.php b/application/controllers/Timeline.php index 879df97b..87321556 100644 --- a/application/controllers/Timeline.php +++ b/application/controllers/Timeline.php @@ -40,11 +40,12 @@ class Timeline extends CI_Controller { } $this->load->model('modes'); + $this->load->model('bands'); $data['modes'] = $this->modes->active(); $data['timeline_array'] = $this->Timeline_model->get_timeline($band, $mode, $award); - $data['worked_bands'] = $this->Timeline_model->get_worked_bands(); + $data['worked_bands'] = $this->bands->get_worked_bands(); $data['bandselect'] = $band; $data['modeselect'] = $mode; diff --git a/application/controllers/Timeplotter.php b/application/controllers/Timeplotter.php index 0857e512..42d3aa84 100644 --- a/application/controllers/Timeplotter.php +++ b/application/controllers/Timeplotter.php @@ -16,9 +16,9 @@ class Timeplotter extends CI_Controller { // Render Page $data['page_title'] = "Timeplotter"; - $this->load->model('Timeplotter_model'); + $this->load->model('bands'); - $data['worked_bands'] = $this->Timeplotter_model->get_worked_bands(); + $data['worked_bands'] = $this->bands->get_worked_bands(); $this->load->model('dxcc'); $data['dxcc_list'] = $this->dxcc->list(); diff --git a/application/models/Accumulate_model.php b/application/models/Accumulate_model.php index 5e659066..1a62ccb6 100644 --- a/application/models/Accumulate_model.php +++ b/application/models/Accumulate_model.php @@ -261,60 +261,4 @@ class Accumulate_model extends CI_Model return $query->result(); } - - function get_worked_bands() { - $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)."'"; - - $data = $this->db->query( - "SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" - ); - $worked_slots = array(); - foreach ($data->result() as $row) { - array_push($worked_slots, $row->COL_BAND); - } - - $SAT_data = $this->db->query( - "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" - ); - - foreach ($SAT_data->result() as $row) { - array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); - } - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach (array_keys($this->bandslots) as $slot) { - if (in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - return $results; - } - - public $bandslots = array("160m" => 0, - "80m" => 0, - "60m" => 0, - "40m" => 0, - "30m" => 0, - "20m" => 0, - "17m" => 0, - "15m" => 0, - "12m" => 0, - "10m" => 0, - "6m" => 0, - "4m" => 0, - "2m" => 0, - "70cm" => 0, - "23cm" => 0, - "13cm" => 0, - "9cm" => 0, - "6cm" => 0, - "3cm" => 0, - "1.25cm" => 0, - "SAT" => 0, - ); -} +} \ No newline at end of file diff --git a/application/models/Bands.php b/application/models/Bands.php new file mode 100644 index 00000000..15abef55 --- /dev/null +++ b/application/models/Bands.php @@ -0,0 +1,145 @@ +0, + "80m"=>0, + "60m"=>0, + "40m"=>0, + "30m"=>0, + "20m"=>0, + "17m"=>0, + "15m"=>0, + "12m"=>0, + "10m"=>0, + "6m" =>0, + "4m" =>0, + "2m" =>0, + "70cm"=>0, + "23cm"=>0, + "13cm"=>0, + "9cm"=>0, + "6cm"=>0, + "3cm"=>0, + "1.25cm"=>0, + "SAT"=>0, + ); + + function __construct() { + // Call the Model constructor + parent::__construct(); + } + + function get_worked_bands() { + $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)."'"; + + // 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 station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" + ); + $worked_slots = array(); + foreach($data->result() as $row){ + array_push($worked_slots, $row->COL_BAND); + } + + $SAT_data = $this->db->query( + "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" + ); + + foreach($SAT_data->result() as $row){ + array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); + } + + + // bring worked-slots in order of defined $bandslots + $results = array(); + foreach(array_keys($this->bandslots) as $slot) { + if(in_array($slot, $worked_slots)) { + array_push($results, $slot); + } + } + + return $results; + } + + function get_worked_bands_distances() { + $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)."'"; + + // get all worked slots from database + $sql = "SELECT distinct LOWER(COL_BAND) as COL_BAND FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ")"; + + $data = $this->db->query($sql); + $worked_slots = array(); + foreach($data->result() as $row){ + array_push($worked_slots, $row->COL_BAND); + } + + // bring worked-slots in order of defined $bandslots + $results = array(); + foreach(array_keys($this->bandslots) as $slot) { + if(in_array($slot, $worked_slots)) { + array_push($results, $slot); + } + } + return $results; + } + + function get_worked_sats() { + $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)."'"; + + // get all worked sats from database + $sql = "SELECT distinct col_sat_name FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") and coalesce(col_sat_name, '') <> '' ORDER BY col_sat_name"; + + $data = $this->db->query($sql); + + $worked_sats = array(); + foreach($data->result() as $row){ + array_push($worked_sats, $row->col_sat_name); + } + + return $worked_sats; + } + + function get_worked_bands_dok() { + $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)."'"; + + // 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 station_id in (" . $location_list . ") AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 " + ); + $worked_slots = array(); + foreach($data->result() as $row){ + array_push($worked_slots, $row->COL_BAND); + } + + + // bring worked-slots in order of defined $bandslots + $results = array(); + foreach(array_keys($this->bandslots) as $slot) { + if(in_array($slot, $worked_slots)) { + array_push($results, $slot); + } + } + return $results; + } + +} + +?> \ No newline at end of file diff --git a/application/models/Cq.php b/application/models/Cq.php index 5edc5941..4fbeb855 100644 --- a/application/models/Cq.php +++ b/application/models/Cq.php @@ -22,58 +22,6 @@ class CQ extends CI_Model{ return $data->result(); } - public $bandslots = array("160m" => 0, - "80m" => 0, - "60m" => 0, - "40m" => 0, - "30m" => 0, - "20m" => 0, - "17m" => 0, - "15m" => 0, - "12m" => 0, - "10m" => 0, - "6m" => 0, - "4m" => 0, - "2m" => 0, - "70cm" => 0, - "23cm" => 0, - "13cm" => 0, - "9cm" => 0, - "6cm" => 0, - "3cm" => 0, - "1.25cm" => 0, - "SAT" => 0, - ); - - function get_worked_bands($location_list) - { - // 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 station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" - ); - $worked_slots = array(); - foreach ($data->result() as $row) { - array_push($worked_slots, $row->COL_BAND); - } - - $SAT_data = $this->db->query( - "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" - ); - - foreach ($SAT_data->result() as $row) { - array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); - } - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach (array_keys($this->bandslots) as $slot) { - if (in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - return $results; - } - function get_cq_array($bands, $postdata, $location_list) { $cqZ = array(); // Used for keeping track of which states that are not worked diff --git a/application/models/Distances_model.php b/application/models/Distances_model.php index 7f98b1ca..3ca815ac 100644 --- a/application/models/Distances_model.php +++ b/application/models/Distances_model.php @@ -9,73 +9,6 @@ class Distances_model extends CI_Model parent::__construct(); } - public $bandslots = array("160m"=>0, - "80m"=>0, - "60m"=>0, - "40m"=>0, - "30m"=>0, - "20m"=>0, - "17m"=>0, - "15m"=>0, - "12m"=>0, - "10m"=>0, - "6m" =>0, - "4m" =>0, - "2m" =>0, - "70cm"=>0, - "23cm"=>0, - "13cm"=>0, - "9cm"=>0, - "6cm"=>0, - "3cm"=>0, - "1.25cm"=>0); - - function get_worked_sats() { - $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)."'"; - - // get all worked sats from database - $sql = "SELECT distinct col_sat_name FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") and coalesce(col_sat_name, '') <> '' ORDER BY col_sat_name"; - - $data = $this->db->query($sql); - - $worked_sats = array(); - foreach($data->result() as $row){ - array_push($worked_sats, $row->col_sat_name); - } - - return $worked_sats; - } - - function get_worked_bands() { - $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)."'"; - - // get all worked slots from database - $sql = "SELECT distinct LOWER(COL_BAND) as COL_BAND FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ")"; - - $data = $this->db->query($sql); - $worked_slots = array(); - foreach($data->result() as $row){ - array_push($worked_slots, $row->COL_BAND); - } - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach(array_keys($this->bandslots) as $slot) { - if(in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - return $results; - } - function get_distances($postdata, $measurement_base) { $CI =& get_instance(); diff --git a/application/models/Dok.php b/application/models/Dok.php index 4ff23211..ae8cd390 100644 --- a/application/models/Dok.php +++ b/application/models/Dok.php @@ -2,65 +2,19 @@ class DOK extends CI_Model { - public $bandslots = array("160m"=>0, - "80m"=>0, - "60m"=>0, - "40m"=>0, - "30m"=>0, - "20m"=>0, - "17m"=>0, - "15m"=>0, - "12m"=>0, - "10m"=>0, - "6m" =>0, - "4m" =>0, - "2m" =>0, - "70cm"=>0, - "23cm"=>0, - "13cm"=>0, - "9cm"=>0, - "6cm"=>0, - "3cm"=>0, - "1.25cm"=>0); - function __construct() { // Call the Model constructor parent::__construct(); } - function get_worked_bands() { - $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)."'"; - - // 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 station_id in (" . $location_list . ") AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 " - ); - $worked_slots = array(); - foreach($data->result() as $row){ - array_push($worked_slots, $row->COL_BAND); - } - - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach(array_keys($this->bandslots) as $slot) { - if(in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - return $results; - } - function show_stats() { $CI =& get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('bands'); + $location_list = "'".implode("','",$logbooks_locations_array)."'"; $data = $this->db->query( @@ -74,7 +28,7 @@ class DOK extends CI_Model { foreach($data->result() as $row){ if ($last_dok != $row->COL_DARC_DOK){ // new row - $results[$row->COL_DARC_DOK] = $this->bandslots; + $results[$row->COL_DARC_DOK] = $this->bands->bandslots; $last_dok = $row->COL_DARC_DOK; } diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index a33fb1ea..c4f49572 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -2,29 +2,6 @@ class DXCC extends CI_Model { - public $bandslots = array("160m"=>0, - "80m"=>0, - "60m"=>0, - "40m"=>0, - "30m"=>0, - "20m"=>0, - "17m"=>0, - "15m"=>0, - "12m"=>0, - "10m"=>0, - "6m" =>0, - "4m" =>0, - "2m" =>0, - "70cm"=>0, - "23cm"=>0, - "13cm"=>0, - "9cm"=>0, - "6cm"=>0, - "3cm"=>0, - "1.25cm"=>0, - "SAT"=>0, - ); - function __construct() { // Call the Model constructor @@ -32,42 +9,6 @@ class DXCC extends CI_Model { } - function get_worked_bands() { - $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)."'"; - - // 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 station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" - ); - $worked_slots = array(); - foreach($data->result() as $row){ - array_push($worked_slots, $row->COL_BAND); - } - - $SAT_data = $this->db->query( - "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" - ); - - foreach($SAT_data->result() as $row){ - array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); - } - - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach(array_keys($this->bandslots) as $slot) { - if(in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - - return $results; - } - /** * Function: mostactive * Information: Returns the most active band diff --git a/application/models/Iota.php b/application/models/Iota.php index 493682af..51a47603 100644 --- a/application/models/Iota.php +++ b/application/models/Iota.php @@ -1,70 +1,13 @@ 0, - "80m"=>0, - "60m"=>0, - "40m"=>0, - "30m"=>0, - "20m"=>0, - "17m"=>0, - "15m"=>0, - "12m"=>0, - "10m"=>0, - "6m" =>0, - "4m" =>0, - "2m" =>0, - "70cm"=>0, - "23cm"=>0, - "13cm"=>0, - "9cm"=>0, - "6cm"=>0, - "3cm"=>0, - "1.25cm"=>0, - "SAT"=>0, - ); - + function __construct() { // Call the Model constructor parent::__construct(); } - function get_worked_bands() { - $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)."'"; - - // 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 station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" - ); - $worked_slots = array(); - foreach($data->result() as $row){ - array_push($worked_slots, $row->COL_BAND); - } - - $SAT_data = $this->db->query( - "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" - ); - - foreach($SAT_data->result() as $row){ - array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); - } - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach(array_keys($this->bandslots) as $slot) { - if(in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - return $results; - } - function get_iota_array($iotaArray, $bands, $postdata) { $CI =& get_instance(); $CI->load->model('logbooks_model'); diff --git a/application/models/Lookup_model.php b/application/models/Lookup_model.php index 164d03e9..c60277ba 100644 --- a/application/models/Lookup_model.php +++ b/application/models/Lookup_model.php @@ -124,61 +124,6 @@ class Lookup_model extends CI_Model{ return $query->result(); } - public $bandslots = array("160m" => 0, - "80m" => 0, - "60m" => 0, - "40m" => 0, - "30m" => 0, - "20m" => 0, - "17m" => 0, - "15m" => 0, - "12m" => 0, - "10m" => 0, - "6m" => 0, - "4m" => 0, - "2m" => 0, - "70cm" => 0, - "23cm" => 0, - "13cm" => 0, - "9cm" => 0, - "6cm" => 0, - "3cm" => 0, - "1.25cm" => 0, - "SAT" => 0, - ); - - /* - * Get's the worked bands from the log - */ - function get_worked_bands($location_list) - { - // 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 station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" - ); - $worked_slots = array(); - foreach ($data->result() as $row) { - array_push($worked_slots, $row->COL_BAND); - } - - $SAT_data = $this->db->query( - "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" - ); - - foreach ($SAT_data->result() as $row) { - array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); - } - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach (array_keys($this->bandslots) as $slot) { - if (in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - return $results; - } - /* * Get's the worked modes from the log */ diff --git a/application/models/Timeline_model.php b/application/models/Timeline_model.php index a747a865..0b6973cb 100644 --- a/application/models/Timeline_model.php +++ b/application/models/Timeline_model.php @@ -138,63 +138,5 @@ class Timeline_model extends CI_Model return $query->result(); } - - public $bandslots = array("160m" => 0, - "80m" => 0, - "60m" => 0, - "40m" => 0, - "30m" => 0, - "20m" => 0, - "17m" => 0, - "15m" => 0, - "12m" => 0, - "10m" => 0, - "6m" => 0, - "4m" => 0, - "2m" => 0, - "70cm" => 0, - "23cm" => 0, - "13cm" => 0, - "9cm" => 0, - "6cm" => 0, - "3cm" => 0, - "1.25cm" => 0, - "SAT" => 0, - ); - - function get_worked_bands() - { - $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)."'"; - - // 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 station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" - ); - $worked_slots = array(); - foreach ($data->result() as $row) { - array_push($worked_slots, $row->COL_BAND); - } - - $SAT_data = $this->db->query( - "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" - ); - - foreach ($SAT_data->result() as $row) { - array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); - } - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach (array_keys($this->bandslots) as $slot) { - if (in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - return $results; - } - + } diff --git a/application/models/Timeplotter_model.php b/application/models/Timeplotter_model.php index d15b8b13..1ba2a14a 100644 --- a/application/models/Timeplotter_model.php +++ b/application/models/Timeplotter_model.php @@ -9,62 +9,6 @@ class Timeplotter_model extends CI_Model parent::__construct(); } - function get_worked_bands() { - $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)."'"; - - $data = $this->db->query( - "SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" - ); - $worked_slots = array(); - foreach ($data->result() as $row) { - array_push($worked_slots, $row->COL_BAND); - } - - $SAT_data = $this->db->query( - "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" - ); - - foreach ($SAT_data->result() as $row) { - array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); - } - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach (array_keys($this->bandslots) as $slot) { - if (in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - return $results; - } - - public $bandslots = array("160m" => 0, - "80m" => 0, - "60m" => 0, - "40m" => 0, - "30m" => 0, - "20m" => 0, - "17m" => 0, - "15m" => 0, - "12m" => 0, - "10m" => 0, - "6m" => 0, - "4m" => 0, - "2m" => 0, - "70cm" => 0, - "23cm" => 0, - "13cm" => 0, - "9cm" => 0, - "6cm" => 0, - "3cm" => 0, - "1.25cm" => 0, - "SAT" => 0, - ); - function getTimes($postdata) { $CI =& get_instance(); $CI->load->model('logbooks_model'); diff --git a/application/models/Vucc.php b/application/models/Vucc.php index e64f4996..9046bd79 100644 --- a/application/models/Vucc.php +++ b/application/models/Vucc.php @@ -2,71 +2,12 @@ class VUCC extends CI_Model { - - public $bandslots = array("160m" => 0, - "80m" => 0, - "60m" => 0, - "40m" => 0, - "30m" => 0, - "20m" => 0, - "17m" => 0, - "15m" => 0, - "12m" => 0, - "10m" => 0, - "6m" => 0, - "4m" => 0, - "2m" => 0, - "70cm" => 0, - "23cm" => 0, - "13cm" => 0, - "9cm" => 0, - "6cm" => 0, - "3cm" => 0, - "1.25cm" => 0, - "SAT" => 0, - ); - function __construct() { // Call the Model constructor parent::__construct(); } - function get_worked_bands() - { - $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)."'"; - - // 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 station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" - ); - $worked_slots = array(); - foreach ($data->result() as $row) { - array_push($worked_slots, $row->COL_BAND); - } - - $SAT_data = $this->db->query( - "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" - ); - - foreach ($SAT_data->result() as $row) { - array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); - } - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach (array_keys($this->bandslots) as $slot) { - if (in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - - return $results; - } /* * Fetches worked and confirmed gridsquare on each band and total */ diff --git a/application/models/Was.php b/application/models/Was.php index 91d63b9c..e13cda6d 100644 --- a/application/models/Was.php +++ b/application/models/Was.php @@ -4,69 +4,12 @@ class was extends CI_Model { public $stateString = 'AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY'; - public $bandslots = array("160m"=>0, - "80m"=>0, - "60m"=>0, - "40m"=>0, - "30m"=>0, - "20m"=>0, - "17m"=>0, - "15m"=>0, - "12m"=>0, - "10m"=>0, - "6m" =>0, - "4m" =>0, - "2m" =>0, - "70cm"=>0, - "23cm"=>0, - "13cm"=>0, - "9cm"=>0, - "6cm"=>0, - "3cm"=>0, - "1.25cm"=>0, - "SAT"=>0, - ); - function __construct() { // Call the Model constructor parent::__construct(); } - function get_worked_bands() { - $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)."'"; - - // 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 station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" - ); - $worked_slots = array(); - foreach($data->result() as $row){ - array_push($worked_slots, $row->COL_BAND); - } - - $SAT_data = $this->db->query( - "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" - ); - - foreach($SAT_data->result() as $row){ - array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); - } - - // bring worked-slots in order of defined $bandslots - $results = array(); - foreach(array_keys($this->bandslots) as $slot) { - if(in_array($slot, $worked_slots)) { - array_push($results, $slot); - } - } - return $results; - } - function get_was_array($bands, $postdata) { $CI =& get_instance(); $CI->load->model('logbooks_model');