mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 18:27:16 +00:00
124 lines
3.8 KiB
PHP
124 lines
3.8 KiB
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class Bandmap extends CI_Controller {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
|
|
$this->load->model('user_model');
|
|
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); }
|
|
$this->load->model('bands');
|
|
}
|
|
|
|
function index() {
|
|
$this->load->model('cat');
|
|
$this->load->model('bands');
|
|
$data['radios'] = $this->cat->radios(true);
|
|
$data['bands'] = $this->bands->get_user_bands_for_qso_entry();
|
|
|
|
$footerData = [];
|
|
$footerData['scripts'] = [
|
|
'assets/js/highcharts/highcharts.js',
|
|
'assets/js/highcharts/timeline.js',
|
|
'assets/js/highcharts/exporting.js',
|
|
'assets/js/highcharts/accessibility.js',
|
|
'assets/js/sections/bandmap.js',
|
|
];
|
|
|
|
$data['page_title'] = __("DXCluster");
|
|
$this->load->view('interface_assets/header', $data);
|
|
$this->load->view('bandmap/index');
|
|
$this->load->view('interface_assets/footer', $footerData);
|
|
}
|
|
|
|
function list() {
|
|
$this->load->model('cat');
|
|
$this->load->model('bands');
|
|
$data['radios'] = $this->cat->radios();
|
|
$data['radio_last_updated'] = $this->cat->last_updated()->row();
|
|
$data['bands'] = $this->bands->get_user_bands_for_qso_entry();
|
|
|
|
$footerData = [];
|
|
$footerData['scripts'] = [
|
|
'assets/js/moment.min.js',
|
|
'assets/js/datetime-moment.js',
|
|
];
|
|
|
|
// Get Date format
|
|
if($this->session->userdata('user_date_format')) {
|
|
// If Logged in and session exists
|
|
$pageData['custom_date_format'] = $this->session->userdata('user_date_format');
|
|
} else {
|
|
// Get Default date format from /config/wavelog.php
|
|
$pageData['custom_date_format'] = $this->config->item('qso_date_format');
|
|
}
|
|
|
|
switch ($pageData['custom_date_format']) {
|
|
case "d/m/y": $pageData['custom_date_format'] = 'DD/MM/YY'; break;
|
|
case "d/m/Y": $pageData['custom_date_format'] = 'DD/MM/YYYY'; break;
|
|
case "m/d/y": $pageData['custom_date_format'] = 'MM/DD/YY'; break;
|
|
case "m/d/Y": $pageData['custom_date_format'] = 'MM/DD/YYYY'; break;
|
|
case "d.m.Y": $pageData['custom_date_format'] = 'DD.MM.YYYY'; break;
|
|
case "y/m/d": $pageData['custom_date_format'] = 'YY/MM/DD'; break;
|
|
case "Y-m-d": $pageData['custom_date_format'] = 'YYYY-MM-DD'; break;
|
|
case "M d, Y": $pageData['custom_date_format'] = 'MMM DD, YYYY'; break;
|
|
case "M d, y": $pageData['custom_date_format'] = 'MMM DD, YY'; break;
|
|
default: $pageData['custom_date_format'] = 'DD/MM/YYYY';
|
|
}
|
|
|
|
$data['page_title'] = __("DXCluster");
|
|
$this->load->view('interface_assets/header', $data);
|
|
$this->load->view('bandmap/list',$pageData);
|
|
$this->load->view('interface_assets/footer', $footerData);
|
|
}
|
|
|
|
// Get user's favorite bands and modes (active ones)
|
|
function get_user_favorites() {
|
|
session_write_close();
|
|
|
|
$this->load->model('bands');
|
|
$this->load->model('usermodes');
|
|
|
|
// Get active bands
|
|
$activeBands = $this->bands->get_user_bands_for_qso_entry(false); // false = only active
|
|
$bandList = [];
|
|
|
|
if (is_array($activeBands)) {
|
|
foreach ($activeBands as $group => $bands) {
|
|
if (is_array($bands)) {
|
|
foreach ($bands as $band) {
|
|
$bandList[] = $band;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Get active modes (user-specific) and categorize them
|
|
$activeModes = $this->usermodes->active();
|
|
$modeCategories = [
|
|
'cw' => false,
|
|
'phone' => false,
|
|
'digi' => false
|
|
];
|
|
|
|
if ($activeModes) {
|
|
foreach ($activeModes as $mode) {
|
|
$qrgmode = strtoupper($mode->qrgmode ?? '');
|
|
if ($qrgmode === 'CW') {
|
|
$modeCategories['cw'] = true;
|
|
} elseif ($qrgmode === 'SSB') {
|
|
$modeCategories['phone'] = true;
|
|
} elseif ($qrgmode === 'DATA') {
|
|
$modeCategories['digi'] = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
header('Content-Type: application/json');
|
|
echo json_encode([
|
|
'bands' => $bandList,
|
|
'modes' => $modeCategories
|
|
]);
|
|
}
|
|
}
|