Accumulated Timeline / Take care of propmode

This commit is contained in:
int2001
2024-08-26 06:21:49 +00:00
parent 65cea8f13f
commit c79ae7ad15
4 changed files with 83 additions and 27 deletions

View File

@@ -4,8 +4,7 @@ defined('BASEPATH') or exit('No direct script access allowed');
class Accumulated extends CI_Controller class Accumulated extends CI_Controller
{ {
function __construct() function __construct() {
{
parent::__construct(); parent::__construct();
$this->load->model('user_model'); $this->load->model('user_model');
@@ -15,39 +14,59 @@ class Accumulated extends CI_Controller
} }
} }
public function index() public function index() {
{ // Render Page
// Render Page $data['page_title'] = __("Accumulated Statistics");
$data['page_title'] = __("Accumulated Statistics");
$this->load->model('bands'); $this->load->model('bands');
$data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select $data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
$this->load->model('modes'); $this->load->model('modes');
$data['modes'] = $this->modes->active(); if (($this->input->post('Propmode') != NULL) && ($this->input->post('Propmode') != '0')) { // Set, but not "All"
$data['propmode'] = $this->security->xss_clean($this->input->post('Propmode'));
} else {
if (($this->session->userdata('user_default_band') == 'SAT') && ($this->input->post('propmode') == NULL)){ // Not set, and empty and default is SAT?
$data['propmode']='SAT';
} else { // Not set and empty and no SAT as default?
$data['propmode'] = 'All';
}
}
$this->load->view('interface_assets/header', $data);
$this->load->view('accumulate/index'); $data['modes'] = $this->modes->active();
$this->load->view('interface_assets/footer');
$this->load->view('interface_assets/header', $data);
$this->load->view('accumulate/index');
$this->load->view('interface_assets/footer');
} }
/* /*
* Used for ajax-call in javascript to fetch the data and insert into table and chart * Used for ajax-call in javascript to fetch the data and insert into table and chart
*/ */
public function get_accumulated_data() public function get_accumulated_data() {
{
//load model
$this->load->model('accumulate_model');
$band = xss_clean($this->input->post('Band'));
$award = xss_clean($this->input->post('Award'));
$mode = xss_clean($this->input->post('Mode'));
$period = xss_clean($this->input->post('Period'));
// get data if (($this->input->post('Propmode') != NULL) && ($this->input->post('Propmode') != '0')) { // Set, but not "All"
$data = $this->accumulate_model->get_accumulated_data($band, $award, $mode, $period); $propmode = $this->security->xss_clean($this->input->post('Propmode'));
header('Content-Type: application/json'); } else {
echo json_encode($data); if (($this->session->userdata('user_default_band') == 'SAT') && ($this->input->post('Propmode') == NULL)){ // Not set, and empty and default is SAT?
$propmode='SAT';
} else { // Not set and empty and no SAT as default?
$propmode = 'All';
}
}
//load model
$this->load->model('accumulate_model');
$band = xss_clean($this->input->post('Band'));
$award = xss_clean($this->input->post('Award'));
$mode = xss_clean($this->input->post('Mode'));
$period = xss_clean($this->input->post('Period'));
// get data
$data = $this->accumulate_model->get_accumulated_data($band, $award, $mode, $propmode, $period);
header('Content-Type: application/json');
echo json_encode($data);
} }
} }

View File

@@ -3,8 +3,7 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class Accumulate_model extends CI_Model class Accumulate_model extends CI_Model
{ {
function get_accumulated_data($band, $award, $mode, $period) function get_accumulated_data($band, $award, $mode, $propmode, $period) {
{
$this->load->model('logbooks_model'); $this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));

View File

@@ -76,6 +76,35 @@
</div> </div>
</div> </div>
<div class="mb-4 row">
<label class="col-md-1" for="propmode"><?= __("Propagation"); ?></label>
<div class="col-md-3">
<select class="form-select w-auto" name="propmode" id="propmode">
<option value="0"<?php if (($propmode ?? '') == '0') { echo 'selected="selected"'; } ?>><?= __("All"); ?></option>
<option value="NoSAT"<?php if (($propmode ?? '') == 'NoSAT') { echo 'selected="selected"'; } ?>><?= __("All but SAT"); ?></option>
<option value="None"<?php if (($propmode ?? '') == 'None') { echo ' selected="selected"'; } ?>><?= __("None/Empty"); ?></option>
<option value="AS"<?php if (($propmode ?? '') == 'AS') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Aircraft Scatter"); ?></option>
<option value="AUR"<?php if (($propmode ?? '') == 'AUR') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Aurora"); ?></option>
<option value="AUE"<?php if (($propmode ?? '') == 'AUE') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Aurora-E"); ?></option>
<option value="BS"<?php if (($propmode ?? '') == 'BS') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Back scatter"); ?></option>
<option value="ECH"<?php if (($propmode ?? '') == 'ECH') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","EchoLink"); ?></option>
<option value="EME"<?php if (($propmode ?? '') == 'EME') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Earth-Moon-Earth"); ?></option>
<option value="ES"<?php if (($propmode ?? '') == 'ES') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Sporadic E"); ?></option>
<option value="FAI"<?php if (($propmode ?? '') == 'FAI') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Field Aligned Irregularities"); ?></option>
<option value="F2"<?php if (($propmode ?? '') == 'F2') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","F2 Reflection"); ?></option>
<option value="INTERNET"<?php if (($propmode ?? '') == 'INTERNET') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Internet-assisted"); ?></option>
<option value="ION"<?php if (($propmode ?? '') == 'ION') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Ionoscatter"); ?></option>
<option value="IRL"<?php if (($propmode ?? '') == 'IRL') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","IRLP"); ?></option>
<option value="MS"<?php if (($propmode ?? '') == 'MS') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Meteor scatter"); ?></option>
<option value="RPT"<?php if (($propmode ?? '') == 'RPT') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Terrestrial or atmospheric repeater or transponder"); ?></option>
<option value="RS"<?php if (($propmode ?? '') == 'RS') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Rain scatter"); ?></option>
<option value="SAT" <?php if ($propmode == 'SAT') {echo 'selected="selected"';} ?>><?= _pgettext("Propagation Mode","Satellite"); ?></option>
<option value="TEP"<?php if (($propmode ?? '') == 'TEP') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Trans-equatorial"); ?></option>
<option value="TR"<?php if (($propmode ?? '') == 'TR') { echo ' selected="selected"'; } ?>><?= _pgettext("Propagation Mode","Tropospheric ducting"); ?></option>
</select>
</div>
</div>
<!-- Button (Double) --> <!-- Button (Double) -->
<div class="mb-3 row"> <div class="mb-3 row">

View File

@@ -8,6 +8,7 @@ function accumulatePlot(form) {
var award = form.award.value; var award = form.award.value;
var mode = form.mode.value; var mode = form.mode.value;
var period = form.periodradio.value; var period = form.periodradio.value;
var propmode = form.propmode.value;
$.ajax({ $.ajax({
url: base_url + "index.php/accumulated/get_accumulated_data", url: base_url + "index.php/accumulated/get_accumulated_data",
type: "post", type: "post",
@@ -15,6 +16,7 @@ function accumulatePlot(form) {
Band: form.band.value, Band: form.band.value,
Award: award, Award: award,
Mode: mode, Mode: mode,
Propmode: propmode,
Period: period, Period: period,
}, },
success: function (data) { success: function (data) {
@@ -206,3 +208,10 @@ function accumulatePlot(form) {
}, },
}); });
} }
$('#band').change(function(){
var band = $("#band option:selected").text();
if (band == "SAT") {
$('#propmode').val('SAT');
}
});