Skip to content

Commit

Permalink
Merge pull request #70 from wavelog/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
m0urs authored Jan 20, 2025
2 parents 1f88fbf + ee62f45 commit cc5ed80
Show file tree
Hide file tree
Showing 62 changed files with 13,810 additions and 11,289 deletions.
1 change: 1 addition & 0 deletions application/controllers/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ function qso($dryrun = false) {
* If the user is not the creator of the API key, it's likely a clubstation. In this case the callsign of the clubstation
* can not be the same as the callsign of the user (operator call provided by the user). If this is the case, we need to use the callsign of the creator of the API key
*/
$real_operator = null;
if ($this->config->item('special_callsign')) {
if ($userid != $created_by) {
$this->load->model('user_model');
Expand Down
122 changes: 122 additions & 0 deletions application/controllers/Callstats.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Callstats 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');
}
}

public function index() {
$data['page_title'] = __("Callsign statistics");

$this->load->model('bands');
$this->load->model('Callstats_model');

if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
$band = $this->input->post('band',true);
} else {
$band = 'All';
}

if ($this->input->post('mode') != NULL) { // Mode is not set when page first loads.
$mode = $this->input->post('mode',true);
} else {
$mode = 'All';
}

if ($this->input->post('propagation') != NULL) { // Propagation is not set when page first loads.
$propagation = $this->input->post('propagation',true);
} else {
$propagation = '';
}

if ($this->input->post('mincount') != NULL) { // mincount is not set when page first loads.
$mincount = $this->input->post('mincount',true);
} else {
$mincount = 2;
}

if ($this->input->post('orbit') != NULL) { // orbit is not set when page first loads.
$orbit = $this->input->post('orbit',true);
} else {
$orbit = 'All';
}


if ($this->input->post('sat') != NULL) { // Sat is not set when page first loads.
$sat = $this->input->post('sat',true);
} else {
$sat = 'All';
}

$data['sats'] = $this->bands->get_worked_sats();
$data['worked_bands'] = $this->bands->get_worked_bands();
$data['worked_modes'] = $this->Callstats_model->get_worked_modes();
$data['orbits'] = $this->bands->get_worked_orbits();
$data['mincount'] = $mincount;
$data['maxactivatedgrids'] = $this->Callstats_model->get_max_qsos();
$data['orbit'] = $orbit;
$data['activators_array'] = $this->Callstats_model->get_activators($band, $mode, $propagation, $mincount, $orbit, $sat);
$data['bandselect'] = $band;
$data['modeselect'] = $mode;
$data['satselect'] = $sat;
$data['propagationselect'] = $propagation;
$data['user_default_band'] = $this->session->userdata('user_default_band');

$footerData = [];
$footerData['scripts'] = [
'assets/js/sections/callstats.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/callstats.js")),
];

$this->load->view('interface_assets/header', $data);
$this->load->view('callstats/index');
$this->load->view('interface_assets/footer', $footerData);
}

/*
* Used to fetch QSOs from the table
*/
public function qso_details_callstats() {
$this->load->model('callstats_model');

$searchphrase = str_replace('"', "", $this->security->xss_clean($this->input->post("Searchphrase")));
$band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band")));
$mode = str_replace('"', "", $this->security->xss_clean($this->input->post("Mode")));
$sat = str_replace('"', "", $this->security->xss_clean($this->input->post("Sat")));
$orbit = str_replace('"', "", $this->security->xss_clean($this->input->post("Orbit")));
$propagation = str_replace('"', "", $this->security->xss_clean($this->input->post("Propagation")) ?? '');
$data['results'] = $this->callstats_model->qso_details($searchphrase, $band, $mode, $sat, $orbit, $propagation);

// Render Page
$data['page_title'] = __("Log View");
$data['filter'] = $searchphrase.__(" and band ").$band;
if ($band == 'SAT') {
if ($sat != 'All' && $sat != null) {
$data['filter'] .= __(" and sat ").$sat;
}
if ($orbit != 'All' && $orbit != null) {
$data['filter'] .= __(" and orbit type ").$orbit;
}
}
if ($propagation != '' && $propagation != null) {
$data['filter'] .= __(" and propagation ").$propagation;
}
if ($mode != null && strtolower($mode) != 'all') {
$data['filter'] .= __(" and mode ").$mode;
}
if (!empty($qsltype)) {
$data['filter'] .= __(" and ").implode('/', $qsltype);
}
$this->load->view('awards/details', $data);
}

}
3 changes: 2 additions & 1 deletion application/controllers/Logbookadvanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@ public function setUserOptions() {
$json_string['lotw']['show'] = $this->input->post('lotw');
$json_string['eqsl']['show'] = $this->input->post('eqsl');
$json_string['clublog']['show'] = $this->input->post('clublog');
$json_string['qslmsg']['show'] = $this->input->post('qslmsg');
$json_string['qslmsgs']['show'] = $this->input->post('qslmsgs');
$json_string['qslmsgr']['show'] = $this->input->post('qslmsgr');
$json_string['dxcc']['show'] = $this->input->post('dxcc');
$json_string['state']['show'] = $this->input->post('state');
$json_string['cqzone']['show'] = $this->input->post('cqzone');
Expand Down
1 change: 1 addition & 0 deletions application/controllers/Satellite.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public function flightpath() {
'assets/js/sections/three-orbit-controls.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/three-orbit-controls.js")),
'assets/js/sections/satellite_functions.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/satellite_functions.js")),
'assets/js/sections/flightpath.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/flightpath.js")),
'assets/js/leaflet/L.Maidenhead.js',
];

$homegrid = explode(',', $this->stations->find_gridsquare());
Expand Down
1 change: 1 addition & 0 deletions application/controllers/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ function fetchQueryResult($json, $returnquery) {
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
$this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left');
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
$this->db->limit(5000);

if ($returnquery) {
$query = $this->db->get_compiled_select($this->config->item('table_name'));
Expand Down
Loading

0 comments on commit cc5ed80

Please sign in to comment.