diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 5ffeac2d..f8a11276 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -26,6 +26,7 @@ class QSO extends CI_Controller { $this->load->model('logbook_model'); $this->load->model('user_model'); $this->load->model('modes'); + $this->load->model('bands'); if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } $data['active_station_profile'] = $this->stations->find_active(); @@ -37,6 +38,7 @@ class QSO extends CI_Controller { $data['dxcc'] = $this->logbook_model->fetchDxcc(); $data['iota'] = $this->logbook_model->fetchIota(); $data['modes'] = $this->modes->active(); + $data['bands'] = $this->bands->get_user_bands_for_qso_entry(); $this->load->library('form_validation'); diff --git a/application/models/Bands.php b/application/models/Bands.php index 2015aa57..209aa1a0 100644 --- a/application/models/Bands.php +++ b/application/models/Bands.php @@ -49,6 +49,24 @@ class Bands extends CI_Model { return $results; } + function get_user_bands_for_qso_entry() { + $this->db->from('bands'); + $this->db->join('bandxuser', 'bandxuser.bandid = bands.id'); + $this->db->where('bandxuser.userid', $this->session->userdata('user_id')); + $this->db->where('bandxuser.active', 1); + $this->db->where('bands.bandgroup != "sat"'); + + $result = $this->db->get()->result(); + + $results = array(); + + foreach($result as $band) { + $results[$band->bandgroup][] = $band->band; + } + + return $results; + } + function get_all_bands_for_user() { $this->db->from('bands'); $this->db->join('bandxuser', 'bandxuser.bandid = bands.id'); diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 24949967..30e1fe6d 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -91,38 +91,16 @@ @@ -208,38 +186,16 @@