mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #2547 from AndreasK79/date_dxcc
[DXCC Award] Added date filter
This commit is contained in:
@@ -153,6 +153,10 @@ class Awards extends CI_Controller {
|
||||
$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'));
|
||||
|
||||
$postdata['dateFrom'] = $this->security->xss_clean($this->input->post('dateFrom'));
|
||||
$postdata['dateTo'] = $this->security->xss_clean($this->input->post('dateTo'));
|
||||
|
||||
} else { // Setting default values at first load of page
|
||||
$postdata['qsl'] = 1;
|
||||
$postdata['lotw'] = 1;
|
||||
@@ -174,10 +178,13 @@ class Awards extends CI_Controller {
|
||||
$postdata['mode'] = 'All';
|
||||
$postdata['sat'] = 'All';
|
||||
$postdata['orbit'] = 'All';
|
||||
|
||||
$postdata['dateFrom'] = null;
|
||||
$postdata['dateTo'] = null;
|
||||
}
|
||||
|
||||
$dxcclist = $this->dxcc->fetchdxcc($postdata);
|
||||
if ($dxcclist[0]->adif == "0") {
|
||||
if ($dxcclist && $dxcclist[0]->adif == "0") {
|
||||
unset($dxcclist[0]);
|
||||
}
|
||||
$data['dxcc_array'] = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata);
|
||||
@@ -520,7 +527,9 @@ class Awards extends CI_Controller {
|
||||
$type = $this->security->xss_clean($this->input->post('Type'));
|
||||
$qsl = $this->input->post('QSL') == null ? '' : $this->security->xss_clean($this->input->post('QSL'));
|
||||
$searchmode = $this->input->post('searchmode') == null ? '' : $this->security->xss_clean($this->input->post('searchmode'));
|
||||
$data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl, $sat, $orbit, $searchmode, $propagation);
|
||||
$dateFrom = $this->security->xss_clean($this->input->post('dateFrom'));
|
||||
$dateTo = $this->security->xss_clean($this->input->post('dateTo'));
|
||||
$data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl, $sat, $orbit, $searchmode, $propagation, $dateFrom, $dateTo);
|
||||
|
||||
// This is done because we have two different ways to get dxcc info in Wavelog. Once is using the name (in awards), and the other one is using the ADIF DXCC.
|
||||
// We replace the values to make it look a bit nicer
|
||||
@@ -1723,6 +1732,8 @@ class Awards extends CI_Controller {
|
||||
$postdata['sat'] = $this->security->xss_clean($this->input->post('sat'));
|
||||
$postdata['orbit'] = $this->security->xss_clean($this->input->post('orbit'));
|
||||
|
||||
$postdata['dateFrom'] = $this->security->xss_clean($this->input->post('dateFrom'));
|
||||
$postdata['dateTo'] = $this->security->xss_clean($this->input->post('dateTo'));
|
||||
|
||||
$dxcclist = $this->dxcc->fetchdxcc($postdata);
|
||||
if ($dxcclist[0]->adif == "0") {
|
||||
|
||||
@@ -90,7 +90,7 @@ class DXCC extends CI_Model {
|
||||
if ($postdata['worked'] != NULL) {
|
||||
$workedDXCC = $this->getDxccBandWorked($location_list, $band, $postdata);
|
||||
foreach ($workedDXCC as $wdxcc) {
|
||||
$dxccMatrix[$wdxcc->dxcc][$band] = '<div class="bg-danger awardsBgWarning" ><a href=\'javascript:displayContacts("'.$wdxcc->dxcc.'","'. $band . '","'. $postdata['sat'] . '","' . $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC2", "")\'>W</a></div>';
|
||||
$dxccMatrix[$wdxcc->dxcc][$band] = '<div class="bg-danger awardsBgWarning" ><a href=\'javascript:displayContacts("'.$wdxcc->dxcc.'","'. $band . '","'. $postdata['sat'] . '","' . $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC2", "", "'.$postdata['dateFrom'].'", "'.$postdata['dateTo'].'")\'>W</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class DXCC extends CI_Model {
|
||||
if ($postdata['confirmed'] != NULL) {
|
||||
$confirmedDXCC = $this->getDxccBandConfirmed($location_list, $band, $postdata);
|
||||
foreach ($confirmedDXCC as $cdxcc) {
|
||||
$dxccMatrix[$cdxcc->dxcc][$band] = '<div class="bg-success awardsBgSuccess" additional_successinfo=">C<"><a href=\'javascript:displayContacts("'.$cdxcc->dxcc.'","'. $band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","' . $postdata['mode'] . '","DXCC2","'.$qsl.'")\'>'.$this->cf_type($postdata, $cdxcc->qsl,$cdxcc->lotw, $cdxcc->eqsl, $cdxcc->qrz, $cdxcc->clublog).'</a></div>';
|
||||
$dxccMatrix[$cdxcc->dxcc][$band] = '<div class="bg-success awardsBgSuccess" additional_successinfo=">C<"><a href=\'javascript:displayContacts("'.$cdxcc->dxcc.'","'. $band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","' . $postdata['mode'] . '","DXCC2","'.$qsl.'","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>'.$this->cf_type($postdata, $cdxcc->qsl,$cdxcc->lotw, $cdxcc->eqsl, $cdxcc->qrz, $cdxcc->clublog).'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,6 +171,16 @@ class DXCC extends CI_Model {
|
||||
|
||||
$sql .= $this->genfunctions->addQslToQuery($postdata);
|
||||
|
||||
if ($postdata['dateFrom'] != NULL) {
|
||||
$sql .= " and date(col_time_on) >= ?";
|
||||
$bindings[]=$postdata['dateFrom'];
|
||||
}
|
||||
|
||||
if ($postdata['dateTo'] != NULL) {
|
||||
$sql .= " and date(col_time_on) <= ?";
|
||||
$bindings[]=$postdata['dateTo'];
|
||||
}
|
||||
|
||||
$sql .= " group by col_dxcc
|
||||
) x on dxcc_entities.adif = x.col_dxcc";
|
||||
|
||||
@@ -209,6 +219,17 @@ class DXCC extends CI_Model {
|
||||
$bindings[]=$postdata['mode'];
|
||||
$bindings[]=$postdata['mode'];
|
||||
}
|
||||
|
||||
if ($postdata['dateFrom'] != NULL) {
|
||||
$sql .= " and date(col_time_on) >= ?";
|
||||
$bindings[]=$postdata['dateFrom'];
|
||||
}
|
||||
|
||||
if ($postdata['dateTo'] != NULL) {
|
||||
$sql .= " and date(col_time_on) <= ?";
|
||||
$bindings[]=$postdata['dateTo'];
|
||||
}
|
||||
|
||||
$sql .= $this->addOrbitToQuery($postdata,$bindings);
|
||||
|
||||
$sql .= " group by col_dxcc
|
||||
@@ -258,10 +279,20 @@ class DXCC extends CI_Model {
|
||||
$sql.=" and (col_prop_mode != 'SAT' or col_prop_mode is null)";
|
||||
}
|
||||
|
||||
if ($postdata['dateFrom'] != NULL) {
|
||||
$sql .= " and date(col_time_on) >= ?";
|
||||
$bindings[]=$postdata['dateFrom'];
|
||||
}
|
||||
|
||||
if ($postdata['dateTo'] != NULL) {
|
||||
$sql .= " and date(col_time_on) <= ?";
|
||||
$bindings[]=$postdata['dateTo'];
|
||||
}
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
$bindings[]=$postdata['mode'];
|
||||
$bindings[]=$postdata['mode'];
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
$bindings[]=$postdata['mode'];
|
||||
$bindings[]=$postdata['mode'];
|
||||
}
|
||||
|
||||
$sql .= $this->addOrbitToQuery($postdata, $bindings);
|
||||
@@ -311,6 +342,16 @@ class DXCC extends CI_Model {
|
||||
$bindings[]=$postdata['mode'];
|
||||
}
|
||||
|
||||
if ($postdata['dateFrom'] != NULL) {
|
||||
$sql .= " and date(col_time_on) >= ?";
|
||||
$bindings[]=$postdata['dateFrom'];
|
||||
}
|
||||
|
||||
if ($postdata['dateTo'] != NULL) {
|
||||
$sql .= " and date(col_time_on) <= ?";
|
||||
$bindings[]=$postdata['dateTo'];
|
||||
}
|
||||
|
||||
$sql .= " and not exists (select 1 from ".$this->config->item('table_name')." where station_id in (". $location_list .") and col_dxcc = thcv.col_dxcc and col_dxcc > 0";
|
||||
$sql .= $this->genfunctions->addBandToQuery($postdata['band'],$bindings);
|
||||
if ($postdata['band'] == 'SAT') {
|
||||
@@ -324,6 +365,16 @@ class DXCC extends CI_Model {
|
||||
$sql.=" and (col_prop_mode != 'SAT' or col_prop_mode is null)";
|
||||
}
|
||||
|
||||
if ($postdata['dateFrom'] != NULL) {
|
||||
$sql .= " and date(col_time_on) >= ?";
|
||||
$bindings[]=$postdata['dateFrom'];
|
||||
}
|
||||
|
||||
if ($postdata['dateTo'] != NULL) {
|
||||
$sql .= " and date(col_time_on) <= ?";
|
||||
$bindings[]=$postdata['dateTo'];
|
||||
}
|
||||
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
@@ -356,6 +407,16 @@ class DXCC extends CI_Model {
|
||||
where station_id in (". $location_list .
|
||||
") and col_dxcc > 0";
|
||||
|
||||
if ($postdata['dateFrom'] != NULL) {
|
||||
$sql .= " and date(col_time_on) >= ?";
|
||||
$bindings[]=$postdata['dateFrom'];
|
||||
}
|
||||
|
||||
if ($postdata['dateTo'] != NULL) {
|
||||
$sql .= " and date(col_time_on) <= ?";
|
||||
$bindings[]=$postdata['dateTo'];
|
||||
}
|
||||
|
||||
$sql .= $this->genfunctions->addBandToQuery($postdata['band'],$bindings);
|
||||
if ($postdata['band'] == 'SAT') {
|
||||
$sql .= " and col_prop_mode = 'SAT'";
|
||||
@@ -486,6 +547,16 @@ class DXCC extends CI_Model {
|
||||
$bindings[]=$band;
|
||||
}
|
||||
|
||||
if ($postdata['dateFrom'] != NULL) {
|
||||
$sql .= " and date(col_time_on) >= ?";
|
||||
$bindings[]=$postdata['dateFrom'];
|
||||
}
|
||||
|
||||
if ($postdata['dateTo'] != NULL) {
|
||||
$sql .= " and date(col_time_on) <= ?";
|
||||
$bindings[]=$postdata['dateTo'];
|
||||
}
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
$bindings[]=$postdata['mode'];
|
||||
@@ -546,6 +617,16 @@ class DXCC extends CI_Model {
|
||||
$bindings[]=$band;
|
||||
}
|
||||
|
||||
if ($postdata['dateFrom'] != NULL) {
|
||||
$sql .= " and date(col_time_on) >= ?";
|
||||
$bindings[]=$postdata['dateFrom'];
|
||||
}
|
||||
|
||||
if ($postdata['dateTo'] != NULL) {
|
||||
$sql .= " and date(col_time_on) <= ?";
|
||||
$bindings[]=$postdata['dateTo'];
|
||||
}
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
$bindings[]=$postdata['mode'];
|
||||
|
||||
@@ -533,7 +533,7 @@ class Logbook_model extends CI_Model {
|
||||
/*
|
||||
* Used to fetch QSOs from the logbook in the awards
|
||||
*/
|
||||
public function qso_details($searchphrase, $band, $mode, $type, $qsl, $sat = null, $orbit = null, $searchmode = null, $propagation = null) {
|
||||
public function qso_details($searchphrase, $band, $mode, $type, $qsl, $sat = null, $orbit = null, $searchmode = null, $propagation = null, $datefrom = null, $dateto = null) {
|
||||
$this->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
@@ -744,6 +744,13 @@ class Logbook_model extends CI_Model {
|
||||
$this->db->or_where("COL_SUBMODE", $mode);
|
||||
$this->db->group_end();
|
||||
}
|
||||
|
||||
if ($datefrom != null) {
|
||||
$this->db->where('date(COL_TIME_ON) >=', $datefrom);
|
||||
}
|
||||
if ($dateto != null) {
|
||||
$this->db->where('date(COL_TIME_ON) <=', $dateto);
|
||||
}
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
$this->db->order_by("COL_PRIMARY_KEY", "desc");
|
||||
|
||||
|
||||
@@ -36,6 +36,24 @@
|
||||
<!-- Dropdown Menu with Filter Content -->
|
||||
<div class="dropdown-menu start-50 translate-middle-x p-3 mt-5" aria-labelledby="filterDropdown" style="min-width: 250px;">
|
||||
<div class="card-body filterbody">
|
||||
|
||||
<div class="mb-3 row">
|
||||
<div class="col-md-2 control-label" for="checkboxes"><?= __("Date from"); ?></div>
|
||||
<div class="col-md-10">
|
||||
<div class="form-check-inline">
|
||||
<input name="dateFrom" id="dateFrom" type="date" class="form-control form-control-sm w-auto border border-secondary" <?php if ($this->input->post('dateFrom')) echo 'value="' . $this->input->post('dateFrom') . '"'; ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<div class="col-md-2 control-label" for="checkboxes"><?= __("Date to"); ?></div>
|
||||
<div class="col-md-10">
|
||||
<div class="form-check-inline">
|
||||
<input name="dateTo" id="dateTo" type="date" class="form-control form-control-sm w-auto border border-secondary" <?php if ($this->input->post('dateTo')) echo 'value="' . $this->input->post('dateTo') . '"'; ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<div class="col-md-2 control-label" for="checkboxes"><?= __("Deleted DXCC"); ?></div>
|
||||
<div class="col-md-10">
|
||||
@@ -192,9 +210,6 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-4 text-center">
|
||||
<button id="button2id" type="reset" name="button2id" class="btn btn-sm btn-warning"><?= __("Reset"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -335,7 +350,7 @@
|
||||
</div>';
|
||||
|
||||
} else {
|
||||
echo '<div class="alert alert-danger" role="alert">' . __("Nothing found!") . '</div>';
|
||||
echo '<div class="alert alert-danger" role="alert">' . __("No results found for your search criteria. Please try again.") . '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -2568,7 +2568,7 @@ function viewEqsl(picture, callsign) {
|
||||
/*
|
||||
* Used to fetch QSOs from the logbook in the awards
|
||||
*/
|
||||
function displayContacts(searchphrase, band, sat, orbit, mode, type, qsl) {
|
||||
function displayContacts(searchphrase, band, sat, orbit, mode, type, qsl, datefrom, dateto) {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/awards/qso_details_ajax',
|
||||
type: 'post',
|
||||
@@ -2579,7 +2579,9 @@ function viewEqsl(picture, callsign) {
|
||||
'Orbit': orbit,
|
||||
'Mode': mode,
|
||||
'Type': type,
|
||||
'QSL' : qsl
|
||||
'QSL' : qsl,
|
||||
'dateFrom': datefrom,
|
||||
'dateTo': dateto
|
||||
},
|
||||
success: function (html) {
|
||||
BootstrapDialog.show({
|
||||
@@ -2640,7 +2642,7 @@ function viewEqsl(picture, callsign) {
|
||||
});
|
||||
}
|
||||
|
||||
function displayContactsOnMap(target, searchphrase, band, sat, orbit, mode, type, qsl) {
|
||||
function displayContactsOnMap(target, searchphrase, band, sat, orbit, mode, type, qsl, datefrom, dateto) {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/awards/qso_details_ajax',
|
||||
type: 'post',
|
||||
@@ -2651,7 +2653,9 @@ function viewEqsl(picture, callsign) {
|
||||
'Orbit': orbit,
|
||||
'Mode': mode,
|
||||
'Type': type,
|
||||
'QSL' : qsl
|
||||
'QSL' : qsl,
|
||||
'dateFrom': datefrom,
|
||||
'dateTo': dateto
|
||||
},
|
||||
success: function (html) {
|
||||
var dialog = new BootstrapDialog({
|
||||
|
||||
@@ -73,6 +73,8 @@ function load_dxcc_map() {
|
||||
Antarctica: +$('#Antarctica').prop('checked'),
|
||||
sat: $("#sats").val(),
|
||||
orbit: $("#orbits").val(),
|
||||
dateFrom: $('#dateFrom').val(),
|
||||
dateTo: $('#dateTo').val(),
|
||||
},
|
||||
success: function(data) {
|
||||
load_dxcc_map2(data, worked, confirmed, notworked);
|
||||
@@ -204,5 +206,5 @@ function addMarker(L, D, mapColor, map) {
|
||||
|
||||
function onClick(e) {
|
||||
var marker = e.target;
|
||||
displayContactsOnMap($("#dxccmap"),marker.options.adif, $('#band2').val(), $('#sats').val(), $('#orbits').val(), $('#mode').val(), 'DXCC2');
|
||||
displayContactsOnMap($("#dxccmap"),marker.options.adif, $('#band2').val(), $('#sats').val(), $('#orbits').val(), $('#mode').val(), 'DXCC2', '', $('#dateFrom').val(), $('#dateTo').val());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user