diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 625a9ca6..e2cc746e 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -235,13 +235,11 @@ class Awards extends CI_Controller { $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)."'"; - $this->load->model('cq'); $this->load->model('modes'); $this->load->model('bands'); - $data['worked_bands'] = $this->bands->get_worked_bands($location_list); + $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. @@ -277,8 +275,15 @@ class Awards extends CI_Controller { $postdata['mode'] = 'All'; } - $data['cq_array'] = $this->cq->get_cq_array($bands, $postdata, $location_list); - $data['cq_summary'] = $this->cq->get_cq_summary($data['worked_bands'], $location_list); + if ($logbooks_locations_array) { + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $data['cq_array'] = $this->cq->get_cq_array($bands, $postdata, $location_list); + $data['cq_summary'] = $this->cq->get_cq_summary($data['worked_bands'], $location_list); + } else { + $location_list = null; + $data['cq_array'] = null; + $data['cq_summary'] = null; + } // Render page $data['page_title'] = "Awards - CQ Magazine"; diff --git a/application/models/Bands.php b/application/models/Bands.php index a30c34b8..69d4ee48 100644 --- a/application/models/Bands.php +++ b/application/models/Bands.php @@ -31,6 +31,10 @@ class Bands extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return array(); + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; // get all worked slots from database @@ -67,6 +71,9 @@ class Bands extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return array(); + } $location_list = "'".implode("','",$logbooks_locations_array)."'"; // get all worked slots from database @@ -93,6 +100,10 @@ class Bands extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return array(); + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; // get all worked sats from database @@ -113,6 +124,10 @@ class Bands extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return array(); + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; // get all worked slots from database diff --git a/application/models/Counties.php b/application/models/Counties.php index fa7241f5..d30408ed 100644 --- a/application/models/Counties.php +++ b/application/models/Counties.php @@ -27,6 +27,10 @@ class Counties extends CI_Model $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = "select count(distinct COL_CNTY) countycountworked, coalesce(x.countycountconfirmed, 0) countycountconfirmed, thcv.COL_STATE @@ -75,6 +79,10 @@ class Counties extends CI_Model $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = "select distinct COL_CNTY, COL_STATE diff --git a/application/models/Dok.php b/application/models/Dok.php index 333e87c6..3ebef32f 100644 --- a/application/models/Dok.php +++ b/application/models/Dok.php @@ -7,6 +7,10 @@ class DOK extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $this->load->model('bands'); $location_list = "'".implode("','",$logbooks_locations_array)."'"; diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index 24cf79e6..7062add8 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -63,6 +63,10 @@ class DXCC extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; foreach ($bands as $band) { // Looping through bands and entities to generate the array needed for display @@ -193,6 +197,10 @@ class DXCC extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = "select adif, prefix, name, date(end) Enddate, date(start) Startdate @@ -387,6 +395,10 @@ class DXCC extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; foreach ($bands as $band) { diff --git a/application/models/Iota.php b/application/models/Iota.php index 98b31fb4..f005ad44 100644 --- a/application/models/Iota.php +++ b/application/models/Iota.php @@ -7,6 +7,10 @@ class IOTA extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; foreach ($bands as $band) { // Looping through bands and iota to generate the array needed for display @@ -279,6 +283,10 @@ class IOTA extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; foreach ($bands as $band) { diff --git a/application/models/Sig.php b/application/models/Sig.php index 35f8f850..fdbb01af 100644 --- a/application/models/Sig.php +++ b/application/models/Sig.php @@ -7,6 +7,10 @@ class Sig extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $this->db->where_in("station_id", $logbooks_locations_array); $this->db->order_by("COL_SIG_INFO", "ASC"); $this->db->where('COL_SIG =', $type); @@ -19,6 +23,10 @@ class Sig extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = "select col_sig, count(*) qsos, count(distinct col_sig_info) refs from " . $this->config->item('table_name') . diff --git a/application/models/Sota.php b/application/models/Sota.php index 6f8a8927..d279ba18 100644 --- a/application/models/Sota.php +++ b/application/models/Sota.php @@ -7,6 +7,10 @@ class Sota extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $this->db->where_in("station_id", $logbooks_locations_array); $this->db->order_by("COL_SOTA_REF", "ASC"); $this->db->where('COL_SOTA_REF !=', ''); diff --git a/application/models/Vucc.php b/application/models/Vucc.php index 536c3731..58df2013 100644 --- a/application/models/Vucc.php +++ b/application/models/Vucc.php @@ -87,6 +87,10 @@ class VUCC extends CI_Model $vuccArray['All']['worked'] = count($totalGridWorked); $vuccArray['All']['confirmed'] = count($totalGridConfirmed); + if ($vuccArray['All']['worked'] == 0) { + return null; + } + return $vuccArray; } @@ -100,6 +104,10 @@ class VUCC extends CI_Model $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = "select col_vucc_grids @@ -140,6 +148,10 @@ class VUCC extends CI_Model $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = "select distinct upper(substring(col_gridsquare, 1, 4)) gridsquare diff --git a/application/models/Was.php b/application/models/Was.php index 99371ec2..ff459e99 100644 --- a/application/models/Was.php +++ b/application/models/Was.php @@ -9,7 +9,11 @@ class was extends CI_Model { $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)."'"; + if (!$logbooks_locations_array) { + return null; + } + + $location_list = "'".implode("','",$logbooks_locations_array)."'"; $stateArray = explode(',', $this->stateString); @@ -82,6 +86,10 @@ class was extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; foreach ($bands as $band) { diff --git a/application/views/awards/counties/index.php b/application/views/awards/counties/index.php index bd2a7f9a..5017bbba 100644 --- a/application/views/awards/counties/index.php +++ b/application/views/awards/counties/index.php @@ -29,5 +29,8 @@ - + ×Nothing found!'; + } + ?> \ No newline at end of file diff --git a/application/views/awards/dok/index.php b/application/views/awards/dok/index.php index f967d446..6db1c9ef 100644 --- a/application/views/awards/dok/index.php +++ b/application/views/awards/dok/index.php @@ -3,6 +3,10 @@
| DOKs ()@@ -33,5 +37,7 @@ |