2011-04-25 16:24:01 +01:00
|
|
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
|
|
2011-06-17 13:52:00 +01:00
|
|
|
/*
|
|
|
|
|
TODO
|
|
|
|
|
- Update Edit
|
|
|
|
|
- Store Radio Information
|
|
|
|
|
- Upload to clublog (request api key)
|
|
|
|
|
*/
|
|
|
|
|
|
2011-04-25 16:24:01 +01:00
|
|
|
class QSO extends CI_Controller {
|
|
|
|
|
|
2021-01-05 16:56:42 +00:00
|
|
|
function __construct()
|
|
|
|
|
{
|
|
|
|
|
parent::__construct();
|
|
|
|
|
$this->lang->load('qso');
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2021-01-05 16:56:42 +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-04-25 16:24:01 +01:00
|
|
|
public function index()
|
|
|
|
|
{
|
2012-04-08 13:17:14 +01:00
|
|
|
$this->load->model('cat');
|
2019-01-01 19:14:25 +00:00
|
|
|
$this->load->model('stations');
|
2011-07-22 01:08:47 +01:00
|
|
|
$this->load->model('logbook_model');
|
2011-08-19 17:12:13 +01:00
|
|
|
$this->load->model('user_model');
|
2020-05-17 14:57:28 +02:00
|
|
|
$this->load->model('modes');
|
2022-09-08 20:12:11 +02:00
|
|
|
$this->load->model('bands');
|
2020-05-17 14:57:28 +02:00
|
|
|
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2020-02-27 14:43:07 +00:00
|
|
|
$data['active_station_profile'] = $this->stations->find_active();
|
2022-02-18 13:46:16 +00:00
|
|
|
|
2012-04-08 13:17:14 +01:00
|
|
|
$data['notice'] = false;
|
2021-10-31 10:25:35 +01:00
|
|
|
$data['stations'] = $this->stations->all_of_user();
|
2012-04-08 13:17:14 +01:00
|
|
|
$data['radios'] = $this->cat->radios();
|
2026-03-26 22:26:47 +00:00
|
|
|
$data['query'] = $this->logbook_model->last_custom_paginated(5, 0);
|
|
|
|
|
$data['total_rows'] = $this->logbook_model->last_custom_count();
|
|
|
|
|
$data['total_pages'] = ceil($data['total_rows'] / 5);
|
|
|
|
|
$data['current_page'] = 0;
|
|
|
|
|
$data['limit'] = 5;
|
2020-04-13 10:34:02 +02:00
|
|
|
$data['dxcc'] = $this->logbook_model->fetchDxcc();
|
2020-05-17 14:57:28 +02:00
|
|
|
$data['iota'] = $this->logbook_model->fetchIota();
|
|
|
|
|
$data['modes'] = $this->modes->active();
|
2022-10-05 23:23:32 +02:00
|
|
|
$data['bands'] = $this->bands->get_user_bands_for_qso_entry();
|
2023-10-16 22:39:33 +02:00
|
|
|
$data['user_default_band'] = $this->session->userdata('user_default_band');
|
2022-10-05 23:23:32 +02:00
|
|
|
$data['sat_active'] = array_search("SAT", $this->bands->get_user_bands(), true);
|
2025-07-30 21:24:34 +00:00
|
|
|
|
|
|
|
|
// Set user's preferred date format
|
|
|
|
|
if($this->session->userdata('user_date_format')) {
|
|
|
|
|
$data['user_date_format'] = $this->session->userdata('user_date_format');
|
|
|
|
|
} else {
|
|
|
|
|
$data['user_date_format'] = $this->config->item('qso_date_format');
|
|
|
|
|
}
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2026-03-29 13:57:36 +01:00
|
|
|
// Measurement base for frontend bearing/distance calculations
|
|
|
|
|
$data['measurement_base'] = $this->session->userdata('user_measurement_base') ?: $this->config->item('measurement_base');
|
|
|
|
|
|
2011-06-17 13:52:00 +01: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');
|
2023-11-29 18:32:42 +00:00
|
|
|
$this->form_validation->set_rules('band', 'Band', 'required');
|
|
|
|
|
$this->form_validation->set_rules('mode', 'Mode', 'required');
|
2022-03-28 12:41:14 +02:00
|
|
|
$this->form_validation->set_rules('locator', 'Locator', 'callback_check_locator');
|
2011-06-17 13:52:00 +01:00
|
|
|
|
2023-11-29 14:17:58 +01:00
|
|
|
// [eQSL default msg] GET user options (option_type='eqsl_default_qslmsg'; option_name='key_station_id'; option_key=station_id) //
|
|
|
|
|
$this->load->model('user_options_model');
|
|
|
|
|
$options_object = $this->user_options_model->get_options('eqsl_default_qslmsg',array('option_name'=>'key_station_id','option_key'=>$data['active_station_profile']))->result();
|
|
|
|
|
$data['qslmsg'] = (isset($options_object[0]->option_value))?$options_object[0]->option_value:'';
|
|
|
|
|
|
2026-03-27 18:11:22 +00:00
|
|
|
// Load QSO form field visibility preferences
|
|
|
|
|
$qso_fields_defaults = [
|
|
|
|
|
'rst' => true, 'name' => true, 'qth' => true, 'locator' => true, 'comment' => true,
|
|
|
|
|
'station_tab' => true, 'freq_tx' => true, 'freq_rx' => true, 'band_rx' => true,
|
|
|
|
|
'transmit_power' => true, 'operator_callsign' => true,
|
|
|
|
|
'general_tab' => true, 'iota' => true, 'sota' => true, 'wwff' => true, 'pota' => true,
|
|
|
|
|
'sig' => true, 'dok' => true, 'usa_state' => true,
|
|
|
|
|
'satellite_tab' => true, 'notes_tab' => true, 'qsl_tab' => true,
|
Add DX Cluster tab to QSO interface
Introduce a DX Cluster tab to the QSO view and user settings. This change:
- Enables a new qso_form option 'dxcluster_tab' in controllers (Qso.php, User.php) so the tab can be toggled per-user.
- Adds a user preference toggle in the user edit view to show/hide the DX Cluster tab.
- Implements the DX Cluster UI in the QSO index view: tab button, controls (band select, hide RBN), spot table and click-to-fill behavior.
- Adds client-side JS to manage a WebSocket to wss://dxc.cloudlog.org, maintain and render recent spots in a DataTable, persist filter preferences, sync band selection with the QSO form/radio, and batch-check worked status via the dxcluster/check_worked endpoint.
Files changed: application/controllers/Qso.php, application/controllers/User.php, application/views/qso/index.php, application/views/user/edit.php.
2026-03-27 22:29:25 +00:00
|
|
|
'dxcluster_tab' => true,
|
2026-03-27 18:11:22 +00:00
|
|
|
];
|
|
|
|
|
$qso_form_options = $this->user_options_model->get_options('qso_form')->result();
|
|
|
|
|
foreach ($qso_form_options as $qfo_item) {
|
|
|
|
|
if ($qfo_item->option_key == 'visible' && array_key_exists($qfo_item->option_name, $qso_fields_defaults)) {
|
|
|
|
|
$qso_fields_defaults[$qfo_item->option_name] = ($qfo_item->option_value == 'true');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$data['qso_fields'] = $qso_fields_defaults;
|
|
|
|
|
|
2011-06-17 13:52:00 +01:00
|
|
|
if ($this->form_validation->run() == FALSE)
|
|
|
|
|
{
|
2011-11-04 17:32:03 +00:00
|
|
|
$data['page_title'] = "Add QSO";
|
|
|
|
|
|
2019-05-21 13:44:22 +01:00
|
|
|
$this->load->view('interface_assets/header', $data);
|
2011-11-04 17:32:03 +00:00
|
|
|
$this->load->view('qso/index');
|
2019-05-21 13:44:22 +01:00
|
|
|
$this->load->view('interface_assets/footer');
|
2011-06-17 13:52:00 +01:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-07-22 01:08:47 +01:00
|
|
|
// Store Basic QSO Info for reuse
|
2019-02-25 23:13:09 +01: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(
|
2020-05-02 16:54:13 +02:00
|
|
|
'start_date' => $this->input->post('start_date'),
|
|
|
|
|
'start_time' => $this->input->post('start_time'),
|
2023-11-01 14:24:13 +01:00
|
|
|
'end_time' => $this->input->post('end_time'),
|
2020-06-04 22:29:20 +02:00
|
|
|
'time_stamp' => time(),
|
2019-02-25 23:13:09 +01:00
|
|
|
'band' => $this->input->post('band'),
|
2020-12-28 13:53:44 +00:00
|
|
|
'band_rx' => $this->input->post('band_rx'),
|
2019-02-25 23:13:09 +01:00
|
|
|
'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'),
|
2020-03-02 19:53:50 +00:00
|
|
|
'prop_mode' => $this->input->post('prop_mode'),
|
2019-02-25 23:13:09 +01:00
|
|
|
'radio' => $this->input->post('radio'),
|
2020-04-13 16:47:58 +01:00
|
|
|
'station_profile_id' => $this->input->post('station_profile'),
|
2023-08-20 14:36:14 +00:00
|
|
|
'operator_callsign' => $this->input->post('operator_callsign'),
|
2020-04-13 16:47:58 +01:00
|
|
|
'transmit_power' => $this->input->post('transmit_power')
|
2019-02-25 23:13:09 +01:00
|
|
|
);
|
|
|
|
|
// ];
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2019-06-25 13:46:13 +02:00
|
|
|
setcookie("radio", $qso_data['radio'], time()+3600*24*99);
|
|
|
|
|
setcookie("station_profile_id", $qso_data['station_profile_id'], time()+3600*24*99);
|
2015-03-18 08:12:12 +00:00
|
|
|
|
2019-02-25 23:13:09 +01:00
|
|
|
$this->session->set_userdata($qso_data);
|
2020-03-02 19:53:50 +00:00
|
|
|
|
|
|
|
|
// If SAT name is set make it session set to sat
|
|
|
|
|
if($this->input->post('sat_name')) {
|
|
|
|
|
$this->session->set_userdata('prop_mode', 'SAT');
|
|
|
|
|
}
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2021-03-14 14:41:24 +00:00
|
|
|
// Add QSO
|
|
|
|
|
// $this->logbook_model->add();
|
|
|
|
|
//change to create_qso function as add and create_qso duplicate functionality
|
|
|
|
|
$this->logbook_model->create_qso();
|
|
|
|
|
|
2019-05-21 13:44:22 +01:00
|
|
|
// Get last 5 qsos
|
|
|
|
|
$data['query'] = $this->logbook_model->last_custom('5');
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2011-07-22 01:08:47 +01:00
|
|
|
// Set Any Notice Messages
|
2011-06-17 13:52:00 +01:00
|
|
|
$data['notice'] = "QSO Added";
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2011-06-17 13:52:00 +01:00
|
|
|
// Load view to create another contact
|
2011-11-04 17:32:03 +00:00
|
|
|
$data['page_title'] = "Add QSO";
|
|
|
|
|
|
2019-05-21 13:44:22 +01:00
|
|
|
$this->load->view('interface_assets/header', $data);
|
2011-11-04 17:32:03 +00:00
|
|
|
$this->load->view('qso/index');
|
2019-05-21 13:44:22 +01:00
|
|
|
$this->load->view('interface_assets/footer');
|
2011-06-17 13:52:00 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-11-16 19:20:45 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This is used for contest-logging and the ajax-call
|
|
|
|
|
*/
|
|
|
|
|
public function saveqso() {
|
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
$this->logbook_model->create_qso();
|
|
|
|
|
}
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2011-06-17 13:52:00 +01:00
|
|
|
function edit() {
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2011-07-22 01:08:47 +01:00
|
|
|
$this->load->model('logbook_model');
|
2011-08-19 17:12:13 +01:00
|
|
|
$this->load->model('user_model');
|
2020-05-17 15:08:21 +02:00
|
|
|
$this->load->model('modes');
|
2011-08-19 17:12:13 +01:00
|
|
|
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
2025-12-23 11:06:19 +00:00
|
|
|
|
|
|
|
|
$qso_id = $this->uri->segment(3);
|
|
|
|
|
|
|
|
|
|
// Check if user has write permission to this QSO
|
|
|
|
|
if (!$this->logbook_model->check_qso_is_writable($qso_id)) {
|
|
|
|
|
$this->session->set_flashdata('notice', 'You do not have permission to edit this QSO');
|
|
|
|
|
redirect('dashboard');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$query = $this->logbook_model->qso_info($qso_id);
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2011-06-17 13:52:00 +01: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');
|
|
|
|
|
|
2020-04-17 12:38:01 +02:00
|
|
|
$data['qso'] = $query->row();
|
|
|
|
|
$data['dxcc'] = $this->logbook_model->fetchDxcc();
|
|
|
|
|
$data['iota'] = $this->logbook_model->fetchIota();
|
2020-05-17 15:08:21 +02:00
|
|
|
$data['modes'] = $this->modes->all();
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2011-06-17 13:52:00 +01:00
|
|
|
if ($this->form_validation->run() == FALSE)
|
|
|
|
|
{
|
2019-06-13 14:34:31 +01:00
|
|
|
$this->load->view('qso/edit', $data);
|
2011-06-17 13:52:00 +01:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-07-22 01:08:47 +01:00
|
|
|
$this->logbook_model->edit();
|
2011-06-17 13:52:00 +01: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 13:52:00 +01:00
|
|
|
}
|
2011-08-28 14:51:57 +01:00
|
|
|
}
|
2020-08-24 20:16:06 +02:00
|
|
|
|
2023-05-15 15:35:11 +01:00
|
|
|
function winkeysettings() {
|
2023-07-31 15:52:32 +01:00
|
|
|
|
|
|
|
|
// Load model Winkey
|
|
|
|
|
$this->load->model('winkey');
|
2025-10-10 18:01:31 +01:00
|
|
|
$this->load->model('stations');
|
|
|
|
|
|
|
|
|
|
// Get active station profile
|
|
|
|
|
$active_station_id = $this->stations->find_active();
|
2023-07-31 15:52:32 +01:00
|
|
|
|
|
|
|
|
// call settings from model winkey
|
2025-10-10 18:01:31 +01:00
|
|
|
$data['result'] = $this->winkey->settings($this->session->userdata('user_id'), $active_station_id);
|
2023-07-31 15:52:32 +01:00
|
|
|
|
|
|
|
|
if ($data['result'] == false) {
|
|
|
|
|
$this->load->view('qso/components/winkeysettings', $data);
|
|
|
|
|
} else {
|
|
|
|
|
$this->load->view('qso/components/winkeysettings_results', $data);
|
|
|
|
|
}
|
2023-05-15 15:35:11 +01:00
|
|
|
}
|
|
|
|
|
|
2025-10-10 15:38:24 +01:00
|
|
|
public function cwmacrosave(){
|
2025-10-10 15:19:42 +01:00
|
|
|
try {
|
|
|
|
|
// Get the data from the form with proper sanitization
|
|
|
|
|
$function1_name = $this->input->post('function1_name', TRUE);
|
|
|
|
|
$function1_macro = $this->input->post('function1_macro', TRUE);
|
2023-07-31 15:52:32 +01:00
|
|
|
|
2025-10-10 15:19:42 +01:00
|
|
|
$function2_name = $this->input->post('function2_name', TRUE);
|
|
|
|
|
$function2_macro = $this->input->post('function2_macro', TRUE);
|
2023-07-31 15:52:32 +01:00
|
|
|
|
2025-10-10 15:19:42 +01:00
|
|
|
$function3_name = $this->input->post('function3_name', TRUE);
|
|
|
|
|
$function3_macro = $this->input->post('function3_macro', TRUE);
|
2023-07-31 15:52:32 +01:00
|
|
|
|
2025-10-10 15:19:42 +01:00
|
|
|
$function4_name = $this->input->post('function4_name', TRUE);
|
|
|
|
|
$function4_macro = $this->input->post('function4_macro', TRUE);
|
2023-07-31 15:52:32 +01:00
|
|
|
|
2025-10-10 15:19:42 +01:00
|
|
|
$function5_name = $this->input->post('function5_name', TRUE);
|
|
|
|
|
$function5_macro = $this->input->post('function5_macro', TRUE);
|
|
|
|
|
|
|
|
|
|
// Set empty strings for null values
|
|
|
|
|
$function1_name = $function1_name ? $function1_name : '';
|
|
|
|
|
$function1_macro = $function1_macro ? $function1_macro : '';
|
|
|
|
|
$function2_name = $function2_name ? $function2_name : '';
|
|
|
|
|
$function2_macro = $function2_macro ? $function2_macro : '';
|
|
|
|
|
$function3_name = $function3_name ? $function3_name : '';
|
|
|
|
|
$function3_macro = $function3_macro ? $function3_macro : '';
|
|
|
|
|
$function4_name = $function4_name ? $function4_name : '';
|
|
|
|
|
$function4_macro = $function4_macro ? $function4_macro : '';
|
|
|
|
|
$function5_name = $function5_name ? $function5_name : '';
|
|
|
|
|
$function5_macro = $function5_macro ? $function5_macro : '';
|
|
|
|
|
|
|
|
|
|
// Basic validation
|
|
|
|
|
if (!$this->session->userdata('user_id')) {
|
|
|
|
|
throw new Exception('User not logged in');
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-10 18:01:31 +01:00
|
|
|
// Load stations model to get active station profile
|
|
|
|
|
$this->load->model('stations');
|
|
|
|
|
$active_station_id = $this->stations->find_active();
|
|
|
|
|
|
|
|
|
|
if (!$active_station_id || $active_station_id === '0') {
|
|
|
|
|
throw new Exception('No active station profile found. Please set an active station profile.');
|
2025-10-10 15:19:42 +01:00
|
|
|
}
|
2023-07-31 15:52:32 +01:00
|
|
|
|
2025-10-10 15:38:24 +01:00
|
|
|
$data = [
|
2023-07-31 15:52:32 +01:00
|
|
|
'user_id' => $this->session->userdata('user_id'),
|
2025-10-10 18:01:31 +01:00
|
|
|
'station_location_id' => $active_station_id,
|
2023-07-31 15:52:32 +01:00
|
|
|
'function1_name' => $function1_name,
|
|
|
|
|
'function1_macro' => $function1_macro,
|
|
|
|
|
'function2_name' => $function2_name,
|
|
|
|
|
'function2_macro' => $function2_macro,
|
|
|
|
|
'function3_name' => $function3_name,
|
|
|
|
|
'function3_macro' => $function3_macro,
|
|
|
|
|
'function4_name' => $function4_name,
|
|
|
|
|
'function4_macro' => $function4_macro,
|
|
|
|
|
'function5_name' => $function5_name,
|
|
|
|
|
'function5_macro' => $function5_macro,
|
|
|
|
|
];
|
2025-10-10 14:54:50 +01:00
|
|
|
|
|
|
|
|
// Debug: Log the data being saved
|
|
|
|
|
log_message('debug', 'CW Macros Save Data: ' . print_r($data, true));
|
2023-07-31 15:52:32 +01:00
|
|
|
|
2025-10-10 15:38:24 +01:00
|
|
|
// Load model Winkey
|
|
|
|
|
$this->load->model('winkey');
|
2023-07-31 15:52:32 +01:00
|
|
|
|
2025-10-10 15:38:24 +01:00
|
|
|
// save the data
|
2025-10-10 14:54:50 +01:00
|
|
|
$this->winkey->save($data);
|
|
|
|
|
|
|
|
|
|
// Return a proper success message with proper HTML
|
|
|
|
|
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
|
|
|
<i class="fas fa-check-circle"></i> <strong>Success!</strong> CW Macros saved successfully! The button labels will update when you close this dialog.
|
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
|
|
|
</div>';
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
// Return error message if save fails
|
|
|
|
|
echo '<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
2025-10-10 15:19:42 +01:00
|
|
|
<i class="fas fa-exclamation-triangle"></i> <strong>Error!</strong> Failed to save macros: ' . htmlspecialchars($e->getMessage()) . '
|
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
|
|
|
</div>';
|
|
|
|
|
} catch (Throwable $t) {
|
|
|
|
|
// Catch any other errors
|
|
|
|
|
log_message('error', 'CW Macros Save Error: ' . $t->getMessage() . ' - File: ' . $t->getFile() . ' - Line: ' . $t->getLine());
|
|
|
|
|
echo '<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
|
|
|
|
<i class="fas fa-exclamation-triangle"></i> <strong>Error!</strong> An unexpected error occurred while saving macros.
|
2025-10-10 14:54:50 +01:00
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
|
|
|
</div>';
|
|
|
|
|
}
|
2023-05-17 21:19:18 +01:00
|
|
|
}
|
|
|
|
|
|
2025-10-10 15:38:24 +01:00
|
|
|
public function cwmacros_test() {
|
2025-10-10 15:19:42 +01:00
|
|
|
try {
|
2025-10-10 18:01:31 +01:00
|
|
|
$this->load->model('stations');
|
|
|
|
|
$active_station_id = $this->stations->find_active();
|
|
|
|
|
echo "Test successful - User ID: " . $this->session->userdata('user_id') . " Active Station ID: " . $active_station_id;
|
2025-10-10 15:19:42 +01:00
|
|
|
} catch (Exception $e) {
|
|
|
|
|
echo "Error: " . $e->getMessage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-10 15:38:24 +01:00
|
|
|
public function cwmacros_json() {
|
2025-10-10 15:19:42 +01:00
|
|
|
try {
|
|
|
|
|
// Load model Winkey
|
|
|
|
|
$this->load->model('winkey');
|
2023-08-01 11:40:32 +01:00
|
|
|
|
2025-10-10 15:19:42 +01:00
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
2023-08-01 11:40:32 +01:00
|
|
|
|
2025-10-10 15:19:42 +01:00
|
|
|
$user_id = $this->session->userdata('user_id');
|
|
|
|
|
|
|
|
|
|
if (!$user_id) {
|
|
|
|
|
echo json_encode(['status' => 'error', 'message' => 'User not logged in']);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-10 18:01:31 +01:00
|
|
|
// Load stations model to get active station profile
|
|
|
|
|
$this->load->model('stations');
|
|
|
|
|
$station_id = $this->stations->find_active();
|
|
|
|
|
|
|
|
|
|
if (!$station_id || $station_id === '0') {
|
|
|
|
|
echo json_encode(['status' => 'error', 'message' => 'No active station profile']);
|
2025-10-10 15:19:42 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Call settings_json from model winkey
|
|
|
|
|
echo $this->winkey->settings_json($user_id, $station_id);
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
|
echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
|
|
|
|
|
}
|
2023-08-01 11:40:32 +01:00
|
|
|
}
|
|
|
|
|
|
2025-10-10 15:38:24 +01:00
|
|
|
public function edit_ajax() {
|
2020-08-24 20:16:06 +02:00
|
|
|
|
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
$this->load->model('user_model');
|
2020-09-15 21:02:36 +02:00
|
|
|
$this->load->model('modes');
|
2022-09-09 23:11:52 +02:00
|
|
|
$this->load->model('bands');
|
2021-08-20 12:49:57 +02:00
|
|
|
$this->load->model('contesting_model');
|
2020-08-24 20:16:06 +02:00
|
|
|
|
|
|
|
|
$this->load->library('form_validation');
|
|
|
|
|
|
2020-08-25 22:03:54 +02:00
|
|
|
if(!$this->user_model->authorize(2)) {
|
|
|
|
|
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$id = str_replace('"', "", $this->input->post("id"));
|
2025-12-23 11:06:19 +00:00
|
|
|
|
|
|
|
|
// Check if user has write permission to this QSO
|
|
|
|
|
if (!$this->logbook_model->check_qso_is_writable($id)) {
|
|
|
|
|
$this->session->set_flashdata('notice', 'You do not have permission to edit this QSO');
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode(array('message' => 'not allowed'));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-25 22:03:54 +02:00
|
|
|
$query = $this->logbook_model->qso_info($id);
|
2020-08-24 20:16:06 +02:00
|
|
|
|
|
|
|
|
$data['qso'] = $query->row();
|
|
|
|
|
$data['dxcc'] = $this->logbook_model->fetchDxcc();
|
|
|
|
|
$data['iota'] = $this->logbook_model->fetchIota();
|
2020-09-15 21:02:36 +02:00
|
|
|
$data['modes'] = $this->modes->all();
|
2022-09-09 23:11:52 +02:00
|
|
|
$data['bands'] = $this->bands->get_user_bands_for_qso_entry(true);
|
2021-08-20 12:49:57 +02:00
|
|
|
$data['contest'] = $this->contesting_model->getActivecontests();
|
2020-08-24 20:16:06 +02:00
|
|
|
|
2020-08-25 22:03:54 +02:00
|
|
|
$this->load->view('qso/edit_ajax', $data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function qso_save_ajax() {
|
|
|
|
|
$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');
|
2020-08-24 20:16:06 +02:00
|
|
|
}
|
2020-08-25 22:03:54 +02:00
|
|
|
|
2025-12-23 11:06:19 +00:00
|
|
|
$qso_id = $this->input->post('id');
|
|
|
|
|
|
|
|
|
|
// Check if user has write permission to this QSO
|
|
|
|
|
if (!$this->logbook_model->check_qso_is_writable($qso_id)) {
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode(array('message' => 'not allowed'));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-25 22:03:54 +02:00
|
|
|
$this->logbook_model->edit();
|
2020-08-24 20:16:06 +02:00
|
|
|
}
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2019-06-16 15:29:31 +01:00
|
|
|
function qsl_rcvd($id, $method) {
|
2019-06-15 20:20:20 +02:00
|
|
|
$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'); }
|
|
|
|
|
|
2019-06-16 15:29:31 +01:00
|
|
|
// Update Logbook to Mark Paper Card Received
|
|
|
|
|
|
|
|
|
|
$this->logbook_model->paperqsl_update($id, $method);
|
|
|
|
|
|
|
|
|
|
$this->session->set_flashdata('notice', 'QSL Card: Marked as Received');
|
|
|
|
|
|
|
|
|
|
redirect('logbook');
|
2019-06-15 20:20:20 +02:00
|
|
|
}
|
2020-08-24 20:16:06 +02:00
|
|
|
|
|
|
|
|
function qsl_rcvd_ajax() {
|
|
|
|
|
$id = str_replace('"', "", $this->input->post("id"));
|
|
|
|
|
$method = str_replace('"', "", $this->input->post("method"));
|
|
|
|
|
|
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
$this->load->model('user_model');
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
|
|
|
|
|
if(!$this->user_model->authorize(2)) {
|
|
|
|
|
echo json_encode(array('message' => 'Error'));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Update Logbook to Mark Paper Card Received
|
|
|
|
|
$this->logbook_model->paperqsl_update($id, $method);
|
|
|
|
|
|
|
|
|
|
echo json_encode(array('message' => 'OK'));
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2021-11-15 20:38:17 +01:00
|
|
|
function qsl_sent_ajax() {
|
|
|
|
|
$id = str_replace('"', "", $this->input->post("id"));
|
|
|
|
|
$method = str_replace('"', "", $this->input->post("method"));
|
|
|
|
|
|
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
$this->load->model('user_model');
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
|
|
|
|
|
if(!$this->user_model->authorize(2)) {
|
|
|
|
|
echo json_encode(array('message' => 'Error'));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Update Logbook to Mark Paper Card Sent
|
|
|
|
|
$this->logbook_model->paperqsl_update_sent($id, $method);
|
|
|
|
|
|
|
|
|
|
echo json_encode(array('message' => 'OK'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-11 16:05:49 +01:00
|
|
|
function qsl_requested_ajax() {
|
|
|
|
|
$id = str_replace('"', "", $this->input->post("id"));
|
|
|
|
|
$method = str_replace('"', "", $this->input->post("method"));
|
|
|
|
|
|
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
$this->load->model('user_model');
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
|
|
|
|
|
if(!$this->user_model->authorize(2)) {
|
|
|
|
|
echo json_encode(array('message' => 'Error'));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Update Logbook to Mark Paper Card Received
|
|
|
|
|
$this->logbook_model->paperqsl_requested($id, $method);
|
|
|
|
|
|
|
|
|
|
echo json_encode(array('message' => 'OK'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-10 15:38:24 +01:00
|
|
|
public function qsl_ignore_ajax() {
|
2021-06-11 16:14:34 +01:00
|
|
|
$id = str_replace('"', "", $this->input->post("id"));
|
|
|
|
|
$method = str_replace('"', "", $this->input->post("method"));
|
|
|
|
|
|
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
$this->load->model('user_model');
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
|
|
|
|
|
if(!$this->user_model->authorize(2)) {
|
|
|
|
|
echo json_encode(array('message' => 'Error'));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Update Logbook to Mark Paper Card Received
|
|
|
|
|
$this->logbook_model->paperqsl_ignore($id, $method);
|
|
|
|
|
|
|
|
|
|
echo json_encode(array('message' => 'OK'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-28 14:51:57 +01:00
|
|
|
/* Delete QSO */
|
2025-10-10 15:38:24 +01:00
|
|
|
public function delete($id) {
|
2011-08-28 14:51:57 +01:00
|
|
|
$this->load->model('logbook_model');
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2025-12-23 11:06:19 +00:00
|
|
|
if ($this->logbook_model->check_qso_is_writable($id)) {
|
2023-07-31 05:03:05 +00:00
|
|
|
$this->logbook_model->delete($id);
|
|
|
|
|
$this->session->set_flashdata('notice', 'QSO Deleted Successfully');
|
|
|
|
|
$data['message_title'] = "Deleted";
|
|
|
|
|
$data['message_contents'] = "QSO Deleted Successfully";
|
|
|
|
|
$this->load->view('messages/message', $data);
|
2025-12-23 11:06:19 +00:00
|
|
|
} else {
|
|
|
|
|
$this->session->set_flashdata('notice', 'You do not have permission to delete this QSO');
|
|
|
|
|
$data['message_title'] = "Permission Denied";
|
|
|
|
|
$data['message_contents'] = "You do not have permission to delete this QSO";
|
|
|
|
|
$this->load->view('messages/message', $data);
|
2023-07-31 05:03:05 +00:00
|
|
|
}
|
2019-06-23 16:11:55 +01:00
|
|
|
|
|
|
|
|
// If deletes from /logbook dropdown redirect
|
|
|
|
|
if (strpos($_SERVER['HTTP_REFERER'], '/logbook') !== false) {
|
|
|
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
|
|
|
}
|
2011-04-25 16:24:01 +01:00
|
|
|
}
|
2020-08-24 20:16:06 +02:00
|
|
|
|
|
|
|
|
/* Delete QSO */
|
2025-10-10 15:38:24 +01:00
|
|
|
public function delete_ajax() {
|
2020-08-24 20:16:06 +02:00
|
|
|
$id = str_replace('"', "", $this->input->post("id"));
|
|
|
|
|
|
|
|
|
|
$this->load->model('logbook_model');
|
2025-12-23 11:06:19 +00:00
|
|
|
if ($this->logbook_model->check_qso_is_writable($id)) {
|
2023-07-31 05:03:05 +00:00
|
|
|
$this->logbook_model->delete($id);
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode(array('message' => 'OK'));
|
|
|
|
|
} else {
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode(array('message' => 'not allowed'));
|
|
|
|
|
}
|
2020-08-24 20:16:06 +02:00
|
|
|
}
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2025-10-10 15:38:24 +01:00
|
|
|
public function band_to_freq($band, $mode) {
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2011-09-13 18:01:19 +01:00
|
|
|
$this->load->library('frequency');
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2022-07-09 20:15:57 +02:00
|
|
|
echo $this->frequency->convert_band($band, $mode);
|
2011-09-13 18:01:19 +01:00
|
|
|
}
|
2021-01-15 23:55:53 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Function is used for autocompletion of SOTA in the QSO entry form
|
|
|
|
|
*/
|
|
|
|
|
public function get_sota() {
|
2022-08-17 22:15:06 +02:00
|
|
|
$this->load->library('sota');
|
|
|
|
|
$json = [];
|
2021-01-15 23:55:53 +01:00
|
|
|
|
2022-08-17 22:15:06 +02:00
|
|
|
if (!empty($this->input->get("query"))) {
|
|
|
|
|
$query = $_GET['query'] ?? FALSE;
|
|
|
|
|
$json = $this->sota->get($query);
|
|
|
|
|
}
|
2021-01-15 23:55:53 +01:00
|
|
|
|
2022-08-17 22:15:06 +02:00
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode($json);
|
|
|
|
|
}
|
2021-01-20 12:56:53 +01:00
|
|
|
|
2022-08-15 16:04:33 +02:00
|
|
|
public function get_wwff() {
|
|
|
|
|
$json = [];
|
|
|
|
|
|
|
|
|
|
if(!empty($this->input->get("query"))) {
|
|
|
|
|
$query = isset($_GET['query']) ? $_GET['query'] : FALSE;
|
|
|
|
|
$wwff = strtoupper($query);
|
|
|
|
|
|
|
|
|
|
$file = 'assets/json/wwff.txt';
|
|
|
|
|
|
|
|
|
|
if (is_readable($file)) {
|
|
|
|
|
$lines = file($file, FILE_IGNORE_NEW_LINES);
|
|
|
|
|
$input = preg_quote($wwff, '~');
|
|
|
|
|
$reg = '~^'. $input .'(.*)$~';
|
|
|
|
|
$result = preg_grep($reg, $lines);
|
|
|
|
|
$json = [];
|
|
|
|
|
$i = 0;
|
|
|
|
|
foreach ($result as &$value) {
|
|
|
|
|
// Limit to 100 as to not slowdown browser too much
|
|
|
|
|
if (count($json) <= 100) {
|
2021-01-15 23:55:53 +01:00
|
|
|
$json[] = ["name"=>$value];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode($json);
|
|
|
|
|
}
|
2021-01-20 12:56:53 +01:00
|
|
|
|
2022-10-05 17:05:53 +02:00
|
|
|
public function get_pota() {
|
|
|
|
|
$json = [];
|
|
|
|
|
|
|
|
|
|
if(!empty($this->input->get("query"))) {
|
|
|
|
|
$query = isset($_GET['query']) ? $_GET['query'] : FALSE;
|
|
|
|
|
$pota = strtoupper($query);
|
|
|
|
|
|
|
|
|
|
$file = 'assets/json/pota.txt';
|
|
|
|
|
|
|
|
|
|
if (is_readable($file)) {
|
|
|
|
|
$lines = file($file, FILE_IGNORE_NEW_LINES);
|
|
|
|
|
$input = preg_quote($pota, '~');
|
|
|
|
|
$reg = '~^'. $input .'(.*)$~';
|
|
|
|
|
$result = preg_grep($reg, $lines);
|
|
|
|
|
$json = [];
|
|
|
|
|
$i = 0;
|
|
|
|
|
foreach ($result as &$value) {
|
2022-08-15 16:04:33 +02:00
|
|
|
// Limit to 100 as to not slowdown browser too much
|
|
|
|
|
if (count($json) <= 100) {
|
2021-01-15 23:55:53 +01:00
|
|
|
$json[] = ["name"=>$value];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode($json);
|
|
|
|
|
}
|
2021-01-20 12:56:53 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Function is used for autocompletion of DOK in the QSO entry form
|
|
|
|
|
*/
|
|
|
|
|
public function get_dok() {
|
|
|
|
|
$json = [];
|
|
|
|
|
|
|
|
|
|
if(!empty($this->input->get("query"))) {
|
|
|
|
|
$query = isset($_GET['query']) ? $_GET['query'] : FALSE;
|
2021-02-04 16:46:11 +01:00
|
|
|
$dok = strtoupper($query);
|
2021-01-20 12:56:53 +01:00
|
|
|
|
|
|
|
|
$file = 'assets/json/dok.txt';
|
|
|
|
|
|
|
|
|
|
if (is_readable($file)) {
|
|
|
|
|
$lines = file($file, FILE_IGNORE_NEW_LINES);
|
2021-02-04 16:46:11 +01:00
|
|
|
$input = preg_quote($dok, '~');
|
2021-01-20 12:56:53 +01:00
|
|
|
$reg = '~^'. $input .'(.*)$~';
|
|
|
|
|
$result = preg_grep($reg, $lines);
|
|
|
|
|
$json = [];
|
|
|
|
|
$i = 0;
|
|
|
|
|
foreach ($result as &$value) {
|
|
|
|
|
// Limit to 100 as to not slowdown browser too much
|
|
|
|
|
if (count($json) <= 100) {
|
|
|
|
|
$json[] = ["name"=>$value];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode($json);
|
|
|
|
|
}
|
2021-01-31 15:02:23 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Function is used for autocompletion of Counties in the station profile form
|
|
|
|
|
*/
|
|
|
|
|
public function get_county() {
|
|
|
|
|
$json = [];
|
|
|
|
|
|
|
|
|
|
if(!empty($this->input->get("query"))) {
|
|
|
|
|
//$query = isset($_GET['query']) ? $_GET['query'] : FALSE;
|
|
|
|
|
$county = $this->input->get("state");
|
|
|
|
|
$cleanedcounty = explode('(', $county);
|
|
|
|
|
$cleanedcounty = trim($cleanedcounty[0]);
|
|
|
|
|
|
|
|
|
|
$file = 'assets/json/US_counties.csv';
|
|
|
|
|
|
|
|
|
|
if (is_readable($file)) {
|
|
|
|
|
$lines = file($file, FILE_IGNORE_NEW_LINES);
|
|
|
|
|
$input = preg_quote($cleanedcounty, '~');
|
|
|
|
|
$reg = '~^'. $input .'(.*)$~';
|
|
|
|
|
$result = preg_grep($reg, $lines);
|
|
|
|
|
$json = [];
|
|
|
|
|
$i = 0;
|
|
|
|
|
foreach ($result as &$value) {
|
|
|
|
|
$county = explode(',', $value);
|
|
|
|
|
// Limit to 100 as to not slowdown browser too much
|
2021-09-18 19:12:42 +02:00
|
|
|
if (count($json) <= 300) {
|
2021-01-31 15:02:23 +01:00
|
|
|
$json[] = ["name"=>$county[1]];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode($json);
|
|
|
|
|
}
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2022-10-19 14:52:43 +02:00
|
|
|
public function get_sota_info() {
|
|
|
|
|
$this->load->library('sota');
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2022-10-19 14:52:43 +02:00
|
|
|
$sota = xss_clean($this->input->post('sota'));
|
2021-02-26 10:37:43 +01:00
|
|
|
|
2022-10-19 14:52:43 +02:00
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo $this->sota->info($sota);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function get_wwff_info() {
|
|
|
|
|
$this->load->library('wwff');
|
|
|
|
|
|
|
|
|
|
$wwff = xss_clean($this->input->post('wwff'));
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo $this->wwff->info($wwff);
|
|
|
|
|
}
|
2022-03-28 12:41:14 +02:00
|
|
|
|
2023-05-01 21:14:30 +02:00
|
|
|
public function get_pota_info() {
|
|
|
|
|
$this->load->library('pota');
|
|
|
|
|
|
|
|
|
|
$pota = xss_clean($this->input->post('pota'));
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo $this->pota->info($pota);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-27 23:02:57 +02:00
|
|
|
public function get_station_power() {
|
|
|
|
|
$this->load->model('stations');
|
|
|
|
|
$stationProfile = xss_clean($this->input->post('stationProfile'));
|
|
|
|
|
$data = array('station_power' => $this->stations->get_station_power($stationProfile));
|
|
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-17 13:59:18 +01:00
|
|
|
// Return Previous QSOs Made in the active logbook
|
|
|
|
|
public function component_past_contacts() {
|
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
|
|
|
|
|
2026-03-26 22:26:47 +00:00
|
|
|
$limit = 5;
|
|
|
|
|
$page = $this->input->get('page') ? (int)$this->input->get('page') : 0;
|
|
|
|
|
$offset = $page * $limit;
|
|
|
|
|
|
|
|
|
|
$data['query'] = $this->logbook_model->last_custom_paginated($limit, $offset);
|
|
|
|
|
$data['total_rows'] = $this->logbook_model->last_custom_count();
|
|
|
|
|
$data['total_pages'] = ceil($data['total_rows'] / $limit);
|
|
|
|
|
$data['current_page'] = $page;
|
|
|
|
|
$data['limit'] = $limit;
|
2023-08-17 13:59:18 +01:00
|
|
|
|
|
|
|
|
// Load view
|
|
|
|
|
$this->load->view('qso/components/previous_contacts', $data);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 12:41:14 +02:00
|
|
|
function check_locator($grid) {
|
|
|
|
|
$grid = $this->input->post('locator');
|
|
|
|
|
// Allow empty locator
|
|
|
|
|
if (preg_match('/^$/', $grid)) return true;
|
|
|
|
|
// Allow 6-digit locator
|
2023-12-13 07:13:55 +01:00
|
|
|
if (preg_match('/^[A-Ra-r]{2}[0-9]{2}[A-Xa-x]{2}$/', $grid)) return true;
|
2022-03-28 12:41:14 +02:00
|
|
|
// Allow 4-digit locator
|
|
|
|
|
else if (preg_match('/^[A-Ra-r]{2}[0-9]{2}$/', $grid)) return true;
|
|
|
|
|
// Allow 4-digit grid line
|
|
|
|
|
else if (preg_match('/^[A-Ra-r]{2}[0-9]{2},[A-Ra-r]{2}[0-9]{2}$/', $grid)) return true;
|
|
|
|
|
// Allow 4-digit grid corner
|
|
|
|
|
else if (preg_match('/^[A-Ra-r]{2}[0-9]{2},[A-Ra-r]{2}[0-9]{2},[A-Ra-r]{2}[0-9]{2},[A-Ra-r]{2}[0-9]{2}$/', $grid)) return true;
|
|
|
|
|
// Allow 2-digit locator
|
|
|
|
|
else if (preg_match('/^[A-Ra-r]{2}$/', $grid)) return true;
|
|
|
|
|
// Allow 8-digit locator
|
2023-12-13 07:13:55 +01:00
|
|
|
else if (preg_match('/^[A-Ra-r]{2}[0-9]{2}[A-Xa-x]{2}[0-9]{2}$/', $grid)) return true;
|
|
|
|
|
// Allow 10-digit locator
|
|
|
|
|
else if (preg_match('/^[A-Ra-r]{2}[0-9]{2}[A-Xa-x]{2}[0-9]{2}[A-Xa-x]{2}$/', $grid)) return true;
|
2022-03-28 12:41:14 +02:00
|
|
|
else {
|
|
|
|
|
$this->form_validation->set_message('check_locator', 'Please check value for grid locator ('.strtoupper($grid).').');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-08-19 17:12:13 +01:00
|
|
|
}
|