Merge pull request #1105 from AndreasK79/award_iota_mode_filter

[Awards IOTA] Added mode filtering.
pull/1112/head
Peter Goodhall 2021-07-26 22:50:53 +01:00 zatwierdzone przez GitHub
commit 3cb79050b9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 61 dodań i 13 usunięć

Wyświetl plik

@ -319,6 +319,8 @@ class Awards extends CI_Controller {
public function iota () {
$this->load->model('iota');
$this->load->model('modes');
$data['worked_bands'] = $this->iota->get_worked_bands(); // Used in the view for band select
if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
@ -334,6 +336,7 @@ class Awards extends CI_Controller {
}
$data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view
$data['modes'] = $this->modes->active(); // Used in the view for mode select
if($this->input->method() === 'post') {
$postdata['worked'] = $this->input->post('worked');
@ -348,6 +351,7 @@ class Awards extends CI_Controller {
$postdata['Oceania'] = $this->input->post('Oceania');
$postdata['Antarctica'] = $this->input->post('Antarctica');
$postdata['band'] = $this->input->post('band');
$postdata['mode'] = $this->input->post('mode');
}
else { // Setting default values at first load of page
$postdata['worked'] = 1;
@ -362,6 +366,7 @@ class Awards extends CI_Controller {
$postdata['Oceania'] = 1;
$postdata['Antarctica'] = 1;
$postdata['band'] = 'All';
$postdata['mode'] = 'All';
}
$iotalist = $this->iota->fetchIota($postdata);

Wyświetl plik

@ -81,7 +81,7 @@ class IOTA extends CI_Model {
if ($postdata['worked'] != NULL) {
$workedIota = $this->getIotaBandWorked($station_id, $band, $postdata);
foreach ($workedIota as $wiota) {
$iotaMatrix[$wiota->tag][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("'.$wiota->tag.'","'. $band . '","All","IOTA")\'>W</a></div>';
$iotaMatrix[$wiota->tag][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("'.$wiota->tag.'","'. $band . '","'. $postdata['mode'] . '","IOTA")\'>W</a></div>';
}
}
@ -89,7 +89,7 @@ class IOTA extends CI_Model {
if ($postdata['confirmed'] != NULL) {
$confirmedIota = $this->getIotaBandConfirmed($station_id, $band, $postdata);
foreach ($confirmedIota as $ciota) {
$iotaMatrix[$ciota->tag][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("'.$ciota->tag.'","'. $band . '","All","IOTA")\'>C</a></div>';
$iotaMatrix[$ciota->tag][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("'.$ciota->tag.'","'. $band . '","'. $postdata['mode'] . '","IOTA")\'>C</a></div>';
}
}
}
@ -127,7 +127,11 @@ class IOTA extends CI_Model {
join iota on thcv.col_iota = iota.tag
where station_id = " . $station_id .
" and thcv.col_iota is not null
and col_qsl_rcvd = 'Y'";
and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
if ($band == 'SAT') {
$sql .= " and col_prop_mode ='" . $band . "'";
@ -154,6 +158,10 @@ class IOTA extends CI_Model {
where station_id = ' . $station_id .
' and thcv.col_iota is not null';
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
if ($band == 'SAT') {
$sql .= " and col_prop_mode ='" . $band . "'";
}
@ -188,6 +196,11 @@ class IOTA extends CI_Model {
if ($postdata['notworked'] == NULL) {
$sql .= " and exists (select 1 from " . $this->config->item('table_name') . " where station_id = ". $station_id . " and col_iota = iota.tag";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
if ($postdata['band'] != 'All') {
if ($postdata['band'] == 'SAT') {
$sql .= " and col_prop_mode ='" . $postdata['band'] . "'";
@ -214,6 +227,10 @@ class IOTA extends CI_Model {
and not exists (select 1 from ". $this->config->item('table_name') . " where station_id = ". $station_id .
" and col_iota = thcv.col_iota";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
if ($postdata['band'] != 'All') {
if ($postdata['band'] == 'SAT') {
$sql .= " and col_prop_mode ='" . $postdata['band'] . "'";
@ -224,7 +241,7 @@ class IOTA extends CI_Model {
}
}
$sql .= " and col_qsl_rcvd = 'Y')";
$sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y'))";
if ($postdata['band'] != 'All') {
if ($postdata['band'] == 'SAT') {
@ -240,6 +257,10 @@ class IOTA extends CI_Model {
$sql .= " and coalesce(iota.status, '') <> 'D'";
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addContinentsToQuery($postdata);
$query = $this->db->query($sql);
@ -252,7 +273,11 @@ class IOTA extends CI_Model {
join iota on thcv.col_iota = iota.tag
where station_id = " . $station_id .
" and thcv.col_iota is not null
and col_qsl_rcvd = 'Y'";
and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
if ($postdata['includedeleted'] == NULL) {
$sql .= " and coalesce(iota.status, '') <> 'D'";

Wyświetl plik

@ -5,7 +5,6 @@
<form class="form" action="<?php echo site_url('awards/iota'); ?>" method="post" enctype="multipart/form-data">
<fieldset>
<!-- Multiple Checkboxes (inline) -->
<div class="form-group row">
<div class="col-md-2 control-label" for="checkboxes">Deleted IOTA</div>
<div class="col-md-10">
@ -16,7 +15,6 @@
</div>
</div>
<!-- Multiple Checkboxes (inline) -->
<div class="form-group row">
<div class="col-md-2" for="checkboxes">Worked / Confirmed</div>
<div class="col-md-10">
@ -69,11 +67,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 . '"';
@ -84,12 +81,33 @@
</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 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>
</div>
</div>
@ -99,7 +117,7 @@
$i = 1;
if ($iota_array) {
echo '
<table style="width:100%;" class="table table-sm tableiota table-bordered table-hover table-striped table-condensed text-center">
<thead>
<tr>