mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Use configured measurement base
This commit is contained in:
@@ -334,7 +334,33 @@ class Statistics extends CI_Controller {
|
||||
$band = xss_clean($this->input->post('band'));
|
||||
$mode = xss_clean($this->input->post('mode'));
|
||||
|
||||
if ($this->session->userdata('user_measurement_base') == NULL) {
|
||||
$measurement_base = $this->config->item('measurement_base');
|
||||
} else {
|
||||
$measurement_base = $this->session->userdata('user_measurement_base');
|
||||
}
|
||||
|
||||
switch ($measurement_base) {
|
||||
case 'M':
|
||||
$unit = "mi";
|
||||
$factor = 0.621371;
|
||||
break;
|
||||
case 'K':
|
||||
$unit = "km";
|
||||
$factor = 1;
|
||||
break;
|
||||
case 'N':
|
||||
$unit = "nmi";
|
||||
$factor = 0.539957;
|
||||
break;
|
||||
default:
|
||||
$unit = "km";
|
||||
$factor = 1;
|
||||
break;
|
||||
}
|
||||
$this->load->model('stats');
|
||||
$data['factor'] = $factor;
|
||||
$data['unit'] = $unit;
|
||||
$data['intials_array'] = $this->stats->getInitialsFromDb($band, $mode);
|
||||
$this->load->view('statistics/initialresult', $data);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ if ($intials_array) {
|
||||
<td>' . $line->col_band . '</td>
|
||||
<td>' . (empty($line->col_submode) ? ($line->col_mode ?? '') : $line->col_submode) . '</td>
|
||||
<td>' . (empty($line->col_vucc_grids) ? ($line->col_gridsquare ?? '') : $line->col_vucc_grids) . '</td>
|
||||
<td>' . $line->col_distance . ' km</td>
|
||||
<td style="text-align: right">'.printf("%.01f", (floatval($line->col_distance) * $factor)); echo ' '.$unit.'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user