[SimpleFLE] Replaced hardcoded bands with bands from db

这个提交包含在:
Andreas 2023-10-26 19:59:02 +02:00
父节点 50551441a1
当前提交 587660383e
共有 3 个文件被更改,包括 23 次插入77 次删除

查看文件

@ -6,19 +6,19 @@ class SimpleFLE extends CI_Controller {
$this->load->model('user_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'); } if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$this->load->model('stations'); $this->load->model('stations');
$this->load->model('logbook_model'); $this->load->model('logbook_model');
$this->load->model('modes'); $this->load->model('modes');
$this->load->model('bands'); $this->load->model('bands');
$data['station_profile'] = $this->stations->all_of_user(); // Used in the view for station location select $data['station_profile'] = $this->stations->all_of_user(); // Used in the view for station location select
$data['bands'] = $this->bands->get_all_bands_for_user(); // Fetching Bands for FLE $data['bands'] = $this->bands->get_all_bands(); // Fetching Bands for FLE
$data['active_station_profile'] = $this->stations->find_active(); // Prepopulate active Station in Station Location Selector $data['active_station_profile'] = $this->stations->find_active(); // Prepopulate active Station in Station Location Selector
$data['page_title'] = "Simple Fast Log Entry"; $data['page_title'] = "Simple Fast Log Entry";
$footerData = []; $footerData = [];
$footerData['scripts'] = [ $footerData['scripts'] = [
'assets/js/moment.min.js', 'assets/js/moment.min.js',
@ -36,4 +36,4 @@ class SimpleFLE extends CI_Controller {
public function displaySyntax() { public function displaySyntax() {
$this->load->view('simplefle/syntax_help'); $this->load->view('simplefle/syntax_help');
} }
} }

查看文件

@ -37,7 +37,7 @@ class Bands extends CI_Model {
if ($award != 'None') { if ($award != 'None') {
$this->db->where('bandxuser.'.$award, 1); $this->db->where('bandxuser.'.$award, 1);
} }
$result = $this->db->get()->result(); $result = $this->db->get()->result();
$results = array(); $results = array();
@ -49,6 +49,20 @@ class Bands extends CI_Model {
return $results; return $results;
} }
function get_all_bands() {
$this->db->from('bands');
$result = $this->db->get()->result();
$results = array();
foreach($result as $band) {
$results['b'.strtoupper($band->band)] = array('cw' => $band->cw, 'ssb' => $band->ssb, 'digi' => $band->data);
}
return $results;
}
function get_user_bands_for_qso_entry($includeall = false) { function get_user_bands_for_qso_entry($includeall = false) {
$this->db->from('bands'); $this->db->from('bands');
$this->db->join('bandxuser', 'bandxuser.bandid = bands.id'); $this->db->join('bandxuser', 'bandxuser.bandid = bands.id');
@ -82,7 +96,7 @@ class Bands extends CI_Model {
} }
function get_worked_bands($award = 'None') { function get_worked_bands($award = 'None') {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('logbooks_model'); $CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@ -237,7 +251,7 @@ class Bands extends CI_Model {
$clean_id = $this->security->xss_clean($id); $clean_id = $this->security->xss_clean($id);
// Delete Mode // Delete Mode
$this->db->delete('bandxuser', array('id' => $clean_id)); $this->db->delete('bandxuser', array('id' => $clean_id));
} }
function saveBand($id, $band) { function saveBand($id, $band) {
@ -287,12 +301,12 @@ class Bands extends CI_Model {
$this->db->where('band', xss_clean($this->input->post('band', true))); $this->db->where('band', xss_clean($this->input->post('band', true)));
$result = $this->db->get('bands'); $result = $this->db->get('bands');
if ($result->num_rows() == 0) { if ($result->num_rows() == 0) {
$this->db->insert('bands', $data); $this->db->insert('bands', $data);
} }
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, pota, sig, sota, uscounties, was, wwff, vucc) $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, pota, sig, sota, uscounties, was, wwff, vucc)
select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);"); select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);");
} }

查看文件

@ -1,71 +1,3 @@
var Bands = {
b160M: {
cw: "1.825",
ssb: "1.890",
digi: "1.840",
},
b80M: {
cw: "3.532",
ssb: "3.770",
digi: "3.573",
},
b60M: {
cw: "5.353",
ssb: "5.450",
digi: "5.357",
},
b40M: {
cw: "7.032",
ssb: "7.100",
digi: "7.074",
},
b30M: {
cw: "10.110",
ssb: "10.120",
digi: "10.136",
},
b20M: {
cw: "14.032",
ssb: "14.200",
digi: "14.074",
},
b17M: {
cw: "18.070",
ssb: "18.120",
digi: "18.104",
},
b15M: {
cw: "21.032",
ssb: "21.200",
digi: "21.074",
},
b12M: {
cw: "24.895",
ssb: "24.910",
digi: "24.915",
},
b10M: {
cw: "20.032",
ssb: "28.200",
digi: "28.074",
},
b6M: {
cw: "50.090",
ssb: "50.350",
digi: "50.313",
},
b2M: {
cw: "144.090",
ssb: "144.250",
digi: "144.174",
},
b70CM: {
cw: "432.050",
ssb: "432.300",
digi: "432.065",
},
};
var $textarea = $("textarea"); var $textarea = $("textarea");
var qsodate = ""; var qsodate = "";
var qsotime = ""; var qsotime = "";