diff --git a/application/controllers/Contesting.php b/application/controllers/Contesting.php index 62227406..f6dbeca1 100644 --- a/application/controllers/Contesting.php +++ b/application/controllers/Contesting.php @@ -9,8 +9,46 @@ if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Contesting extends CI_Controller { - public function index() + public function index() { - echo 'Functions to come'; - } + + $this->load->model('cat'); + $this->load->model('stations'); + $this->load->model('logbook_model'); + $this->load->model('user_model'); + $this->load->model('modes'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + + $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(); + + + $this->load->library('form_validation'); + + $this->form_validation->set_rules('start_date', 'Date', 'required'); + $this->form_validation->set_rules('start_time', 'Time', 'required'); + $this->form_validation->set_rules('callsign', 'Callsign', 'required'); + + $data['page_title'] = "Contest logging"; + + $this->load->view('interface_assets/header', $data); + $this->load->view('contesting/index'); + $this->load->view('interface_assets/footer'); + + + //setcookie("radio", $qso_data['radio'], time()+3600*24*99); + //setcookie("station_profile_id", $qso_data['station_profile_id'], time()+3600*24*99); + + //$this->session->set_userdata($qso_data); + + // If SAT name is set make it session set to sat + if($this->input->post('sat_name')) { + $this->session->set_userdata('prop_mode', 'SAT'); + } + + } } \ No newline at end of file diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 03702344..7d24e842 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -98,6 +98,14 @@ class QSO extends CI_Controller { $this->load->view('interface_assets/footer'); } } + + /* + * This is used for contest-logging and the ajax-call + */ + public function saveqso() { + $this->load->model('logbook_model'); + $this->logbook_model->create_qso(); + } function edit() { diff --git a/application/models/Contesting_model.php b/application/models/Contesting_model.php new file mode 100644 index 00000000..22ced12a --- /dev/null +++ b/application/models/Contesting_model.php @@ -0,0 +1,9 @@ +input->post('sat_name')) { $prop_mode = "SAT"; - } + } + + // Contest exchange, need to separate between serial and other type of exchange + if($this->input->post('exchangeradio')) { + if($this->input->post('exchangeradio') == "serial") { + $srx = $this->input->post('exch_recv'); + $stx = $this->input->post('exch_sent'); + $srx_string = null; + $stx_string = null; + } else { + $srx = null; + $stx = null; + $srx_string = $this->input->post('exch_recv'); + $stx_string = $this->input->post('exch_sent'); + } + } else { + $srx_string = null; + $stx_string = null; + $srx = null; + $stx = null; + } if($this->session->userdata('user_locator')){ $locator = $this->session->userdata('user_locator'); @@ -108,8 +128,10 @@ class Logbook_model extends CI_Model { 'COL_AGE' => null, 'COL_TEN_TEN' => null, 'COL_TX_PWR' => $tx_power, - 'COL_STX' => null, - 'COL_SRX' => null, + 'COL_STX' => $stx, + 'COL_SRX' => $srx, + 'COL_STX_STRING' => $stx_string, + 'COL_SRX_STRING' => $srx_string, 'COL_NR_BURSTS' => null, 'COL_NR_PINGS' => null, 'COL_MAX_BURSTS' => null, diff --git a/application/views/contesting/index.php b/application/views/contesting/index.php new file mode 100644 index 00000000..174489dc --- /dev/null +++ b/application/views/contesting/index.php @@ -0,0 +1,193 @@ +
Date/Time | +Call | +Band | +Mode | +RST (S) | +RST (R) | +Exch S | +Exch R | +
---|