diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index e26b82c35..87af9d774 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -274,7 +274,10 @@ class Awards extends CI_Controller { public function was() { $this->load->model('was'); + $this->load->model('modes'); + $data['worked_bands'] = $this->was->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. if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands @@ -297,6 +300,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; @@ -305,10 +309,11 @@ class Awards extends CI_Controller { $postdata['confirmed'] = 1; $postdata['notworked'] = 1; $postdata['band'] = 'All'; + $postdata['mode'] = 'All'; } $data['was_array'] = $this->was->get_was_array($bands, $postdata); - $data['was_summary'] = $this->was->get_was_summary($bands); + $data['was_summary'] = $this->was->get_was_summary($data['worked_bands']); // Render Page $data['page_title'] = "Awards - WAS (Worked All States)"; @@ -467,24 +472,23 @@ class Awards extends CI_Controller { /* function was_map - This displays the WAS map and requires the $band_type + This displays the WAS map and requires the $band_type and $mode_type */ - public function was_map($band_type) { + public function was_map($band_type, $mode_type) { $this->load->model('was'); - $data['worked_bands'] = $this->was->get_worked_bands(); + + $data['mode'] = $mode_type; $bands[] = $band_type; - $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view - $postdata['lotw'] = 1; $postdata['qsl'] = 1; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; $postdata['band'] = $band_type; - + $postdata['mode'] = $mode_type; $data['was_array'] = $this->was->get_was_array($bands, $postdata); diff --git a/application/models/Was.php b/application/models/Was.php index c6e76394b..0d98cdd39 100644 --- a/application/models/Was.php +++ b/application/models/Was.php @@ -87,14 +87,14 @@ class was extends CI_Model { if ($postdata['worked'] != NULL) { $wasBand = $this->getWasWorked($station_id, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = '
'; + $bandWas[$line->col_state][$band] = ''; $states[$line->col_state]['count']++; } } if ($postdata['confirmed'] != NULL) { $wasBand = $this->getWasConfirmed($station_id, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = ''; + $bandWas[$line->col_state][$band] = ''; $states[$line->col_state]['count']++; } } @@ -211,6 +211,10 @@ class was extends CI_Model { $sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv where station_id = " . $station_id; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + $sql .= $this->addStateToQuery(); $sql .= $this->addBandToQuery($band); @@ -219,6 +223,10 @@ class was extends CI_Model { " where station_id = ". $station_id . " and col_state = thcv.col_state"; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + $sql .= $this->addBandToQuery($band); $sql .= $this->addQslToQuery($postdata); @@ -240,6 +248,10 @@ class was extends CI_Model { $sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv where station_id = " . $station_id; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + $sql .= $this->addStateToQuery(); $sql .= $this->addBandToQuery($band); diff --git a/application/views/awards/was/index.php b/application/views/awards/was/index.php index 5531b8f3a..904346f84 100644 --- a/application/views/awards/was/index.php +++ b/application/views/awards/was/index.php @@ -5,7 +5,6 @@