2020-10-04 19:41:01 +00:00
|
|
|
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
|
|
|
class Accumulated 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'] = "Accumulated Statistics";
|
2020-10-04 19:41:01 +00:00
|
|
|
|
2021-11-13 14:55:17 +00:00
|
|
|
$this->load->model('bands');
|
2020-10-04 19:41:01 +00:00
|
|
|
|
2021-11-13 14:55:17 +00:00
|
|
|
$data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
|
2020-10-04 19:41:01 +00:00
|
|
|
|
2020-10-08 09:45:41 +00:00
|
|
|
$this->load->model('modes');
|
|
|
|
|
|
|
|
$data['modes'] = $this->modes->active();
|
|
|
|
|
2020-10-04 19:41:01 +00:00
|
|
|
$this->load->view('interface_assets/header', $data);
|
|
|
|
$this->load->view('accumulate/index');
|
|
|
|
$this->load->view('interface_assets/footer');
|
|
|
|
}
|
|
|
|
|
2020-10-06 19:12:14 +00:00
|
|
|
/*
|
|
|
|
* Used for ajax-call in javascript to fetch the data and insert into table and chart
|
|
|
|
*/
|
|
|
|
public function get_accumulated_data(){
|
|
|
|
//load model
|
|
|
|
$this->load->model('accumulate_model');
|
|
|
|
$band = $this->input->post('Band');
|
|
|
|
$award = $this->input->post('Award');
|
2020-10-08 09:45:41 +00:00
|
|
|
$mode = $this->input->post('Mode');
|
|
|
|
$period = $this->input->post('Period');
|
2020-10-06 19:12:14 +00:00
|
|
|
|
|
|
|
// get data
|
2020-10-08 09:45:41 +00:00
|
|
|
$data = $this->accumulate_model->get_accumulated_data($band, $award, $mode, $period);
|
2020-10-06 19:12:14 +00:00
|
|
|
header('Content-Type: application/json');
|
|
|
|
echo json_encode($data);
|
2020-10-04 19:41:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|