Refactoring of ONLY DXCC Timeline incl. details

This commit is contained in:
int2001
2024-08-23 05:45:47 +00:00
parent 7fc5db585e
commit b634a802a9
4 changed files with 43 additions and 24 deletions

View File

@@ -22,10 +22,14 @@ class Timeline extends CI_Controller {
$band = 'All';
}
if ($this->input->post('propmode') != NULL) {
if (($this->input->post('propmode') != NULL) && ($this->input->post('propmode') != '0')) { // Setted, but not "All"
$propmode = $this->security->xss_clean($this->input->post('propmode'));
} else {
$propmode = 'All';
if (($this->session->userdata('user_default_band') == 'SAT') && ($this->input->post('propmode') == NULL)){ // Not setted, and empty and default is SAT?
$propmode='SAT';
} else { // Not setted and empty and no SAT as default?
$propmode = 'All';
}
}
if ($this->input->post('mode') != NULL) {
@@ -91,7 +95,7 @@ class Timeline extends CI_Controller {
$band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band")));
$mode = str_replace('"', "", $this->security->xss_clean($this->input->post("Mode")));
$type = str_replace('"', "", $this->security->xss_clean($this->input->post("Type")));
$propmode = str_replace('"', "", $this->security->xss_clean($this->input->post("propmode")));
$propmode = str_replace('"', "", $this->security->xss_clean($this->input->post("Propmode")));
$data['results'] = $this->timeline_model->timeline_qso_details($querystring, $band, $propmode, $mode, $type);

View File

@@ -31,20 +31,21 @@ class Timeline_model extends CI_Model {
join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif
where station_id in (" . $location_list . ")";
if ($band == 'SAT') { // SAT == Don't care for band but for prop
if ($band == 'SAT') { // Left for compatibility reasons
$sql .= " and col_prop_mode = ?";
$binding[] = $band;
} else { // Not SAT
if ($band != 'All') {
} else { // Not SAT
if ($band != 'All') { // Band set? Take care of it
$sql .= " and col_band = ?";
$binding[] = $band;
}
if ( $propmode == 'All' ) { // Not SAT and Prop=All -> Show everything but not prop_mode SAT
}
if ( $propmode == 'NoSAT' ) { // All without SAT
$sql .= " and col_prop_mode !='SAT'";
} elseif ($propmode == 'None') { // Not SAT and prop=None --> Take only care of Band (if set)
;
// No filter
} else { // Not SAT and not All and no prop in ('All','None') take care of band and propmode
} elseif ($propmode == 'None') { // Empty Propmode
$sql .= " and (trim(col_prop_mode)='' or col_prop_mode is null)";
} elseif ($propmode == 'All') { // Dont care for propmode
; // No Prop-Filter
} else { // Propmode set, taker care of it
$sql .= " and col_prop_mode = ?";
$binding[] = $propmode;
}
@@ -238,12 +239,24 @@ class Timeline_model extends CI_Model {
$this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.COL_DXCC', 'left outer');
$this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer');
if ($band != 'All') {
if ($band == 'SAT') {
$this->db->where('col_prop_mode', $band);
} else {
$this->db->where('COL_PROP_MODE !=', 'SAT');
if ($band == 'SAT') { // Left for compatibility reasons
$this->db->where('col_prop_mode', $band);
} else { // Not SAT
if ($band != 'All') { // Band set? Take care of it
$this->db->where('col_band', $band);
}
if ( $propmode == 'NoSAT' ) { // All without SAT
$this->db->where('col_prop_mode !=', 'SAT');
} elseif ($propmode == 'None') { // Empty Propmode
$sql .= " and (trim(col_prop_mode)='' or col_prop_mode is null)";
$this->db->group_start();
$this->db->where('trim(col_prop_mode)', '');
$this->db->or_where('col_prop_mode is null');
$this->db->group_end();
} elseif ($propmode == 'All') { // Dont care for propmode
; // No Prop-Filter
} else { // Propmode set, taker care of it
$this->db->where('col_prop_mode =', $propmode);
}
}

View File

@@ -1971,7 +1971,7 @@ $(document).ready(function(){
$(".buttons-csv").css("color", "white");
}
function displayTimelineContacts(querystring, band, mode, type) {
function displayTimelineContacts(querystring, band, mode, propmode, type) {
var baseURL= "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/timeline/details',
@@ -1979,6 +1979,7 @@ $(document).ready(function(){
data: {'Querystring': querystring,
'Band': band,
'Mode': mode,
'Propmode': propmode,
'Type': type
},
success: function(html) {

View File

@@ -73,8 +73,9 @@
<div class="mb-3 row">
<label class="col-md-1" for="propmode"><?= __("Propagation"); ?></label>
<div class="col-sm-3">
<select class="form-select form-select-sm w-auto" name="propmode" id="propmode" <?php if ($user_default_band == 'SAT') {echo 'disabled';} ?>>
<option value=""<?php if (($propmode ?? '') == '') { echo 'selected="selected"'; } ?>><?= __("All"); ?></option>
<select class="form-select form-select-sm 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 no 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>
@@ -91,7 +92,7 @@
<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 (($user_default_band == 'SAT') || ($propmode == 'SAT')) {echo 'selected="selected"';} ?>><?= _pgettext("Propagation Mode","Satellite"); ?></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>
@@ -122,7 +123,7 @@
if ($timeline_array) {
switch ($this->input->post('award')) {
case 'dxcc': $result = write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $this->input->post('award')); break;
case 'dxcc': $result = write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award')); break;
case 'was': $result = write_was_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $this->input->post('award')); break;
case 'iota': $result = write_iota_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $this->input->post('award')); break;
case 'waz': $result = write_waz_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $this->input->post('award')); break;
@@ -139,7 +140,7 @@
<?php
function write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $award) {
function write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $award) {
$i = count($timeline_array);
echo '<table style="width:100%" class="table table-sm timelinetable table-bordered table-hover table-striped table-condensed text-center">
<thead>
@@ -166,7 +167,7 @@ function write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect,
if (!empty($line->end)) echo '<span class="badge text-bg-danger">'.__("Deleted DXCC").'</span>';
echo '</td>
<td>' . $line->end . '</td>
<td><a href=javascript:displayTimelineContacts("' . $line->adif . '","'. $bandselect . '","'. $modeselect . '","' . $award .'")>'.__("Show").'</a></td>
<td><a href=javascript:displayTimelineContacts("' . $line->adif . '","'. $bandselect . '","'. $modeselect . '","' . $propmode .'","' . $award .'")>'.__("Show").'</a></td>
</tr>';
}
echo '</tfoot></table></div>';