[Cabrillo export] Added better date selection

pull/2063/head
Andreas 2023-04-12 15:01:53 +02:00
rodzic ef3c92d9cf
commit bae96ce1e6
3 zmienionych plików z 22 dodań i 13 usunięć

Wyświetl plik

@ -78,16 +78,11 @@ class Cabrillo extends CI_Controller {
$this->load->model('stations');
$station_id = $this->security->xss_clean($this->input->post('station_id'));
$contest_id = $this->security->xss_clean($this->input->post('contestid'));
$fromto = $this->security->xss_clean($this->input->post('contestdates'));
$fromto = explode(',', $fromto);
$from = $fromto[0];
$to = $fromto[1];
$from = $this->security->xss_clean($this->input->post('contestdatesfrom'));
$to = $this->security->xss_clean($this->input->post('contestdatesto'));
$station = $this->stations->profile($station_id);

Wyświetl plik

@ -233,7 +233,7 @@ class Contesting_model extends CI_Model {
}
function get_contest_dates($station_id, $year, $contestid) {
$sql = "select min(date(col_time_on)) mindate, max(date(col_time_on)) maxdate
$sql = "select distinct (date(col_time_on)) date
from " . $this->config->item('table_name') . "
where coalesce(COL_CONTEST_ID, '') <> ''
and station_id =" . $station_id .

Wyświetl plik

@ -7,6 +7,7 @@ function loadYears() {
type: 'post',
data: {'station_id': $("#station_id").val()},
success: function (data) {
if (data.length > 0) {
$(".contestyear").append('<div class="col-md-2 control-label" for="year">Select year: </div>' +
'<select id="year" class="custom-select my-1 mr-sm-2 col-md-2" name="year">' +
'</select>' +
@ -18,6 +19,9 @@ function loadYears() {
.attr("value",value.year)
.text(value.year));
});
} else {
$(".contestyear").append("No contests were found for this station location!");
}
}
});
}
@ -56,16 +60,26 @@ function loadContestDates() {
'contestid': $("#contestid").val(),
'station_id': $("#station_id").val()},
success: function (data) {
$(".contestdates").append('<div class="col-md-2 control-label" for="contestdates">Select daterange: </div>' +
'<select class="custom-select my-1 mr-sm-2 col-md-3" id="contestdates" name="contestdates">' +
$(".contestdates").append('<div class="col-md-2 control-label" for="contestdates">Select date range: </div>' +
'<select class="custom-select my-1 mr-sm-2 col-md-1" id="contestdatesfrom" name="contestdatesfrom">' +
'</select>' +
'<select class="custom-select my-1 mr-sm-2 col-md-1" id="contestdatesto" name="contestdatesto">' +
'</select>' +
' <button class="btn btn-sm btn-primary" type="submit">Export</button>');
$.each(data, function(key, value) {
$('#contestdates')
$('#contestdatesfrom')
.append($("<option></option>")
.attr("value", value.mindate + ',' + value.maxdate)
.text(value.mindate + ' - ' + value.maxdate));
.attr("value", value.date)
.text(value.date));
});
$.each(data, function(key, value) {
$('#contestdatesto')
.append($("<option></option>")
.attr("value", value.date)
.text(value.date));
});
}
});