Skip to content

Commit 4a9baa9

Browse files
authored
Merge pull request wavelog#265 from AndreasK79/distplot_orbit
2 parents 5161d2c + 018b2dc commit 4a9baa9

File tree

4 files changed

+47
-11
lines changed

4 files changed

+47
-11
lines changed

application/controllers/Distances.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public function index()
1919
$this->load->model('bands');
2020
$data['bands_available'] = $this->bands->get_worked_bands_distances();
2121
$data['sats_available'] = $this->bands->get_worked_sats();
22+
$data['orbits'] = $this->bands->get_worked_orbits();
23+
$data['user_default_band'] = $this->session->userdata('user_default_band');
2224

2325
$this->load->view('interface_assets/header', $data);
2426
$this->load->view('distances/index');

application/models/Distances_model.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function get_distances($postdata, $measurement_base) {
2525
$gridsquare = explode(',', $station_gridsquare); // We need to convert to an array, since a user can enter several gridsquares
2626

2727
$this->db->select('COL_PRIMARY_KEY,COL_DISTANCE,col_call callsign, col_gridsquare grid');
28+
$this->db->join('satellite', 'satellite.name = '.$this->config->item('table_name').'.COL_SAT_NAME', 'left outer');
2829
$this->db->where('LENGTH(col_gridsquare) >', 0);
2930

3031
if ($postdata['band'] == 'sat') {
@@ -37,6 +38,10 @@ function get_distances($postdata, $measurement_base) {
3738
$this->db->where('col_band', $postdata['band']);
3839
}
3940

41+
if ($postdata['orbit'] != 'All') {
42+
$this->db->where('satellite.orbit', $postdata['orbit']);
43+
}
44+
4045
$this->db->where('station_id', $station_id);
4146
$queryresult = $this->db->get($this->config->item('table_name'));
4247

application/views/distances/index.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@
2222
<option value="sat">SAT</option>
2323
<?php } ?>
2424
<?php foreach($bands_available as $band) {
25-
echo '<option value="' . $band . '"' . '>' . $band . '</option>'."\n";
25+
echo '<option value="'.$band.'"';
26+
if ($user_default_band == $band) {
27+
echo ' selected="selected"';
28+
}
29+
echo '>'.$band.'</option>'."\n";
2630
} ?>
2731
</select>
2832
<?php if (count($sats_available) != 0) { ?>
29-
<label class="my-1 me-2" for="distplot_sats"><?php echo lang('general_word_satellite')?></label>
30-
<select class="form-select my-1 me-sm-2 w-auto" id="distplot_sats">
33+
<label class="my-1 me-2" id="satslabel" for="distplot_sats" <?php if ($user_default_band != "SAT") { ?>style="display: none;"<?php } ?>><?php echo lang('general_word_satellite')?></label>
34+
<select class="form-select my-1 me-sm-2 w-auto" id="distplot_sats" <?php if ($user_default_band != "SAT") { ?>style="display: none;"<?php } ?>>
3135
<option value="All"><?php echo lang('general_word_all')?></option>
3236
<?php foreach($sats_available as $sat) {
3337
echo '<option value="' . $sat . '"' . '>' . $sat . '</option>'."\n";
@@ -36,8 +40,17 @@
3640
<?php } else { ?>
3741
<input id="distplot_sats" type="hidden" value="All"></input>
3842
<?php } ?>
39-
<button id="plot" type="button" name="plot" class="btn btn-primary" onclick="distPlot(this.form)"><?php echo lang('filter_options_show')?></button>
43+
<label class="my-1 me-2" id="orbitslabel" for="orbits" <?php if ($user_default_band != "SAT") { ?>style="display: none;"<?php } ?>><?php echo lang('gridsquares_orbit'); ?></label>
44+
<select class="form-select my-1 me-sm-2 w-auto" id="orbits" <?php if ($user_default_band != "SAT") { ?>style="display: none;"<?php } ?>>
45+
<option value="All"><?php echo lang('general_word_all')?></option>
46+
<?php
47+
foreach($orbits as $orbit){
48+
echo '<option value="' . $orbit . '">' . strtoupper($orbit) . '</option>'."\n";
49+
}
50+
?>
51+
</select>
52+
<button id="plot" type="button" name="plot" class="btn btn-primary ld-ext-right ld-ext-right-plot" onclick="distPlot(this.form)"><?php echo lang('filter_options_show')?><div class="ld ld-ring ld-spin"></div></button>
4053
</form>
4154
</div>
4255

43-
</div>
56+
</div>

assets/js/sections/distances.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
$('#distplot_bands').change(function(){
22
var band = $("#distplot_bands option:selected").text();
33
if (band != "SAT") {
4-
$("#distplot_sats").prop('disabled', true);
4+
$("#distplot_sats").hide();
5+
$("#orbits").hide();
6+
$("#satslabel").hide();
7+
$("#orbitslabel").hide();
8+
$("#distplot_sats").val('All');
9+
$("#orbits").val('All');
510
} else {
6-
$("#distplot_sats").prop('disabled', false);
11+
$("#distplot_sats").show();
12+
$("#orbits").show();
13+
$("#orbitslabel").show();
14+
$("#satslabel").show();
715
}
816
});
917

1018
function distPlot(form) {
19+
$(".ld-ext-right-plot").addClass('running');
20+
$(".ld-ext-right-plot").prop('disabled', true);
21+
$('#plot').prop("disabled", true);
1122
$(".alert").remove();
1223
var baseURL= "<?php echo base_url();?>";
1324
$.ajax({
1425
url: base_url+'index.php/distances/get_distances',
1526
type: 'post',
1627
data: {'band': form.distplot_bands.value,
17-
'sat': form.distplot_sats.value},
28+
'sat': form.distplot_sats.value,
29+
'orbit': form.orbits.value
30+
},
1831
success: function(tmp) {
1932
if (tmp.ok == 'OK') {
2033
if (!($('#information').length > 0))
@@ -128,19 +141,22 @@ function distPlot(form) {
128141
}
129142
$("#distances_div").append('<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>' + tmp.Error + '</div>');
130143
}
144+
$(".ld-ext-right-plot").removeClass('running');
145+
$(".ld-ext-right-plot").prop('disabled', false);
146+
$('#plot').prop("disabled", false);
131147
}
132148
});
133149
}
134150

135151
function getDistanceQsos(distance) {
136-
// alert('Category: ' + distance);
137152
$.ajax({
138153
url: base_url + 'index.php/distances/getDistanceQsos',
139154
type: 'post',
140155
data: {
141156
'distance': distance,
142157
'band': $("#distplot_bands").val(),
143158
'sat' : $("#distplot_sats").val(),
159+
'orbit': $("#orbits").val(),
144160
},
145161
success: function (html) {
146162
BootstrapDialog.show({
@@ -150,8 +166,8 @@ function getDistanceQsos(distance) {
150166
nl2br: false,
151167
message: html,
152168
onshown: function(dialog) {
153-
$('[data-bs-toggle="tooltip"]').tooltip();
154-
$('.contacttable').DataTable({
169+
$('[data-bs-toggle="tooltip"]').tooltip();
170+
$('.contacttable').DataTable({
155171
"pageLength": 25,
156172
responsive: false,
157173
ordering: false,

0 commit comments

Comments
 (0)