2019-01-01 19:14:25 +00:00
|
|
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
|
|
|
|
/*
|
2019-05-14 10:25:57 +00:00
|
|
|
Handles Displaying of information for station tools.
|
2019-01-01 19:14:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
class Station extends CI_Controller {
|
|
|
|
|
2019-01-08 22:54:29 +00:00
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->load->helper(array('form', 'url'));
|
|
|
|
|
|
|
|
$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'); }
|
|
|
|
}
|
|
|
|
|
2019-01-01 19:14:25 +00:00
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
$this->load->model('stations');
|
2019-09-23 16:29:22 +00:00
|
|
|
$this->load->model('Logbook_model');
|
|
|
|
|
2019-09-24 23:38:13 +00:00
|
|
|
$data['stations'] = $this->stations->all_with_count();
|
2019-09-23 16:29:22 +00:00
|
|
|
$data['current_active'] = $this->stations->find_active();
|
|
|
|
$data['is_there_qsos_with_no_station_id'] = $this->Logbook_model->check_for_station_id();
|
2019-01-01 19:14:25 +00:00
|
|
|
|
|
|
|
// Render Page
|
|
|
|
$data['page_title'] = "Station Profiles";
|
2019-01-09 15:18:46 +00:00
|
|
|
$this->load->view('interface_assets/header', $data);
|
2019-01-01 19:14:25 +00:00
|
|
|
$this->load->view('station_profile/index');
|
2019-01-09 15:18:46 +00:00
|
|
|
$this->load->view('interface_assets/footer');
|
2019-01-01 19:14:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function create()
|
|
|
|
{
|
|
|
|
$this->load->model('stations');
|
|
|
|
$this->load->model('dxcc');
|
|
|
|
$data['dxcc_list'] = $this->dxcc->list();
|
|
|
|
|
|
|
|
$this->load->library('form_validation');
|
|
|
|
|
|
|
|
$this->form_validation->set_rules('station_profile_name', 'Station Profile Name', 'required');
|
|
|
|
|
|
|
|
if ($this->form_validation->run() == FALSE)
|
|
|
|
{
|
|
|
|
$data['page_title'] = "Create Station Profile";
|
2019-01-09 15:18:46 +00:00
|
|
|
$this->load->view('interface_assets/header', $data);
|
2019-01-01 19:14:25 +00:00
|
|
|
$this->load->view('station_profile/create');
|
2019-01-09 15:18:46 +00:00
|
|
|
$this->load->view('interface_assets/footer');
|
2019-01-01 19:14:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->stations->add();
|
|
|
|
|
|
|
|
redirect('station');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-03 21:18:14 +00:00
|
|
|
public function edit($id)
|
2019-01-01 19:14:25 +00:00
|
|
|
{
|
2019-10-03 21:18:14 +00:00
|
|
|
$this->load->library('form_validation');
|
|
|
|
|
|
|
|
$this->load->model('stations');
|
|
|
|
$this->load->model('dxcc');
|
|
|
|
|
2019-10-05 18:16:05 +00:00
|
|
|
$item_id_clean = $this->security->xss_clean($id);
|
|
|
|
|
|
|
|
$station_profile_query = $this->stations->profile($item_id_clean);
|
2019-10-03 21:18:14 +00:00
|
|
|
|
|
|
|
$data['my_station_profile'] = $station_profile_query->row();
|
|
|
|
|
|
|
|
$data['dxcc_list'] = $this->dxcc->list();
|
|
|
|
|
|
|
|
$data['page_title'] = "Edit Station Profile";
|
|
|
|
|
|
|
|
$this->form_validation->set_rules('station_profile_name', 'Station Profile Name', 'required');
|
|
|
|
|
|
|
|
if ($this->form_validation->run() == FALSE)
|
|
|
|
{
|
|
|
|
$this->load->view('interface_assets/header', $data);
|
|
|
|
$this->load->view('station_profile/edit');
|
|
|
|
$this->load->view('interface_assets/footer');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->stations->edit();
|
|
|
|
|
2019-10-05 18:16:05 +00:00
|
|
|
$data['notice'] = "Station Profile ".$this->security->xss_clean($this->input->post('station_profile_name', true))." Updated";
|
2019-01-01 19:14:25 +00:00
|
|
|
|
2019-10-03 21:18:14 +00:00
|
|
|
redirect('station');
|
|
|
|
}
|
2019-01-01 19:14:25 +00:00
|
|
|
}
|
|
|
|
|
2019-09-23 16:29:22 +00:00
|
|
|
function reassign_profile($id) {
|
|
|
|
// $id is the profile that needs reassigned to QSOs
|
|
|
|
$this->load->model('stations');
|
|
|
|
$this->stations->reassign($id);
|
|
|
|
|
|
|
|
//$this->stations->logbook_session_data();
|
2019-09-23 17:36:17 +00:00
|
|
|
redirect('station');
|
2019-09-23 16:29:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function set_active($current, $new) {
|
|
|
|
$this->load->model('stations');
|
|
|
|
$this->stations->set_active($current, $new);
|
|
|
|
|
|
|
|
//$this->stations->logbook_session_data();
|
|
|
|
redirect('station');
|
|
|
|
}
|
|
|
|
|
2019-10-03 11:56:25 +00:00
|
|
|
function assign_all() {
|
|
|
|
$this->load->model('Logbook_model');
|
|
|
|
$this->Logbook_model->update_all_station_ids();
|
|
|
|
|
|
|
|
redirect('station');
|
|
|
|
}
|
|
|
|
|
2019-01-01 19:14:25 +00:00
|
|
|
public function delete($id) {
|
|
|
|
$this->load->model('stations');
|
|
|
|
$this->stations->delete($id);
|
|
|
|
|
|
|
|
redirect('station');
|
|
|
|
}
|
|
|
|
|
2020-02-07 13:54:49 +00:00
|
|
|
public function deletelog($id) {
|
|
|
|
$this->load->model('stations');
|
|
|
|
$this->stations->deletelog($id);
|
|
|
|
|
|
|
|
redirect('station');
|
|
|
|
}
|
|
|
|
|
2019-01-01 19:14:25 +00:00
|
|
|
}
|