Accumulated Timeline / Take care of propmode

This commit is contained in:
int2001
2024-08-26 06:21:49 +00:00
parent 65cea8f13f
commit c79ae7ad15
4 changed files with 83 additions and 27 deletions

View File

@@ -4,8 +4,7 @@ defined('BASEPATH') or exit('No direct script access allowed');
class Accumulated extends CI_Controller
{
function __construct()
{
function __construct() {
parent::__construct();
$this->load->model('user_model');
@@ -15,39 +14,59 @@ class Accumulated extends CI_Controller
}
}
public function index()
{
// Render Page
$data['page_title'] = __("Accumulated Statistics");
public function index() {
// Render Page
$data['page_title'] = __("Accumulated Statistics");
$this->load->model('bands');
$this->load->model('bands');
$data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
$data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
$this->load->model('modes');
$this->load->model('modes');
$data['modes'] = $this->modes->active();
if (($this->input->post('Propmode') != NULL) && ($this->input->post('Propmode') != '0')) { // Set, but not "All"
$data['propmode'] = $this->security->xss_clean($this->input->post('Propmode'));
} else {
if (($this->session->userdata('user_default_band') == 'SAT') && ($this->input->post('propmode') == NULL)){ // Not set, and empty and default is SAT?
$data['propmode']='SAT';
} else { // Not set and empty and no SAT as default?
$data['propmode'] = 'All';
}
}
$this->load->view('interface_assets/header', $data);
$this->load->view('accumulate/index');
$this->load->view('interface_assets/footer');
$data['modes'] = $this->modes->active();
$this->load->view('interface_assets/header', $data);
$this->load->view('accumulate/index');
$this->load->view('interface_assets/footer');
}
/*
* 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 = xss_clean($this->input->post('Band'));
$award = xss_clean($this->input->post('Award'));
$mode = xss_clean($this->input->post('Mode'));
$period = xss_clean($this->input->post('Period'));
public function get_accumulated_data() {
// get data
$data = $this->accumulate_model->get_accumulated_data($band, $award, $mode, $period);
header('Content-Type: application/json');
echo json_encode($data);
if (($this->input->post('Propmode') != NULL) && ($this->input->post('Propmode') != '0')) { // Set, but not "All"
$propmode = $this->security->xss_clean($this->input->post('Propmode'));
} else {
if (($this->session->userdata('user_default_band') == 'SAT') && ($this->input->post('Propmode') == NULL)){ // Not set, and empty and default is SAT?
$propmode='SAT';
} else { // Not set and empty and no SAT as default?
$propmode = 'All';
}
}
//load model
$this->load->model('accumulate_model');
$band = xss_clean($this->input->post('Band'));
$award = xss_clean($this->input->post('Award'));
$mode = xss_clean($this->input->post('Mode'));
$period = xss_clean($this->input->post('Period'));
// get data
$data = $this->accumulate_model->get_accumulated_data($band, $award, $mode, $propmode, $period);
header('Content-Type: application/json');
echo json_encode($data);
}
}