mirror of
https://github.com/magicbug/Cloudlog
synced 2026-08-13 17:49:35 -04:00
Introduces a new section in the maintenance page allowing manual updates of reference data files (Clublog SCP, LoTW Users, DOK, SOTA, WWFF, POTA) via AJAX buttons with loading indicators. Adds corresponding UI-friendly controller methods with authorization checks and improves the WWFF update logic to process CSV files line by line for better memory efficiency.
54 lines
1.8 KiB
PHP
54 lines
1.8 KiB
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class Maintenance extends CI_Controller {
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/* User Facing Links to Maintenance URLs */
|
|
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'); }
|
|
$this->load->model('Logbook_model');
|
|
$this->load->model('Stations');
|
|
$data['stations']=$this->Stations->all();
|
|
$data['page_title'] = "Maintenance";
|
|
$data['qsos_with_no_station_id'] = $this->Logbook_model->check_for_station_id();
|
|
if ($data['qsos_with_no_station_id']) {
|
|
$data['calls_wo_sid']=$this->Logbook_model->calls_without_station_id();
|
|
}
|
|
$this->load->view('interface_assets/header', $data);
|
|
$this->load->view('maintenance/main');
|
|
$this->load->view('interface_assets/footer');
|
|
}
|
|
|
|
public function reassign() {
|
|
$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'); }
|
|
$this->load->model('Logbook_model');
|
|
$this->load->model('Stations');
|
|
$call = xss_clean(($this->input->post('call')));
|
|
$qsoids = xss_clean(($this->input->post('qsoids')));
|
|
$station_profile_id = xss_clean(($this->input->post('station_id')));
|
|
|
|
// Check if target-station-id exists
|
|
$allowed=false;
|
|
$status=false;
|
|
$stations=$this->Stations->all();
|
|
foreach ($stations->result() as $station) {
|
|
if ($station->station_id == $station_profile_id) { $allowed=true; }
|
|
}
|
|
if ($allowed) {
|
|
$status=$this->Logbook_model->update_station_ids($station_profile_id,$call,$qsoids);
|
|
} else {
|
|
$status=false;
|
|
}
|
|
|
|
header('Content-Type: application/json');
|
|
echo json_encode(array('status' => $status));
|
|
return;
|
|
|
|
}
|
|
|
|
}
|