Merge pull request #1109 from AndreasK79/awards_was_mode_filter

[Awards WAS] Added mode filtering.
pull/1116/head
Peter Goodhall 2021-07-28 18:11:22 +01:00 zatwierdzone przez GitHub
commit 01440b3e83
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 55 dodań i 20 usunięć

Wyświetl plik

@ -274,7 +274,10 @@ class Awards extends CI_Controller {
public function was() {
$this->load->model('was');
$this->load->model('modes');
$data['worked_bands'] = $this->was->get_worked_bands();
$data['modes'] = $this->modes->active(); // Used in the view for mode select
if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands
@ -297,6 +300,7 @@ class Awards extends CI_Controller {
$postdata['confirmed'] = $this->input->post('confirmed');
$postdata['notworked'] = $this->input->post('notworked');
$postdata['band'] = $this->input->post('band');
$postdata['mode'] = $this->input->post('mode');
}
else { // Setting default values at first load of page
$postdata['lotw'] = 1;
@ -305,10 +309,11 @@ class Awards extends CI_Controller {
$postdata['confirmed'] = 1;
$postdata['notworked'] = 1;
$postdata['band'] = 'All';
$postdata['mode'] = 'All';
}
$data['was_array'] = $this->was->get_was_array($bands, $postdata);
$data['was_summary'] = $this->was->get_was_summary($bands);
$data['was_summary'] = $this->was->get_was_summary($data['worked_bands']);
// Render Page
$data['page_title'] = "Awards - WAS (Worked All States)";
@ -472,24 +477,23 @@ class Awards extends CI_Controller {
/*
function was_map
This displays the WAS map and requires the $band_type
This displays the WAS map and requires the $band_type and $mode_type
*/
public function was_map($band_type) {
public function was_map($band_type, $mode_type) {
$this->load->model('was');
$data['worked_bands'] = $this->was->get_worked_bands();
$data['mode'] = $mode_type;
$bands[] = $band_type;
$data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view
$postdata['lotw'] = 1;
$postdata['qsl'] = 1;
$postdata['worked'] = 1;
$postdata['confirmed'] = 1;
$postdata['notworked'] = 1;
$postdata['band'] = $band_type;
$postdata['mode'] = $mode_type;
$data['was_array'] = $this->was->get_was_array($bands, $postdata);

Wyświetl plik

@ -87,14 +87,14 @@ class was extends CI_Model {
if ($postdata['worked'] != NULL) {
$wasBand = $this->getWasWorked($station_id, $band, $postdata);
foreach ($wasBand as $line) {
$bandWas[$line->col_state][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","All","WAS")\'>W</a></div>';
$bandWas[$line->col_state][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","'. $postdata['mode'] . '","WAS")\'>W</a></div>';
$states[$line->col_state]['count']++;
}
}
if ($postdata['confirmed'] != NULL) {
$wasBand = $this->getWasConfirmed($station_id, $band, $postdata);
foreach ($wasBand as $line) {
$bandWas[$line->col_state][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","All","WAS")\'>C</a></div>';
$bandWas[$line->col_state][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","'. $postdata['mode'] . '","WAS")\'>C</a></div>';
$states[$line->col_state]['count']++;
}
}
@ -211,6 +211,10 @@ class was extends CI_Model {
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
where station_id = " . $station_id;
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addStateToQuery();
$sql .= $this->addBandToQuery($band);
@ -219,6 +223,10 @@ class was extends CI_Model {
" where station_id = ". $station_id .
" and col_state = thcv.col_state";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addBandToQuery($band);
$sql .= $this->addQslToQuery($postdata);
@ -240,6 +248,10 @@ class was extends CI_Model {
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
where station_id = " . $station_id;
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addStateToQuery();
$sql .= $this->addBandToQuery($band);

Wyświetl plik

@ -5,7 +5,6 @@
<form class="form" action="<?php echo site_url('awards/was'); ?>" method="post" enctype="multipart/form-data">
<fieldset>
<!-- Multiple Checkboxes (inline) -->
<div class="form-group row">
<div class="col-md-2" for="checkboxes">Worked / Confirmed</div>
<div class="col-md-10">
@ -38,11 +37,10 @@
</div>
</div>
<!-- Select Basic -->
<div class="form-group row">
<label class="col-md-2 control-label" for="band">Band</label>
<div class="col-md-2">
<select id="band2" name="band" class="form-control">
<select id="band2" name="band" class="form-control custom-select-sm">
<option value="All" <?php if ($this->input->post('band') == "All" || $this->input->method() !== 'post') echo ' selected'; ?> >Every band</option>
<?php foreach($worked_bands as $band) {
echo '<option value="' . $band . '"';
@ -53,13 +51,34 @@
</div>
</div>
<!-- Button (Double) -->
<div class="form-group row">
<label class="col-md-2 control-label" for="mode">Mode</label>
<div class="col-md-2">
<select id="mode" name="mode" class="form-control custom-select-sm">
<option value="All" <?php if ($this->input->post('mode') == "All" || $this->input->method() !== 'mode') echo ' selected'; ?>>All</option>
<?php
foreach($modes->result() as $mode){
if ($mode->submode == null) {
echo '<option value="' . $mode->mode . '"';
if ($this->input->post('mode') == $mode->mode) echo ' selected';
echo '>'. $mode->mode . '</option>'."\n";
} else {
echo '<option value="' . $mode->submode . '"';
if ($this->input->post('mode') == $mode->submode) echo ' selected';
echo '>' . $mode->submode . '</option>'."\n";
}
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 control-label" for="button1id"></label>
<div class="col-md-10">
<button id="button2id" type="reset" name="button2id" class="btn btn-warning">Reset</button>
<button id="button1id" type="submit" name="button1id" class="btn btn-primary">Show</button>
<button type="button" onclick="load_was_map();" class="btn btn-info"><i class="fas fa-globe-americas"></i> Show WAS Map</button>
<button id="button2id" type="reset" name="button2id" class="btn btn-sm btn-warning">Reset</button>
<button id="button1id" type="submit" name="button1id" class="btn btn-sm btn-primary">Show</button>
<button type="button" onclick="load_was_map();" class="btn btn-info btn-sm"><i class="fas fa-globe-americas"></i> Show WAS Map</button>
</div>
</div>
@ -99,7 +118,7 @@
<thead>
<tr><td></td>';
foreach($bands as $band) {
foreach($worked_bands as $band) {
echo '<td>' . $band . '</td>';
}
echo '<td>Total</td></tr>

Wyświetl plik

@ -135,7 +135,7 @@
'click' : function(event, data) {
displayContacts(data.name,$('#band2').val(), 'All', 'WAS');
displayContacts(data.name,$('#band2').val(), $('#mode').val(), 'WAS');
}
});

Wyświetl plik

@ -23,9 +23,9 @@
function load_was_map() {
BootstrapDialog.show({
title: 'Worked All States Map ('+$('#band2').val()+')',
title: 'Worked All States Map ('+$('#band2').val()+' '+$('#mode').val()+')',
cssClass: 'was-map-dialog',
message: $('<div></div>').load(site_url + '/awards/was_map/' + $('#band2').val())
message: $('<div></div>').load(site_url + '/awards/was_map/' + $('#band2').val() + '/' + $('#mode').val())
});
}