Update distance on change of locator
这个提交包含在:
父节点
11efa6b03a
当前提交
386e0977e9
共有 2 个文件被更改,包括 33 次插入 和 0 次删除
|
|
@ -952,6 +952,36 @@ class Logbook extends CI_Controller {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* return distance */
|
||||||
|
function searchdistance($locator, $station_id = null) {
|
||||||
|
$this->load->library('Qra');
|
||||||
|
|
||||||
|
if($locator != null) {
|
||||||
|
if (isset($station_id)) {
|
||||||
|
// be sure that station belongs to user
|
||||||
|
$this->load->model('Stations');
|
||||||
|
if (!$this->Stations->check_station_is_accessible($station_id)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get station profile
|
||||||
|
$station_profile = $this->Stations->profile_clean($station_id);
|
||||||
|
|
||||||
|
// get locator
|
||||||
|
$mylocator = $station_profile->station_gridsquare;
|
||||||
|
} else if($this->session->userdata('user_locator') != null){
|
||||||
|
$mylocator = $this->session->userdata('user_locator');
|
||||||
|
} else {
|
||||||
|
$mylocator = $this->config->item('locator');
|
||||||
|
}
|
||||||
|
|
||||||
|
$distance = $this->qra->distance($mylocator, $locator, 'K');
|
||||||
|
|
||||||
|
echo round($distance, 0);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* return station bearing */
|
/* return station bearing */
|
||||||
function bearing($locator, $unit = 'M', $station_id = null) {
|
function bearing($locator, $unit = 'M', $station_id = null) {
|
||||||
$this->load->library('Qra');
|
$this->load->library('Qra');
|
||||||
|
|
|
||||||
|
|
@ -711,6 +711,9 @@ $("#locator").keyup(function(){
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#locator_info').load("logbook/searchbearing/" + $(this).val() + "/" + $('#stationProfile').val()).fadeIn("slow");
|
$('#locator_info').load("logbook/searchbearing/" + $(this).val() + "/" + $('#stationProfile').val()).fadeIn("slow");
|
||||||
|
$.get('logbook/searchdistance/' + $(this).val() + "/" + $('#stationProfile').val(), function(result) {
|
||||||
|
document.getElementById("distance").value = result;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用