diff --git a/application/controllers/qso.php b/application/controllers/qso.php index 4dbb2c1b..8f944648 100644 --- a/application/controllers/qso.php +++ b/application/controllers/qso.php @@ -65,6 +65,67 @@ class QSO extends CI_Controller { } } + /* + Function: manual + Usage: Post QSO Logging + */ + + public function manual() + { + + $this->load->model('cat'); + $this->load->model('logbook_model'); + $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'); } + + + $data['notice'] = false; + $data['radios'] = $this->cat->radios(); + $data['query'] = $this->logbook_model->last_custom('16'); + + $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'); + + if ($this->form_validation->run() == FALSE) + { + $data['page_title'] = "Add QSO"; + + $this->load->view('layout/header', $data); + $this->load->view('qso/manual'); + $this->load->view('layout/footer'); + } + else + { + // Add QSO + $this->logbook_model->create_qso(); + + // Store Basic QSO Info for reuse + $this->session->set_userdata('band', $this->input->post('band')); + $this->session->set_userdata('freq', $this->input->post('freq')); + $this->session->set_userdata('mode', $this->input->post('mode')); + $this->session->set_userdata('sat_name', $this->input->post('sat_name')); + $this->session->set_userdata('sat_mode', $this->input->post('sat_mode')); + $this->session->set_userdata('radio', $this->input->post('radio')); + + // Get last Ten QSOs + $data['query'] = $this->logbook_model->last_ten(); + + // Set Any Notice Messages + $data['notice'] = "QSO Added"; + + // Load view to create another contact + $data['page_title'] = "Manual QSO"; + + $this->load->view('layout/header', $data); + $this->load->view('qso/manual'); + $this->load->view('layout/footer'); + } + } + + function edit() { $this->load->model('logbook_model'); diff --git a/application/models/logbook_model.php b/application/models/logbook_model.php index 6801cbfe..586b9f4c 100644 --- a/application/models/logbook_model.php +++ b/application/models/logbook_model.php @@ -24,65 +24,139 @@ class Logbook_model extends CI_Model { } if($this->session->userdata('user_locator')){ - $locator = $this->session->userdata('user_locator'); + $locator = $this->session->userdata('user_locator'); } else { - $locator = $this->config->item('locator'); + $locator = $this->config->item('locator'); } - - + // Create array with QSO Data + $data = array( - 'COL_TIME_ON' => $datetime, - 'COL_TIME_OFF' => $datetime, - 'COL_CALL' => strtoupper($this->input->post('callsign')), - 'COL_BAND' => $this->input->post('band'), - 'COL_FREQ' => $this->input->post('freq_display'), - 'COL_MODE' => $this->input->post('mode'), - 'COL_RST_RCVD' => $this->input->post('rst_recv'), - 'COL_RST_SENT' => $this->input->post('rst_sent'), - 'COL_NAME' => $this->input->post('name'), - 'COL_COMMENT' => $this->input->post('comment'), - 'COL_SAT_NAME' => $this->input->post('sat_name'), - 'COL_SAT_MODE' => $this->input->post('sat_mode'), - 'COL_GRIDSQUARE' => trim($this->input->post('locator')), - 'COL_COUNTRY' => $this->input->post('country'), - 'COL_MY_RIG' => $this->input->post('equipment'), - 'COL_QSLSDATE' => date('Y-m-d'), - 'COL_QSLRDATE' => date('Y-m-d'), - 'COL_QSL_SENT' => $this->input->post('qsl_sent'), - 'COL_QSL_RCVD' => $this->input->post('qsl_recv'), - 'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'), - 'COL_QSL_RCVD_VIA' => $this->input->post('qsl_recv_method'), - 'COL_QSL_VIA' => $this->input->post('qsl_via'), - 'COL_OPERATOR' => $this->session->userdata('user_callsign'), - 'COL_QTH' => $this->input->post('qth'), - 'COL_PROP_MODE' => $prop_mode, - 'COL_IOTA' => $this->input->post('iota_ref'), - 'COL_MY_GRIDSQUARE' => $locator, - 'COL_DISTANCE' => "0", - 'COL_FREQ_RX' => 0, - 'COL_BAND_RX' => null, - 'COL_ANT_AZ' => null, - 'COL_ANT_EL' => null, - 'COL_A_INDEX' => null, - 'COL_AGE' => null, - 'COL_TEN_TEN' => null, - 'COL_TX_PWR' => null, - 'COL_STX' => null, - 'COL_SRX' => null, - 'COL_NR_BURSTS' => null, - 'COL_NR_PINGS' => null, - 'COL_MAX_BURSTS' => null, - 'COL_K_INDEX' => null, - 'COL_SFI' => null, - 'COL_RX_PWR' => null, - 'COL_LAT' => null, - 'COL_LON' => null, + 'COL_TIME_ON' => $datetime, + 'COL_TIME_OFF' => $datetime, + 'COL_CALL' => strtoupper($this->input->post('callsign')), + 'COL_BAND' => $this->input->post('band'), + 'COL_FREQ' => $this->input->post('freq_display'), + 'COL_MODE' => $this->input->post('mode'), + 'COL_RST_RCVD' => $this->input->post('rst_recv'), + 'COL_RST_SENT' => $this->input->post('rst_sent'), + 'COL_NAME' => $this->input->post('name'), + 'COL_COMMENT' => $this->input->post('comment'), + 'COL_SAT_NAME' => $this->input->post('sat_name'), + 'COL_SAT_MODE' => $this->input->post('sat_mode'), + 'COL_GRIDSQUARE' => trim($this->input->post('locator')), + 'COL_COUNTRY' => $this->input->post('country'), + 'COL_MY_RIG' => $this->input->post('equipment'), + 'COL_QSLSDATE' => date('Y-m-d'), + 'COL_QSLRDATE' => date('Y-m-d'), + 'COL_QSL_SENT' => $this->input->post('qsl_sent'), + 'COL_QSL_RCVD' => $this->input->post('qsl_recv'), + 'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'), + 'COL_QSL_RCVD_VIA' => $this->input->post('qsl_recv_method'), + 'COL_QSL_VIA' => $this->input->post('qsl_via'), + 'COL_OPERATOR' => $this->session->userdata('user_callsign'), + 'COL_QTH' => $this->input->post('qth'), + 'COL_PROP_MODE' => $prop_mode, + 'COL_IOTA' => $this->input->post('iota_ref'), + 'COL_MY_GRIDSQUARE' => $locator, + 'COL_DISTANCE' => "0", + 'COL_FREQ_RX' => 0, + 'COL_BAND_RX' => null, + 'COL_ANT_AZ' => null, + 'COL_ANT_EL' => null, + 'COL_A_INDEX' => null, + 'COL_AGE' => null, + 'COL_TEN_TEN' => null, + 'COL_TX_PWR' => null, + 'COL_STX' => null, + 'COL_SRX' => null, + 'COL_NR_BURSTS' => null, + 'COL_NR_PINGS' => null, + 'COL_MAX_BURSTS' => null, + 'COL_K_INDEX' => null, + 'COL_SFI' => null, + 'COL_RX_PWR' => null, + 'COL_LAT' => null, + 'COL_LON' => null, ); $this->add_qso($data); } + /* Add QSO to Logbook */ + function create_qso() { + // Join date+time + $datetime = date("Y-m-d",strtotime($this->input->post('start_date')))." ". $this->input->post('start_time'); + if ($this->input->post('prop_mode') != null) { + $prop_mode = $this->input->post('prop_mode'); + } else { + $prop_mode = ""; + } + + if($this->input->post('sat_name')) { + $prop_mode = "SAT"; + } + + if($this->session->userdata('user_locator')){ + $locator = $this->session->userdata('user_locator'); + } else { + $locator = $this->config->item('locator'); + } + + // Create array with QSO Data + + $data = array( + 'COL_TIME_ON' => $datetime, + 'COL_TIME_OFF' => $datetime, + 'COL_CALL' => strtoupper($this->input->post('callsign')), + 'COL_BAND' => $this->input->post('band'), + 'COL_FREQ' => $this->input->post('freq_display'), + 'COL_MODE' => $this->input->post('mode'), + 'COL_RST_RCVD' => $this->input->post('rst_recv'), + 'COL_RST_SENT' => $this->input->post('rst_sent'), + 'COL_NAME' => $this->input->post('name'), + 'COL_COMMENT' => $this->input->post('comment'), + 'COL_SAT_NAME' => $this->input->post('sat_name'), + 'COL_SAT_MODE' => $this->input->post('sat_mode'), + 'COL_GRIDSQUARE' => trim($this->input->post('locator')), + 'COL_COUNTRY' => $this->input->post('country'), + 'COL_MY_RIG' => $this->input->post('equipment'), + 'COL_QSLSDATE' => date('Y-m-d'), + 'COL_QSLRDATE' => date('Y-m-d'), + 'COL_QSL_SENT' => $this->input->post('qsl_sent'), + 'COL_QSL_RCVD' => $this->input->post('qsl_recv'), + 'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'), + 'COL_QSL_RCVD_VIA' => $this->input->post('qsl_recv_method'), + 'COL_QSL_VIA' => $this->input->post('qsl_via'), + 'COL_OPERATOR' => $this->session->userdata('user_callsign'), + 'COL_QTH' => $this->input->post('qth'), + 'COL_PROP_MODE' => $prop_mode, + 'COL_IOTA' => $this->input->post('iota_ref'), + 'COL_MY_GRIDSQUARE' => $locator, + 'COL_DISTANCE' => "0", + 'COL_FREQ_RX' => 0, + 'COL_BAND_RX' => null, + 'COL_ANT_AZ' => null, + 'COL_ANT_EL' => null, + 'COL_A_INDEX' => null, + 'COL_AGE' => null, + 'COL_TEN_TEN' => null, + 'COL_TX_PWR' => null, + 'COL_STX' => null, + 'COL_SRX' => null, + 'COL_NR_BURSTS' => null, + 'COL_NR_PINGS' => null, + 'COL_MAX_BURSTS' => null, + 'COL_K_INDEX' => null, + 'COL_SFI' => null, + 'COL_RX_PWR' => null, + 'COL_LAT' => null, + 'COL_LON' => null, + ); + + $this->add_qso($data); + } + function add_qso($data) { // Add QSO to database $this->db->insert($this->config->item('table_name'), $data); @@ -195,12 +269,14 @@ class Logbook_model extends CI_Model { } - function get_qsos($num, $offset) { - $this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_GRIDSQUARE, COL_QSL_RCVD, COL_QSL_SENT'); - $this->db->order_by("COL_TIME_ON", "desc"); - $query = $this->db->get($this->config->item('table_name'), $num, $offset); - return $query; - } + function get_qsos($num, $offset) { + $this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_GRIDSQUARE, COL_QSL_RCVD, COL_QSL_SENT'); + $this->db->order_by("COL_TIME_ON", "desc"); + + $query = $this->db->get($this->config->item('table_name'), $num, $offset); + + return $query; + } function get_last_qsos($num) { $this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME'); diff --git a/application/views/qso/manual.php b/application/views/qso/manual.php new file mode 100644 index 00000000..0e3cb4fc --- /dev/null +++ b/application/views/qso/manual.php @@ -0,0 +1,510 @@ + + + + + + + + + + +
+ + +
+ +
+ + + +
+ +
+ + +
+
+ +

Manual QSO

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Date
Callsign
Mode + + Band +
RST (S) RST (R)
Name
Location
Locator
Comment
+ + +
+ +
+ + + +
+
+ + + + + + + + + +
Propagation Mode + +
IOTA e.g: EU-005
+
+
+ + + + + + + + + +
Radio + +
Frequency
+
+
+ + + + + + + + + + +
Sat Name
Sat Mode
+
+
+ + + + + + + + + + + + + +
Sent
Method
Via
+
+
+ +
+ + +
+
+
+ +
+

Last 16 QSOs

+ + + + + + + + + + + + + result() as $row) { ?> + + '; ?> + + + + + + + COL_SAT_NAME != null) { ?> + + + + + + + +
DateTimeCallModeSentRecvBand
COL_TIME_ON); echo date('d/m/y', $timestamp); ?>COL_TIME_ON); echo date('H:i', $timestamp); ?>COL_PRIMARY_KEY; ?>">COL_CALL); ?>COL_MODE; ?>COL_RST_SENT; ?>COL_RST_RCVD; ?>COL_SAT_NAME; ?>COL_BAND; ?>
+ +
+
+ +
+ + + + \ No newline at end of file