diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index e33bc816..e26b82c3 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -224,8 +224,10 @@ class Awards extends CI_Controller { $station_id = $CI->Stations->find_active(); $this->load->model('cq'); + $this->load->model('modes'); $data['worked_bands'] = $this->cq->get_worked_bands($station_id); + $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. if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands @@ -248,6 +250,7 @@ class Awards extends CI_Controller { $postdata['confirmed'] = $this->input->post('confirmed'); $postdata['notworked'] = $this->input->post('notworked'); $postdata['band'] = $this->input->post('band'); + $postdata['mode'] = $this->input->post('mode'); } else { // Setting default values at first load of page $postdata['lotw'] = 1; @@ -256,6 +259,7 @@ class Awards extends CI_Controller { $postdata['confirmed'] = 1; $postdata['notworked'] = 1; $postdata['band'] = 'All'; + $postdata['mode'] = 'All'; } $data['cq_array'] = $this->cq->get_cq_array($bands, $postdata, $station_id); diff --git a/application/models/Cq.php b/application/models/Cq.php index a511a222..d193c699 100644 --- a/application/models/Cq.php +++ b/application/models/Cq.php @@ -89,14 +89,14 @@ class CQ extends CI_Model{ if ($postdata['worked'] != NULL) { $cqBand = $this->getCQWorked($station_id, $band, $postdata); foreach ($cqBand as $line) { - $bandCq[$line->col_cqz][$band] = '
col_cqz) . '","' . $band . '","All","CQZone")\'>W
'; + $bandCq[$line->col_cqz][$band] = '
col_cqz) . '","' . $band . '","'. $postdata['mode'] . '","CQZone")\'>W
'; $cqZ[$line->col_cqz]['count']++; } } if ($postdata['confirmed'] != NULL) { $cqBand = $this->getCQConfirmed($station_id, $band, $postdata); foreach ($cqBand as $line) { - $bandCq[$line->col_cqz][$band] = '
col_cqz) . '","' . $band . '","All","CQZone")\'>C
'; + $bandCq[$line->col_cqz][$band] = '
col_cqz) . '","' . $band . '","'. $postdata['mode'] . '","CQZone")\'>C
'; $cqZ[$line->col_cqz]['count']++; } } @@ -141,12 +141,20 @@ class CQ extends CI_Model{ $sql = "SELECT distinct col_cqz FROM " . $this->config->item('table_name') . " thcv where station_id = " . $station_id . " and col_cqz <> ''"; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + $sql .= $this->addBandToQuery($band); $sql .= " and not exists (select 1 from " . $this->config->item('table_name') . " where station_id = " . $station_id . " and col_cqz = thcv.col_cqz and col_cqz <> '' "; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + $sql .= $this->addBandToQuery($band); $sql .= $this->addQslToQuery($postdata); @@ -166,6 +174,10 @@ class CQ extends CI_Model{ $sql = "SELECT distinct col_cqz FROM " . $this->config->item('table_name') . " thcv where station_id = " . $station_id . " and col_cqz <> ''"; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + $sql .= $this->addBandToQuery($band); $sql .= $this->addQslToQuery($postdata); diff --git a/application/views/awards/cq/index.php b/application/views/awards/cq/index.php index 7e95dbb8..85031bb1 100644 --- a/application/views/awards/cq/index.php +++ b/application/views/awards/cq/index.php @@ -115,11 +115,10 @@ -
-
- +
+ +
+ +
+
+