diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 227e5c2c..1c26e734 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -483,6 +483,15 @@ class QSO extends CI_Controller { echo $this->wwff->info($wwff); } + public function get_station_power() { + $this->load->model('stations'); + $stationProfile = xss_clean($this->input->post('stationProfile')); + $data = array('station_power' => $this->stations->get_station_power($stationProfile)); + + header('Content-Type: application/json'); + echo json_encode($data); + } + function check_locator($grid) { $grid = $this->input->post('locator'); // Allow empty locator diff --git a/application/models/Stations.php b/application/models/Stations.php index 7ec18842..48c7001b 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -75,6 +75,7 @@ class Stations extends CI_Model { 'station_sig' => xss_clean(strtoupper($this->input->post('sig', true))), 'station_sig_info' => xss_clean(strtoupper($this->input->post('sig_info', true))), 'station_callsign' => xss_clean($this->input->post('station_callsign', true)), + 'station_power' => xss_clean($this->input->post('station_power', true)), 'station_dxcc' => xss_clean($this->input->post('dxcc', true)), 'station_cnty' => xss_clean($this->input->post('station_cnty', true)), 'station_cq' => xss_clean($this->input->post('station_cq', true)), @@ -107,6 +108,7 @@ class Stations extends CI_Model { 'station_sig' => xss_clean($this->input->post('sig', true)), 'station_sig_info' => xss_clean($this->input->post('sig_info', true)), 'station_callsign' => xss_clean($this->input->post('station_callsign', true)), + 'station_power' => xss_clean($this->input->post('station_power', true)), 'station_dxcc' => xss_clean($this->input->post('dxcc', true)), 'station_cnty' => xss_clean($this->input->post('station_cnty', true)), 'station_cq' => xss_clean($this->input->post('station_cq', true)), @@ -418,6 +420,21 @@ class Stations extends CI_Model { } return false; } + + public function get_station_power($id) { + $this->db->select('station_power'); + $this->db->where('user_id', $this->session->userdata('user_id')); + $this->db->where('station_id', $id); + $query = $this->db->get('station_profile'); + if($query->num_rows() >= 1) { + foreach ($query->result() as $row) + { + return $row->station_power; + } + } else { + return null; + } + } } ?> diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 938f85e8..a3e7f182 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1084,6 +1084,22 @@ $(document).on('keypress',function(e) { }); + $('#stationProfile').change(function() { + var stationProfile = $('#stationProfile').val(); + console.log("TEST "+stationProfile); + $.ajax({ + url: base_url+'index.php/qso/get_station_power', + type: 'post', + data: {'stationProfile': stationProfile}, + success: function(res) { + $('#transmit_power').val(res.station_power); + }, + error: function() { + $('#transmit_power').val(''); + }, + }); + }); + session->userdata('user_qth_lookup') == 1) { ?> $('#qth').focusout(function() { if ($('#locator').val() === '') { diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 291ea49d..6410760f 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -156,8 +156,11 @@
@@ -203,7 +206,7 @@
- + lang->line('qso_transmit_power_helptext'); ?>
diff --git a/application/views/station_profile/create.php b/application/views/station_profile/create.php index ad2fe1ff..78026b5f 100644 --- a/application/views/station_profile/create.php +++ b/application/views/station_profile/create.php @@ -40,6 +40,12 @@ Station callsign. For example: 2M0SQL/P +
+ + + Default station power. Overwritten by CAT. +
+
num_rows() > 0) { ?> diff --git a/application/views/station_profile/edit.php b/application/views/station_profile/edit.php index fa2468c2..9ae9c7fb 100644 --- a/application/views/station_profile/edit.php +++ b/application/views/station_profile/edit.php @@ -47,6 +47,12 @@ station_callsign; } ?>" required> Station callsign. For example: 2M0SQL/P
+ +
+ + station_power; } ?>"> + Default station power. Overwritten by CAT. +