Cloudlog/application/controllers/Timeline.php

91 wiersze
3.0 KiB
PHP
Czysty Zwykły widok Historia

2020-04-28 08:53:11 +00:00
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Timeline 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-10-23 10:25:16 +00:00
$data['page_title'] = "Timeline";
2020-04-28 08:53:11 +00:00
$this->load->model('Timeline_model');
if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
$band = $this->input->post('band');
}
else {
$band = 'All';
}
2020-10-23 10:25:16 +00:00
if ($this->input->post('mode') != NULL) { // Band is not set when page first loads.
$mode = $this->input->post('mode');
}
else {
$mode = 'All';
}
if ($this->input->post('awardradio') != NULL) { // Band is not set when page first loads.
$award = $this->input->post('awardradio');
}
else {
$award = 'dxcc';
}
$this->load->model('modes');
$this->load->model('bands');
2020-10-23 10:25:16 +00:00
$data['modes'] = $this->modes->active();
$data['timeline_array'] = $this->Timeline_model->get_timeline($band, $mode, $award);
$data['worked_bands'] = $this->bands->get_worked_bands();
2020-04-28 08:53:11 +00:00
$data['bandselect'] = $band;
2020-10-23 10:25:16 +00:00
$data['modeselect'] = $mode;
2020-04-28 08:53:11 +00:00
$this->load->view('interface_assets/header', $data);
$this->load->view('timeline/index');
$this->load->view('interface_assets/footer');
}
public function details() {
$this->load->model('logbook_model');
2020-10-23 10:25:16 +00:00
$querystring = str_replace('"', "", $this->input->post("Querystring"));
2020-09-25 16:22:13 +00:00
$band = str_replace('"', "", $this->input->post("Band"));
2020-10-23 10:25:16 +00:00
$mode = str_replace('"', "", $this->input->post("Mode"));
$type = str_replace('"', "", $this->input->post("Type"));
$data['results'] = $this->logbook_model->timeline_qso_details($querystring, $band, $mode, $type);
2020-04-28 08:53:11 +00:00
2020-10-23 10:25:16 +00:00
switch($type) {
case 'dxcc': $country = $this->logbook_model->get_entity($querystring);
$data['page_title'] = "Log View - DXCC";
$data['filter'] = "country ". $country['name'];
break;
case 'was' : $data['page_title'] = "Log View - WAS";
$data['filter'] = "state ". $querystring;
break;
case 'iota': $data['page_title'] = "Log View - IOTA";
$data['filter'] = "iota ". $querystring;
break;
case 'waz' : $data['page_title'] = "Log View - WAZ";
$data['filter'] = "CQ zone ". $querystring;
break;
}
2020-04-28 08:53:11 +00:00
if ($band != "All") {
$data['filter'] .= " and " . $band;
}
2020-09-25 16:22:13 +00:00
$this->load->view('timeline/details', $data);
2020-04-28 08:53:11 +00:00
}
}