mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
[Contesting] Contests can be added/edited/deleted inside Cloudlog. Used for choosing Contest in Contest Logging
This commit is contained in:
@@ -13,7 +13,7 @@ class Contesting extends CI_Controller {
|
||||
{
|
||||
parent::__construct();
|
||||
$this->lang->load('contesting');
|
||||
|
||||
|
||||
$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'); }
|
||||
}
|
||||
@@ -26,13 +26,14 @@ class Contesting extends CI_Controller {
|
||||
$this->load->model('logbook_model');
|
||||
$this->load->model('user_model');
|
||||
$this->load->model('modes');
|
||||
$this->load->model('contesting_model');
|
||||
|
||||
$data['active_station_profile'] = $this->stations->find_active();
|
||||
$data['notice'] = false;
|
||||
$data['stations'] = $this->stations->all();
|
||||
$data['radios'] = $this->cat->radios();
|
||||
$data['dxcc'] = $this->logbook_model->fetchDxcc();
|
||||
$data['modes'] = $this->modes->active();
|
||||
$data['contestnames'] = $this->contesting_model->getActivecontests();
|
||||
|
||||
|
||||
$this->load->library('form_validation');
|
||||
@@ -71,4 +72,90 @@ class Contesting extends CI_Controller {
|
||||
|
||||
return json_encode($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->load->model('Contesting_model');
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('name', 'Contest Name', 'required');
|
||||
$this->form_validation->set_rules('adifname', 'Contest Adif Name', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$data['page_title'] = "Create Mode";
|
||||
$this->load->view('contesting/create', $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->Contesting_model->add();
|
||||
}
|
||||
}
|
||||
|
||||
public function add() {
|
||||
$this->load->model('Contesting_model');
|
||||
|
||||
$data['contests'] = $this->Contesting_model->getAllContests();
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "Contests";
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('contesting/add');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->load->model('Contesting_model');
|
||||
|
||||
$item_id_clean = $this->security->xss_clean($id);
|
||||
|
||||
$data['contest'] = $this->Contesting_model->contest($item_id_clean);
|
||||
|
||||
$data['page_title'] = "Edit Contest";
|
||||
|
||||
$this->form_validation->set_rules('name', 'Contest Name', 'required');
|
||||
$this->form_validation->set_rules('adifname', 'Adif Contest Name', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('contesting/edit');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->Contesting_model->edit($item_id_clean);
|
||||
|
||||
$data['notice'] = "Contest ".$this->security->xss_clean($this->input->post('name', true))." Updated";
|
||||
|
||||
redirect('contesting/add');
|
||||
}
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
$id = $this->input->post('id');
|
||||
$this->load->model('Contesting_model');
|
||||
$this->Contesting_model->delete($id);
|
||||
}
|
||||
|
||||
public function activate() {
|
||||
$id = $this->input->post('id');
|
||||
$this->load->model('Contesting_model');
|
||||
$this->Contesting_model->activate($id);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('message' => 'OK'));
|
||||
return;
|
||||
}
|
||||
|
||||
public function deactivate() {
|
||||
$id = $this->input->post('id');
|
||||
$this->load->model('Contesting_model');
|
||||
$this->Contesting_model->deactivate($id);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('message' => 'OK'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user