[Awards][DXCC] Can now choose by mode

pull/769/head
Peter Goodhall 2020-12-21 17:45:52 +00:00 zatwierdzone przez GitHub
commit 13367c5a65
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 56 dodań i 7 usunięć

Wyświetl plik

@ -75,7 +75,10 @@ class Awards extends CI_Controller {
public function dxcc () {
$this->load->model('dxcc');
$this->load->model('modes');
$data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select
$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
@ -106,6 +109,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['lotw'] = 1;
@ -122,11 +126,12 @@ class Awards extends CI_Controller {
$postdata['Oceania'] = 1;
$postdata['Antarctica'] = 1;
$postdata['band'] = 'All';
$postdata['mode'] = 'All';
}
$dxcclist = $this->dxcc->fetchdxcc($postdata);
$data['dxcc_array'] = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata);
$data['dxcc_summary'] = $this->dxcc->get_dxcc_summary($bands);
$data['dxcc_summary'] = $this->dxcc->get_dxcc_summary($data['worked_bands']);
// Render Page
$data['page_title'] = "Awards - DXCC";

Wyświetl plik

@ -259,6 +259,10 @@ class DXCC extends CI_Model {
$sql .= " and col_band ='" . $band . "'";
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addQslToQuery($postdata);
$sql .= " group by col_dxcc
@ -290,6 +294,10 @@ class DXCC extends CI_Model {
$sql .= " and col_band ='" . $band . "'";
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= " group by col_dxcc
) x on dxcc_entities.adif = x.col_dxcc";;
@ -325,6 +333,10 @@ class DXCC extends CI_Model {
}
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= ' group by col_dxcc) x on dxcc_entities.adif = x.col_dxcc';
}
@ -360,6 +372,10 @@ class DXCC extends CI_Model {
}
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= " and not exists (select 1 from ".$this->config->item('table_name')." where station_id = $station_id and col_dxcc = thcv.col_dxcc";
if ($postdata['band'] != 'All') {
@ -372,6 +388,10 @@ class DXCC extends CI_Model {
}
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addQslToQuery($postdata);
$sql .= ')';
@ -409,6 +429,10 @@ class DXCC extends CI_Model {
}
}
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addQslToQuery($postdata);
$sql .= " group by col_dxcc

Wyświetl plik

@ -82,11 +82,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 . '"';
@ -97,12 +96,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-sm btn-warning">Reset</button>
<button id="button1id" type="submit" name="button1id" class="btn-sm btn-primary">Show</button>
</div>
</div>
@ -142,7 +162,7 @@
<thead>
<tr><td></td>';
foreach($bands as $band) {
foreach($worked_bands as $band) {
echo '<td>' . $band . '</td>';
}
echo '<td>Total</td>