mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #1708 from phl0/panMapSttaionProfileSelect
Pan map on station profile select
This commit is contained in:
@@ -171,4 +171,13 @@ class Station extends CI_Controller
|
||||
redirect('stationsetup');
|
||||
}
|
||||
|
||||
public function stationProfileCoords($id) {
|
||||
$id = $this->security->xss_clean($id);
|
||||
$this->load->model('stations');
|
||||
if ($this->stations->check_station_is_accessible($id)) {
|
||||
$coords = $this->stations->lookupProfileCoords($id);
|
||||
print json_encode($coords);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -601,6 +601,21 @@ class Stations extends CI_Model {
|
||||
if (($station_lat!=0)&&($station_lng!=0)) { $_jsonresult = array('lat'=>$station_lat,'lng'=>$station_lng,'html'=>$station_active->station_gridsquare,'label'=>$station_active->station_profile_name,'icon'=>'stationIcon'); }
|
||||
return (count($_jsonresult)>0)?(array('station'=>$_jsonresult)):array();
|
||||
}
|
||||
|
||||
public function lookupProfileCoords($stationid) {
|
||||
$sql = "SELECT station_gridsquare FROM station_profile WHERE station_id = ?;";
|
||||
$query = $this->db->query($sql, $stationid);
|
||||
if ($query->num_rows() == 1) {
|
||||
$row = $query->row();
|
||||
if ($row->station_gridsquare != '') {
|
||||
if (!$this->load->is_loaded('Qra')) {
|
||||
$this->load->library('Qra');
|
||||
}
|
||||
return $this->qra->qra2latlong($row->station_gridsquare);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -305,7 +305,7 @@
|
||||
<div class="tab-pane fade" id="station" role="tabpanel" aria-labelledby="station-tab">
|
||||
<div class="mb-3">
|
||||
<label for="stationProfile"><?= __("Station Location"); ?></label>
|
||||
<select id="stationProfile" class="form-select" name="station_profile">
|
||||
<select id="stationProfile" class="form-select" name="station_profile" onChange="panMap(this.value);">
|
||||
<?php
|
||||
$power = '';
|
||||
foreach ($stations->result() as $stationrow) {
|
||||
|
||||
@@ -506,6 +506,7 @@ $('#btn_fullreset').on("click", function () {
|
||||
|
||||
function reset_to_default() {
|
||||
reset_fields();
|
||||
panMap(activeStationId);
|
||||
$("#stationProfile").val(activeStationId);
|
||||
$("#selectPropagation").val("");
|
||||
$("#frequency_rx").val("");
|
||||
@@ -1254,6 +1255,22 @@ function testTimeOffConsistency() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function panMap(stationProfileIndex) {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/station/stationProfileCoords/'+stationProfileIndex,
|
||||
type: 'get',
|
||||
success: function(data) {
|
||||
result = JSON.parse(data);
|
||||
if (typeof result[0] !== "undefined" && typeof result[1] !== "undefined") {
|
||||
mymap.panTo([result[0], result[1]]);
|
||||
pos = result;
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
qrg_inputtype();
|
||||
clearTimeout();
|
||||
|
||||
Reference in New Issue
Block a user