2011-04-25 15:24:01 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								TODO
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									- Update Edit
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									- Store Radio Information
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									- Upload to clublog (request api key)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								*/
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-04-25 15:24:01 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class QSO extends CI_Controller {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									public function index()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2012-04-08 12:17:14 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->load->model('cat');
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-01 19:14:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										$this->load->model('stations');
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-22 00:08:47 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->load->model('logbook_model');
							 | 
						
					
						
							
								
									
										
										
										
											2011-08-19 16:12:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$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'); }
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-22 00:08:47 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										
							 | 
						
					
						
							
								
									
										
										
										
											2012-04-08 12:17:14 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$data['notice'] = false;
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-01 19:14:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										$data['stations'] = $this->stations->all();
							 | 
						
					
						
							
								
									
										
										
										
											2012-04-08 12:17:14 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$data['radios'] = $this->cat->radios();
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-21 12:44:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										$data['query'] = $this->logbook_model->last_custom('5');
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$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)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										{
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-04 17:32:03 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$data['page_title'] = "Add QSO";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-21 12:44:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											$this->load->view('interface_assets/header', $data);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-04 17:32:03 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$this->load->view('qso/index');
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-21 12:44:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											$this->load->view('interface_assets/footer');
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										{
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-22 00:08:47 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// Add QSO
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-12 16:31:29 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// $this->logbook_model->add();
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-25 22:13:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											//change to create_qso function as add and create_qso duplicate functionality
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$this->logbook_model->create_qso();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-22 00:08:47 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// Store Basic QSO Info for reuse
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-25 22:13:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											// Put data in an array first, then call set_userdata once.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// This solves the problem of CI dumping out the session
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// cookie each time set_userdata is called.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// For more info, see http://bizhole.com/codeigniter-nginx-error-502-bad-gateway/
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// $qso_data = [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// 18-Jan-2016 - make php v5.3 friendly!
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$qso_data = array(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'band' => $this->input->post('band'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'freq' => $this->input->post('freq_display'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'freq_rx' => $this->input->post('freq_display_rx'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'mode' => $this->input->post('mode'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'sat_name' => $this->input->post('sat_name'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'sat_mode' => $this->input->post('sat_mode'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'radio' => $this->input->post('radio'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'station_profile_id' => $this->input->post('station_profile')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// ];
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-18 08:12:12 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-25 22:13:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											$this->session->set_userdata($qso_data);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-21 12:44:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											// Get last 5 qsos
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$data['query'] = $this->logbook_model->last_custom('5');
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											 
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-22 00:08:47 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// Set Any Notice Messages
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$data['notice'] = "QSO Added";
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-22 00:08:47 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// Load view to create another contact
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-04 17:32:03 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$data['page_title'] = "Add QSO";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-21 12:44:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											$this->load->view('interface_assets/header', $data);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-04 17:32:03 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$this->load->view('qso/index');
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-21 12:44:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											$this->load->view('interface_assets/footer');
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									function edit() {
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-22 00:08:47 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->load->model('logbook_model');
							 | 
						
					
						
							
								
									
										
										
										
											2011-08-19 16:12:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$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'); }
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-22 00:08:47 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$query = $this->logbook_model->qso_info($this->uri->segment(3));
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->load->library('form_validation');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->form_validation->set_rules('time_on', 'Start Date', 'required');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->form_validation->set_rules('time_off', 'End Date', 'required');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->form_validation->set_rules('callsign', 'Callsign', 'required');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$data = $query->row(); 
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-22 00:08:47 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if ($this->form_validation->run() == FALSE)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										{
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-04 17:32:03 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$this->load->view('layout/mini_header', $data);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$this->load->view('qso/edit');
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-18 22:06:34 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$this->load->view('layout/mini_footer');
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										{
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-22 00:08:47 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$this->logbook_model->edit();
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$this->session->set_flashdata('notice', 'Record Updated');
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-25 17:29:46 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											$this->load->view('qso/edit_done');
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							
								
									
										
										
										
											2011-08-28 13:51:57 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Delete QSO */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									function delete($id) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->load->model('logbook_model');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->logbook_model->delete($id);
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-17 12:52:00 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										
							 | 
						
					
						
							
								
									
										
										
										
											2011-08-28 13:51:57 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->session->set_flashdata('notice', 'QSO Deleted Successfully');
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-18 22:06:34 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$data['message_title'] = "Deleted";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$data['message_contents'] = "QSO Deleted Successfully";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->load->view('messages/message', $data);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-04-25 15:24:01 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-13 17:01:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-18 11:21:51 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									function band_to_freq($band, $mode) {
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-13 17:01:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										$this->load->library('frequency');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-18 11:21:51 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										echo $this->frequency->convent_band($band, $mode);
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-13 17:01:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2011-08-19 16:12:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |