Cloudlog/application/controllers/Timeline.php

116 wiersze
3.6 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';
}
if ($this->input->post('mode') != NULL) {
2020-10-23 10:25:16 +00:00
$mode = $this->input->post('mode');
}
else {
$mode = 'All';
}
2023-02-19 11:34:35 +00:00
if ($this->input->post('award') != NULL) {
$award = $this->input->post('award');
2020-10-23 10:25:16 +00:00
}
else {
$award = 'dxcc';
}
if ($this->input->post('qsl') != NULL) {
$qsl = $this->input->post('qsl');
}
else {
$qsl = '0';
}
if ($this->input->post('lotw') != NULL) {
$lotw = $this->input->post('lotw');
}
else {
$lotw = '0';
}
if ($this->input->post('eqsl') != NULL) {
$eqsl = $this->input->post('eqsl');
}
else {
$eqsl = '0';
}
2020-10-23 10:25:16 +00:00
$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, $qsl, $lotw, $eqsl);
$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() {
2023-02-22 11:15:11 +00:00
$this->load->model('logbook_model');
$this->load->model('timeline_model');
2020-04-28 08:53:11 +00:00
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->timeline_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;
case 'vucc' : $data['page_title'] = "Log View - VUCC";
$data['filter'] = "Gridsquare ". $querystring;
break;
2020-10-23 10:25:16 +00:00
}
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
}
}