Update distance on change of locator

这个提交包含在:
phl0 2023-06-15 18:15:29 +02:00
父节点 11efa6b03a
当前提交 386e0977e9
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A
共有 2 个文件被更改,包括 33 次插入0 次删除

查看文件

@ -952,6 +952,36 @@ class Logbook extends CI_Controller {
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 */
function bearing($locator, $unit = 'M', $station_id = null) {
$this->load->library('Qra');

查看文件

@ -711,6 +711,9 @@ $("#locator").keyup(function(){
})
$('#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;
});
}
}
});