Merge pull request from AndreasK79/award_waz_mode_filter

[Awards CQ Zone] Added mode filtering.
pull/1105/head
Peter Goodhall 2021-07-26 10:45:35 +01:00 zatwierdzone przez GitHub
commit da0b5f5b3a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 41 dodań i 5 usunięć
application
controllers
models
views/awards/cq

Wyświetl plik

@ -224,8 +224,10 @@ class Awards extends CI_Controller {
$station_id = $CI->Stations->find_active();
$this->load->model('cq');
$this->load->model('modes');
$data['worked_bands'] = $this->cq->get_worked_bands($station_id);
$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
@ -248,6 +250,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;
@ -256,6 +259,7 @@ class Awards extends CI_Controller {
$postdata['confirmed'] = 1;
$postdata['notworked'] = 1;
$postdata['band'] = 'All';
$postdata['mode'] = 'All';
}
$data['cq_array'] = $this->cq->get_cq_array($bands, $postdata, $station_id);

Wyświetl plik

@ -89,14 +89,14 @@ class CQ extends CI_Model{
if ($postdata['worked'] != NULL) {
$cqBand = $this->getCQWorked($station_id, $band, $postdata);
foreach ($cqBand as $line) {
$bandCq[$line->col_cqz][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $line->col_cqz) . '","' . $band . '","All","CQZone")\'>W</a></div>';
$bandCq[$line->col_cqz][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $line->col_cqz) . '","' . $band . '","'. $postdata['mode'] . '","CQZone")\'>W</a></div>';
$cqZ[$line->col_cqz]['count']++;
}
}
if ($postdata['confirmed'] != NULL) {
$cqBand = $this->getCQConfirmed($station_id, $band, $postdata);
foreach ($cqBand as $line) {
$bandCq[$line->col_cqz][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $line->col_cqz) . '","' . $band . '","All","CQZone")\'>C</a></div>';
$bandCq[$line->col_cqz][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $line->col_cqz) . '","' . $band . '","'. $postdata['mode'] . '","CQZone")\'>C</a></div>';
$cqZ[$line->col_cqz]['count']++;
}
}
@ -141,12 +141,20 @@ class CQ extends CI_Model{
$sql = "SELECT distinct col_cqz FROM " . $this->config->item('table_name') . " thcv
where station_id = " . $station_id . " and col_cqz <> ''";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addBandToQuery($band);
$sql .= " and not exists (select 1 from " . $this->config->item('table_name') .
" where station_id = " . $station_id .
" and col_cqz = thcv.col_cqz and col_cqz <> '' ";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addBandToQuery($band);
$sql .= $this->addQslToQuery($postdata);
@ -166,6 +174,10 @@ class CQ extends CI_Model{
$sql = "SELECT distinct col_cqz FROM " . $this->config->item('table_name') . " thcv
where station_id = " . $station_id . " and col_cqz <> ''";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addBandToQuery($band);
$sql .= $this->addQslToQuery($postdata);

Wyświetl plik

@ -115,11 +115,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 . '"';
@ -130,7 +129,28 @@
</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">