mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Store distance into QSO table
This commit is contained in:
@@ -128,6 +128,7 @@ class Logbook extends CI_Controller {
|
||||
"dxcc" => false,
|
||||
"callsign_name" => "",
|
||||
"callsign_qra" => "",
|
||||
"callsign_distance" => 0,
|
||||
"callsign_qth" => "",
|
||||
"callsign_iota" => "",
|
||||
"callsign_state" => "",
|
||||
@@ -155,6 +156,7 @@ class Logbook extends CI_Controller {
|
||||
|
||||
$return['callsign_name'] = $this->logbook_model->call_name($callsign);
|
||||
$return['callsign_qra'] = $this->logbook_model->call_qra($callsign);
|
||||
$return['callsign_distance'] = $this->distance($return['callsign_qra'], $station_id);
|
||||
$return['callsign_qth'] = $this->logbook_model->call_qth($callsign);
|
||||
$return['callsign_iota'] = $this->logbook_model->call_iota($callsign);
|
||||
$return['qsl_manager'] = $this->logbook_model->call_qslvia($callsign);
|
||||
@@ -186,6 +188,7 @@ class Logbook extends CI_Controller {
|
||||
{
|
||||
$return['callsign_name'] = $callbook['name'];
|
||||
$return['callsign_qra'] = $callbook['gridsquare'];
|
||||
$return['callsign_distance'] = $callbook['distance'];
|
||||
$return['callsign_qth'] = $callbook['city'];
|
||||
$return['callsign_iota'] = $callbook['iota'];
|
||||
$return['callsign_state'] = $callbook['state'];
|
||||
@@ -979,6 +982,36 @@ class Logbook extends CI_Controller {
|
||||
return "";
|
||||
}
|
||||
|
||||
/* return distance */
|
||||
function distance($locator, $station_id = null) {
|
||||
$distance = 0;
|
||||
$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');
|
||||
|
||||
}
|
||||
return round($distance, 0);
|
||||
}
|
||||
|
||||
function qralatlng($qra) {
|
||||
$this->load->library('Qra');
|
||||
$latlng = $this->qra->qra2latlong($qra);
|
||||
|
||||
Reference in New Issue
Block a user