[DXCC Award] Started work on adding orbit

This commit is contained in:
Andreas Kristiansen
2024-04-12 22:33:11 +02:00
parent 4a9baa9246
commit d819102128
3 changed files with 62 additions and 10 deletions

View File

@@ -103,6 +103,10 @@ class Awards extends CI_Controller {
$this->load->model('modes');
$this->load->model('bands');
$data['orbits'] = $this->bands->get_worked_orbits();
$data['sats_available'] = $this->bands->get_worked_sats();
$data['user_default_band'] = $this->session->userdata('user_default_band');
$data['worked_bands'] = $this->bands->get_worked_bands('dxcc'); // Used in the view for band select
$data['modes'] = $this->modes->active(); // Used in the view for mode select
@@ -138,6 +142,8 @@ class Awards extends CI_Controller {
$postdata['Antarctica'] = $this->security->xss_clean($this->input->post('Antarctica'));
$postdata['band'] = $this->security->xss_clean($this->input->post('band'));
$postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
$postdata['sat'] = $this->security->xss_clean($this->input->post('sats'));
$postdata['orbit'] = $this->security->xss_clean($this->input->post('orbits'));
}
else { // Setting default values at first load of page
$postdata['qsl'] = 1;
@@ -157,6 +163,8 @@ class Awards extends CI_Controller {
$postdata['Antarctica'] = 1;
$postdata['band'] = 'All';
$postdata['mode'] = 'All';
$postdata['sat'] = 'All';
$postdata['orbit'] = 'All';
}
$dxcclist = $this->dxcc->fetchdxcc($postdata);

View File

@@ -33,15 +33,6 @@ class DXCC extends CI_Model {
}
}
function search(){
print_r($this->input->get());
return;
}
function empty_table($table) {
$this->db->empty_table($table);
}
/*
* Fetches a list of all dxcc's, both current and deleted
*/
@@ -153,6 +144,8 @@ class DXCC extends CI_Model {
$sql .= $this->addContinentsToQuery($postdata);
$sql .= $this->addOrbitToQuery($postdata);
$query = $this->db->query($sql);
return $query->result();
@@ -174,6 +167,9 @@ class DXCC extends CI_Model {
$sql .= " and dxcc_entities.end is null";
}
$sql .= $this->addContinentsToQuery($postdata);
$sql .= $this->addOrbitToQuery($postdata);
$query = $this->db->query($sql);
return $query->result();
}
@@ -219,6 +215,8 @@ class DXCC extends CI_Model {
$sql .= $this->addContinentsToQuery($postdata);
$sql .= $this->addOrbitToQuery($postdata);
$sql .= ' order by prefix';
$query = $this->db->query($sql);
@@ -256,6 +254,9 @@ class DXCC extends CI_Model {
}
$sql .= $this->addContinentsToQuery($postdata);
$sql .= $this->addOrbitToQuery($postdata);
$query = $this->db->query($sql);
return $query->result();
}
@@ -286,6 +287,8 @@ class DXCC extends CI_Model {
$sql .= $this->addContinentsToQuery($postdata);
$sql .= $this->addOrbitToQuery($postdata);
$query = $this->db->query($sql);
return $query->result();
@@ -386,11 +389,23 @@ class DXCC extends CI_Model {
$sql .= $this->addContinentsToQuery($postdata);
$sql .= $this->addOrbitToQuery($postdata);
$query = $this->db->query($sql);
return $query->result();
}
// Adds orbit type to query
function addOrbitToQuery($postdata) {
$sql = '';
if ($postdata['orbit'] != 'All') {
$sql .= ' AND satellite.orbit = \''.$postdata['orbit'].'\'';
}
return $sql;
}
function getSummaryByBandConfirmed($band, $postdata, $location_list) {
$sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif";
@@ -419,6 +434,8 @@ class DXCC extends CI_Model {
$sql .= $this->genfunctions->addQslToQuery($postdata);
$sql .= $this->addOrbitToQuery($postdata);
if ($postdata['includedeleted'] == NULL) {
$sql .= " and d.end is null";

View File

@@ -122,7 +122,34 @@
</select>
</div>
</div>
<div class="mb-3 row">
<?php if (count($sats_available) != 0) { ?>
<label class="col-md-2 control-label" id="satslabel" for="distplot_sats"><?php echo lang('gridsquares_sat'); ?></label>
<div class="col-md-2">
<select class="form-select form-select-sm" id="sats" name="sats">
<option value="All"><?php echo lang('general_word_all')?></option>
<?php foreach($sats_available as $sat) {
echo '<option value="' . $sat . '"' . '>' . $sat . '</option>'."\n";
} ?>
</select>
</div>
<?php } else { ?>
<input id="sats" type="hidden" value="All"></input>
<?php } ?>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" id="orbitslabel" for="orbits"><?php echo lang('gridsquares_orbit'); ?></label>
<div class="col-md-2">
<select class="form-select form-select-sm" id="orbits" name="orbits">
<option value="All"><?php echo lang('general_word_all')?></option>
<?php
foreach($orbits as $orbit){
echo '<option value="' . $orbit . '">' . strtoupper($orbit) . '</option>'."\n";
}
?>
</select>
</div>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" for="mode">Mode</label>
<div class="col-md-2">