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.
pull/505/head^2
Kim Huebel 2020-05-17 14:57:28 +02:00
rodzic 618194ff34
commit 8f1dcf3db6
12 zmienionych plików z 655 dodań i 35 usunięć

Wyświetl plik

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 40;
$config['migration_version'] = 41;
/*
|--------------------------------------------------------------------------

Wyświetl plik

@ -0,0 +1,93 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
Handles Displaying of information for mode tools.
*/
class Mode extends CI_Controller {
function __construct()
{
parent::__construct();
$this->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');
}
}

Wyświetl plik

@ -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');

Wyświetl plik

@ -0,0 +1,114 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Unconfirmed_Entity_Slots extends CI_Controller {
function __construct()
{
parent::__construct();
$this->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 */

Wyświetl plik

@ -1,11 +1,6 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Frequency {
const modes = array('SSB','FM','AM','CW','DSTAR','F4M','DMR','DIGITALVOICE',
'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');
public $defaultFrequencies = array(
'160m'=>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";

Wyświetl plik

@ -0,0 +1,180 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_create_modes_table extends CI_Migration {
public function up() {
$this->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');
}
}

Wyświetl plik

@ -0,0 +1,61 @@
<?php
class Modes extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function all() {
return $this->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));
}
}
?>

Wyświetl plik

@ -94,7 +94,11 @@
<a class="dropdown-item" href="<?php echo site_url('station');?>" title="Station Profiles"><i class="fas fa-home"></i> Station Profiles</a>
<div class="dropdown-divider"></div>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('mode');?>" title="QSO Modes"><i class="fas fa-broadcast-tower"></i> QSO Modes</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('radio');?>" title="External Radios"><i class="fas fa-broadcast-tower"></i> Radio Interface</a>

Wyświetl plik

@ -0,0 +1,64 @@
<div class="container" id="create_mode">
<br>
<?php if($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">
<p><?php echo $this->session->flashdata('message'); ?></p>
</div>
<?php } ?>
<div class="card">
<div class="card-header">
<?php echo $page_title; ?>
</div>
<div class="card-body">
<h5 class="card-title"></h5>
<p class="card-text"></p>
<?php if($this->session->flashdata('notice')) { ?>
<div id="message" >
<?php echo $this->session->flashdata('notice'); ?>
</div>
<?php } ?>
<?php $this->load->helper('form'); ?>
<?php echo validation_errors(); ?>
<form method="post" action="<?php echo site_url('mode/create'); ?>" name="create_profile">
<div class="form-group">
<label for="modeInput">ADIF Mode</label>
<input type="text" class="form-control" name="mode" id="modeInput" aria-describedby="modeInputHelp" required>
<small id="modeInputHelp" class="form-text text-muted">Name of mode in ADIF-specification</small>
</div>
<div class="form-group">
<label for="qrgmodeInput">SSB/CW/DATA</label>
<select id="qrgmodeInput" class="form-control mode form-control-sm" name="qrgmode">
<option value="CW">CW</option>
<option value="SSB">SSB</option>
<option value="DATA">DATA</option>
</select>
<small id="qrgmodeInputHelp" class="form-text text-muted">Defines the QRG-segment in bandplan.</small>
</div>
<div class="form-group">
<label for="activeInput">Active</label>
<select id="activeInput" class="form-control mode form-control-sm" name="active">
<option value="1">active</option>
<option value="0">not active</option>
</select>
<small id="activeInputHelp" class="form-text text-muted">Set to active if to be listed in Modes-list</small>
</div>
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Create mode</button>
</form>
</div>
</div>
<br>
</div>

Wyświetl plik

@ -0,0 +1,69 @@
<div class="container" id="create_mode">
<br>
<?php if($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">
<p><?php echo $this->session->flashdata('message'); ?></p>
</div>
<?php } ?>
<div class="card">
<div class="card-header">
<?php echo $page_title; ?> <?php echo $my_mode->mode; ?>
</div>
<div class="card-body">
<h5 class="card-title"></h5>
<p class="card-text"></p>
<?php if($this->session->flashdata('notice')) { ?>
<div id="message" >
<?php echo $this->session->flashdata('notice'); ?>
</div>
<?php } ?>
<?php $this->load->helper('form'); ?>
<?php echo validation_errors(); ?>
<form method="post" action="<?php echo site_url('mode/edit/'); ?><?php echo $my_mode->id; ?>" name="create_mode">
<input type="hidden" name="id" value="<?php echo $my_mode->id; ?>">
<div class="form-group">
<label for="modeInput">ADIF Mode</label>
<input type="text" class="form-control" name="mode" id="modeInput" aria-describedby="modeInputHelp" value="<?php if(set_value('mode') != "") { echo set_value('mode'); } else { echo $my_mode->mode; } ?>" required>
<small id="modeInputHelp" class="form-text text-muted">Name of mode in ADIF-specification</small>
</div>
<div class="form-group">
<label for="qrgmodeInput">SSB/CW/DATA</label>
<select id="qrgmodeInput" class="form-control mode form-control-sm" name="qrgmode">
<?php
printf("<option value=\"CW\" %s>CW</option>", $my_mode->qrgmode=="CW"?"selected=\"selected\"":"");
printf("<option value=\"SSB\" %s>SSB</option>", $my_mode->qrgmode=="SSB"?"selected=\"selected\"":"");
printf("<option value=\"DATA\" %s>DATA</option>", $my_mode->qrgmode=="DATA"?"selected=\"selected\"":"");
?>
</select>
<small id="qrgmodeInputHelp" class="form-text text-muted">Defines the QRG-segment in bandplan.</small>
</div>
<div class="form-group">
<label for="activeInput">Active</label>
<select id="activeInput" class="form-control mode form-control-sm" name="active">
<?php
printf("<option value=\"1\" %s>active</option>", $my_mode->active==1?"selected=\"selected\"":"");
printf("<option value=\"0\" %s>not active</option>", $my_mode->active==0?"selected=\"selected\"":"");
?>
</select>
<small id="activeInputHelp" class="form-text text-muted">Set to active if to be listed in Modes-list</small>
</div>
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Update mode</button>
</form>
</div>
</div>
<br>
</div>

Wyświetl plik

@ -0,0 +1,48 @@
<div class="container">
<br>
<?php if($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">
<p><?php echo $this->session->flashdata('message'); ?></p>
</div>
<?php } ?>
<div class="card">
<div class="card-header">
<?php echo $page_title; ?>
</div>
<div class="card-body">
<p class="card-text">This is the place you can customize your modes-list by activating/deactivating modes to be shown in the select-list.</p>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Mode</th>
<th scope="col">SSB/DATA/CW</th>
<th scope="col">Active</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php foreach ($modes->result() as $row) { ?>
<tr>
<td><?php echo $row->mode;?> (#<?php echo $row->id;?>)</td>
<td><?php echo $row->qrgmode;?></td>
<td><?php if ($row->active == 1) { echo "active";} else { echo "not active";};?></td>
<td>
<a href="<?php echo site_url('mode/edit')."/".$row->id; ?>" class="btn btn-info btn-sm"><i class="fas fa-edit-alt"></i> Edit</a>
</td>
<td>
<a href="<?php echo site_url('mode/delete')."/".$row->id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete mode <?php echo $row->mode; ?> ');"><i class="fas fa-trash-alt"></i> Delete</a></td>
</tr>
<?php } ?>
</tbody>
<table>
<p><a href="<?php echo site_url('mode/create'); ?>" class="btn btn-primary"><i class="fas fa-plus"></i> Create a Mode</a></p>
</div>
</div>
</div>

Wyświetl plik

@ -66,9 +66,8 @@
<label for="mode">Mode</label>
<select id="mode" class="form-control mode form-control-sm" name="mode">
<?php
$this->load->library('frequency');
foreach(Frequency::modes as $mode){
printf("<option value=\"%s\" %s>%s</option>", $mode, $this->session->userdata('mode')==$mode?"selected=\"selected\"":"",$mode);
foreach($modes->result() as $mode){
printf("<option value=\"%s\" %s>%s</option>", $mode->mode, $this->session->userdata('mode')==$mode->mode?"selected=\"selected\"":"",$mode->mode);
}
?>
</select>