2020-02-18 09:49:27 +00:00
|
|
|
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
|
|
|
class Distances extends CI_Controller {
|
|
|
|
|
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->load->model('user_model');
|
|
|
|
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
|
|
|
}
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
// Render Page
|
2020-12-22 09:33:08 +00:00
|
|
|
$data['page_title'] = "Distances Worked";
|
2020-02-18 09:49:27 +00:00
|
|
|
|
2021-11-13 14:55:17 +00:00
|
|
|
$this->load->model('bands');
|
|
|
|
$data['bands_available'] = $this->bands->get_worked_bands_distances();
|
|
|
|
$data['sats_available'] = $this->bands->get_worked_sats();
|
2020-02-18 09:49:27 +00:00
|
|
|
|
|
|
|
$this->load->view('interface_assets/header', $data);
|
|
|
|
$this->load->view('distances/index');
|
|
|
|
$this->load->view('interface_assets/footer');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_distances(){
|
|
|
|
// POST data
|
|
|
|
$postData = $this->input->post();
|
|
|
|
|
|
|
|
//load model
|
|
|
|
$this->load->model('Distances_model');
|
|
|
|
|
2020-11-20 10:55:55 +00:00
|
|
|
if ($this->session->userdata('user_measurement_base') == NULL) {
|
|
|
|
$measurement_base = $this->config->item('measurement_base');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$measurement_base = $this->session->userdata('user_measurement_base');
|
|
|
|
}
|
|
|
|
|
2020-02-18 09:49:27 +00:00
|
|
|
// get data
|
2020-11-20 10:55:55 +00:00
|
|
|
$data = $this->Distances_model->get_distances($postData, $measurement_base);
|
2020-02-18 09:49:27 +00:00
|
|
|
|
|
|
|
return json_encode($data);
|
|
|
|
}
|
|
|
|
}
|