mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Added distanceplotting. Fixes #384.
This commit is contained in:
50
application/controllers/Distances.php
Normal file
50
application/controllers/Distances.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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
|
||||
$data['page_title'] = "Distances worked";
|
||||
|
||||
function js_str($s)
|
||||
{
|
||||
return '"' . addcslashes($s, "\0..\37\"\\") . '"';
|
||||
}
|
||||
|
||||
function js_array($array)
|
||||
{
|
||||
$temp = array_map('js_str', $array);
|
||||
return '[' . implode(',', $temp) . ']';
|
||||
}
|
||||
|
||||
$data['bands_available'] = js_array($this->config->item('bands_available'));
|
||||
|
||||
$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');
|
||||
|
||||
// get data
|
||||
$data = $this->Distances_model->get_distances($postData);
|
||||
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user