From 8f1dcf3db62c5da2b73b083cf0c83b291c3b6528 Mon Sep 17 00:00:00 2001 From: Kim Huebel Date: Sun, 17 May 2020 14:57:28 +0200 Subject: [PATCH] Make modes customizable and editable As per request of some users, sometimes new modes or missing modes had to be added into the code. As that hardcoded lists are not eary maintainable, we created a new table with all modes and submodes listed and make this list editable. Now one can activate or deativate modes from beeing shown within the select- list in QSO Window. --- application/config/migration.php | 2 +- application/controllers/Mode.php | 93 +++++++++ application/controllers/Qso.php | 7 +- .../controllers/Uncfmd_Entity_Slots.php | 114 +++++++++++ application/libraries/Frequency.php | 41 ++-- .../migrations/041_create_modes_table.php | 180 ++++++++++++++++++ application/models/Modes.php | 61 ++++++ application/views/interface_assets/header.php | 6 +- application/views/mode/create.php | 64 +++++++ application/views/mode/edit.php | 69 +++++++ application/views/mode/index.php | 48 +++++ application/views/qso/index.php | 5 +- 12 files changed, 655 insertions(+), 35 deletions(-) create mode 100644 application/controllers/Mode.php create mode 100644 application/controllers/Uncfmd_Entity_Slots.php create mode 100644 application/migrations/041_create_modes_table.php create mode 100644 application/models/Modes.php create mode 100644 application/views/mode/create.php create mode 100644 application/views/mode/edit.php create mode 100644 application/views/mode/index.php diff --git a/application/config/migration.php b/application/config/migration.php index 31de43d6..37cfddba 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 40; +$config['migration_version'] = 41; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Mode.php b/application/controllers/Mode.php new file mode 100644 index 00000000..a5afe7c3 --- /dev/null +++ b/application/controllers/Mode.php @@ -0,0 +1,93 @@ +load->helper(array('form', 'url')); + + $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'); } + } + + public function index() + { + $this->load->model('modes'); + + $data['modes'] = $this->modes->all(); + + // Render Page + $data['page_title'] = "Modes"; + $this->load->view('interface_assets/header', $data); + $this->load->view('mode/index'); + $this->load->view('interface_assets/footer'); + } + + public function create() + { + $this->load->model('modes'); + $this->load->library('form_validation'); + + $this->form_validation->set_rules('mode', 'Mode', 'required'); + $this->form_validation->set_rules('qrgmode', 'QRG-Mode', 'required'); + + if ($this->form_validation->run() == FALSE) + { + $data['page_title'] = "Create Mode"; + $this->load->view('interface_assets/header', $data); + $this->load->view('mode/create'); + $this->load->view('interface_assets/footer'); + } + else + { + $this->modes->add(); + + redirect('mode'); + } + } + + public function edit($id) + { + $this->load->library('form_validation'); + + $this->load->model('modes'); + + $item_id_clean = $this->security->xss_clean($id); + + $mode_query = $this->modes->mode($item_id_clean); + + $data['my_mode'] = $mode_query->row(); + + $data['page_title'] = "Edit Mode"; + + $this->form_validation->set_rules('mode', 'Mode', 'required'); + $this->form_validation->set_rules('qrgmode', 'QRG-Mode', 'required'); + + if ($this->form_validation->run() == FALSE) + { + $this->load->view('interface_assets/header', $data); + $this->load->view('mode/edit'); + $this->load->view('interface_assets/footer'); + } + else + { + $this->modes->edit(); + + $data['notice'] = "Mode ".$this->security->xss_clean($this->input->post('mode', true))." Updated"; + + redirect('mode'); + } + } + + public function delete($id) { + $this->load->model('modes'); + $this->modes->delete($id); + + redirect('mode'); + } +} \ No newline at end of file diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 483f5d48..e69c831a 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -16,7 +16,8 @@ class QSO extends CI_Controller { $this->load->model('stations'); $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'); } + $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; @@ -24,7 +25,9 @@ class QSO extends CI_Controller { $data['radios'] = $this->cat->radios(); $data['query'] = $this->logbook_model->last_custom('5'); $data['dxcc'] = $this->logbook_model->fetchDxcc(); - $data['iota'] = $this->logbook_model->fetchIota(); + $data['iota'] = $this->logbook_model->fetchIota(); + $data['modes'] = $this->modes->active(); + $this->load->library('form_validation'); diff --git a/application/controllers/Uncfmd_Entity_Slots.php b/application/controllers/Uncfmd_Entity_Slots.php new file mode 100644 index 00000000..e197f96a --- /dev/null +++ b/application/controllers/Uncfmd_Entity_Slots.php @@ -0,0 +1,114 @@ +load->helper(array('form', 'url')); + + $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'); } + } + + public function index() + { + $this->load->model('user_model'); + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + + $data['page_title'] = "Showing unconfirmed Entities with Slots"; + + $this->load->view('interface_assets/header', $data); + $this->load->view('uncfmd_entity_slots/index'); + $this->load->view('interface_assets/footer'); + + } + + public function exportadif() + { + // Set memory limit to unlimited to allow heavy usage + ini_set('memory_limit', '-1'); + + $this->load->model('adif_data'); + + $data['qsos'] = $this->adif_data->export_printrequested(); + + $this->load->view('adif/data/exportall', $data); + } + + public function exportcsv() + { + // Set memory limit to unlimited to allow heavy usage + ini_set('memory_limit', '-1'); + + $this->load->model('logbook_model'); + + $myData = $this->logbook_model->get_qsos_for_printing(); + + // file name + $filename = 'qsl_export.csv'; + header("Content-Description: File Transfer"); + header("Content-Disposition: attachment; filename=$filename"); + header("Content-Type: application/csv;charset=iso-8859-1"); + + // file creation + $file = fopen('php://output', 'w'); + + $header = array("STATION_CALLSIGN", + "COL_CALL", + "COL_QSL_VIA", + "COL_TIME_ON", + "COL_MODE", + "COL_FREQ", + "COL_BAND", + "COL_RST_SENT", + "COL_SAT_NAME", + "COL_SAT_MODE", + "COL_QSL_RCVD", + "COL_COMMENT", + "COL_ROUTING", + "ADIF", + "ENTITY"); + + fputcsv($file, $header); + + foreach ($myData->result() as $qso) { + fputcsv($file, + array($qso->STATION_CALLSIGN, + str_replace("0", "Ø", $qso->COL_CALL), + $qso->COL_QSL_VIA!=""?"Via ".str_replace("0", "Ø", $qso->COL_QSL_VIA):"", + $qso->COL_TIME_ON, + $qso->COL_MODE, + $qso->COL_FREQ, + $qso->COL_BAND, + $qso->COL_RST_SENT, + $qso->COL_SAT_NAME, + $qso->COL_SAT_MODE, + $qso->COL_QSL_RCVD =='Y'?'TNX QSL':'PSE QSL', + $qso->COL_COMMENT, + $qso->COL_ROUTING, + $qso->ADIF, + $qso->ENTITY)); + } + + fclose($file); + exit; + } + + function qsl_printed() { + $this->load->model('qslprint_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'); } + + // Update Logbook to Mark Paper Card Received + + $this->qslprint_model->mark_qsos_printed(); + + $this->session->set_flashdata('notice', 'QSOs are marked as sent via buro'); + + redirect('logbook'); + } +} + +/* End of file Qslprint.php */ +/* Location: ./application/controllers/Qslprint.php */ \ No newline at end of file diff --git a/application/libraries/Frequency.php b/application/libraries/Frequency.php index 0c21b343..f5c52843 100644 --- a/application/libraries/Frequency.php +++ b/application/libraries/Frequency.php @@ -1,11 +1,6 @@ array( 'SSB'=>"1900000", @@ -85,32 +80,22 @@ class Frequency { 'CW'=>"10225000000") ); - /* Class to convert band and mode into a frequnecy in a format based on the specifications of the database table */ - public function convent_band($band, $mode='SSB') - { - // Modes for which we've set a frequency - $known_modes = array('SSB', 'DATA', 'CW'); - - // Data modes that are being treated as 'DATA' for frequency lookup - $data_modes = array('PSK31','PSK63','RTTY', - 'JT65','JT65B','JT6C','JT9-1','JT9','FT4','FT8', 'JS8', - 'FSK441','JTMS','ISCAT','MSK144','JTMSK', - 'QRA64','PKT','SSTV','HELL','HELL80','MFSK16', 'JT6M', 'ROS'); - - // Use 'DATA' for any of the data modes - if(in_array($mode, $data_modes)){ - $mode= "DATA"; - } - - // If the mode isn't listed, default to SSB frequency - if (!in_array($mode, $known_modes)){ - $mode = 'SSB'; - } + /* Class to convert band and mode into a frequency in a format based on the specifications of the database table */ + public function convent_band($band, $mode='SSB') { + // Converting LSB and USB to SSB + if($mode =='LSB' or $mode =='USB'){ + $mode= "SSB"; + } + + // Use 'DATA' for any of the data modes + if($mode !='CW' and $mode !='SSB'){ + $mode= "DATA"; + } return $this->defaultFrequencies[$band][$mode]; - } + } - public function GetBand($Frequency) { + public function GetBand($Frequency) { $Band = NULL; if ($Frequency > 1000000 && $Frequency < 2000000) { $Band = "160m"; diff --git a/application/migrations/041_create_modes_table.php b/application/migrations/041_create_modes_table.php new file mode 100644 index 00000000..1d28ff0d --- /dev/null +++ b/application/migrations/041_create_modes_table.php @@ -0,0 +1,180 @@ +dbforge->add_field('id'); + + $this->dbforge->add_field(array( + 'mode' => array( + 'type' => 'VARCHAR', + 'constraint' => 12, + ), + 'qrgmode' => array( + 'type' => 'VARCHAR', + 'constraint' => 4, + ), + 'active' => array( + 'type' => 'INT', + ), + )); + $this->dbforge->create_table('adif_modes'); + + + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('AM', 'SSB', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('AMTORFEC', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('ARDOP', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('ASCI', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('ATV', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('C4FM', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('CHIP', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('CHIP128', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('CHIP64', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('CLO', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('CONTESTI', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('CW', 'CW', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('DIGITALVOICE', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('DOMINO', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('DOMINOEX', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('DOMINOF', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('DSTAR', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('FAX', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('FM', 'SSB', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('FMHELL', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('FSK31', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('FSK441', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('FSKHELL', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('FSQCALL', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('FT4', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('FT8', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('GTOR', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('HELL', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('HELL80', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('HFSK', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('ISCAT', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('ISCAT-A', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('ISCAT-B', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JS8', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT4', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT44', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT4A', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT4B', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT4C', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT4D', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT4E', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT4F', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT4G', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT65', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT65A', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT65B', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT65B2', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT65C', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT65C2', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT6C', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT6M', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9-1', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9-10', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9-2', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9-30', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9-5', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9A', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9B', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9C', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9D', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9E', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9E FAST', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9F', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9F FAST', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9G', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9G FAST', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9H', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JT9H FAST', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JTMS', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('JTMSK', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('LSB', 'SSB', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MFSK', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MFSK11', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MFSK128', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MFSK16', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MFSK22', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MFSK31', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MFSK32', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MFSK4', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MFSK64', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MFSK8', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MSK144', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('MT63', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OLIVIA', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OLIVIA 16/1000', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OLIVIA 16/500', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OLIVIA 32/1000', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OLIVIA 4/125', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OLIVIA 4/250', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OLIVIA 8/250', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OLIVIA 8/500', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OPERA', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OPERA-BEACON', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('OPERA-QSO', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PAC', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PAC2', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PAC3', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PAC4', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PAX', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PAX2', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PCW', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PKT', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSK', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSK10', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSK1000', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSK125', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSK250', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSK2K', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSK31', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSK500', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSK63', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSK63F', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSKAM10', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSKAM31', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSKAM50', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSKFEC31', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('PSKHELL', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('Q15', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QPSK125', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QPSK250', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QPSK31', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QPSK500', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QPSK63', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QRA64', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QRA64A', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QRA64B', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QRA64C', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QRA64D', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('QRA64E', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('ROS', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('ROS-EME', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('ROS-HF', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('ROS-MF', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('RTTY', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('RTTYM', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('SIM31', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('SSB', 'SSB', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('SSTV', 'DATA', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('T10', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('THOR', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('THRB', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('THRBX', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('TOR', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('USB', 'SSB', 1);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('V4', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('VOI', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('WINMOR', 'DATA', 0);"); + $this->db->query("INSERT INTO `adif_modes` (`mode`, `qrgmode`, `active`) VALUES ('WSPR', 'DATA', 0);"); + } + + public function down(){ + $this->dbforge->drop_table('config'); + } +} diff --git a/application/models/Modes.php b/application/models/Modes.php new file mode 100644 index 00000000..1cdba3a3 --- /dev/null +++ b/application/models/Modes.php @@ -0,0 +1,61 @@ +db->get('adif_modes'); + } + + function active() { + $this->db->where('active', 1); + return $this->db->get('adif_modes'); + } + + function mode($id) { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + + $this->db->where('id', $clean_id); + return $this->db->get('adif_modes'); + } + + + function add() { + $data = array( + 'mode' => xss_clean($this->input->post('mode', true)), + 'qrgmode' => xss_clean(strtoupper($this->input->post('qrgmode', true))), + 'active' => xss_clean($this->input->post('active', true)), + ); + + $this->db->insert('adif_modes', $data); + } + + function edit() { + $data = array( + 'mode' => xss_clean($this->input->post('mode', true)), + 'qrgmode' => xss_clean(strtoupper($this->input->post('qrgmode', true))), + 'active' => xss_clean($this->input->post('active', true)), + ); + + $this->db->where('id', xss_clean($this->input->post('id', true))); + $this->db->update('adif_modes', $data); + } + + function delete($id) { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + // Delete Mode + $this->db->delete('adif_modes', array('id' => $clean_id)); + } + +} + +?> \ No newline at end of file diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 5652842e..004804e4 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -94,7 +94,11 @@ Station Profiles - + + + QSO Modes + + Radio Interface diff --git a/application/views/mode/create.php b/application/views/mode/create.php new file mode 100644 index 00000000..9fbca43b --- /dev/null +++ b/application/views/mode/create.php @@ -0,0 +1,64 @@ + +
+ +
+ session->flashdata('message')) { ?> + +
+

session->flashdata('message'); ?>

+
+ + +
+
+ +
+
+
+

+ + session->flashdata('notice')) { ?> +
+ session->flashdata('notice'); ?> +
+ + + load->helper('form'); ?> + + + +
+
+ + + Name of mode in ADIF-specification +
+ +
+ + + Defines the QRG-segment in bandplan. +
+ +
+ + + Set to active if to be listed in Modes-list +
+ + + +
+
+
+ +
+ +
\ No newline at end of file diff --git a/application/views/mode/edit.php b/application/views/mode/edit.php new file mode 100644 index 00000000..0af93685 --- /dev/null +++ b/application/views/mode/edit.php @@ -0,0 +1,69 @@ + +
+ +
+ session->flashdata('message')) { ?> + +
+

session->flashdata('message'); ?>

+
+ + +
+
+ mode; ?> +
+
+
+

+ session->flashdata('notice')) { ?> +
+ session->flashdata('notice'); ?> +
+ + + load->helper('form'); ?> + + + +
+ + +
+ + mode; } ?>" required> + Name of mode in ADIF-specification +
+ +
+ + + Defines the QRG-segment in bandplan. +
+ +
+ + + Set to active if to be listed in Modes-list +
+ + + +
+
+
+ +
+ +
\ No newline at end of file diff --git a/application/views/mode/index.php b/application/views/mode/index.php new file mode 100644 index 00000000..f414f245 --- /dev/null +++ b/application/views/mode/index.php @@ -0,0 +1,48 @@ +
+ +
+ session->flashdata('message')) { ?> + +
+

session->flashdata('message'); ?>

+
+ + +
+
+ +
+
+

This is the place you can customize your modes-list by activating/deactivating modes to be shown in the select-list.

+ + + + + + + + + + + + result() as $row) { ?> + + + + + + + + + + +
ModeSSB/DATA/CWActive
mode;?> (#id;?>)qrgmode;?>active == 1) { echo "active";} else { echo "not active";};?> + id; ?>" class="btn btn-info btn-sm"> Edit + + id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete mode mode; ?> ');"> Delete
+

Create a Mode

+ + + + + \ No newline at end of file diff --git a/application/views/qso/index.php b/application/views/qso/index.php index f16347f4..4ebfc69b 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -66,9 +66,8 @@