[Cabrillo export] Added better date selection
这个提交包含在:
父节点
ef3c92d9cf
当前提交
bae96ce1e6
共有 3 个文件被更改,包括 22 次插入 和 13 次删除
|
|
@ -78,16 +78,11 @@ class Cabrillo extends CI_Controller {
|
||||||
|
|
||||||
$this->load->model('stations');
|
$this->load->model('stations');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$station_id = $this->security->xss_clean($this->input->post('station_id'));
|
$station_id = $this->security->xss_clean($this->input->post('station_id'));
|
||||||
$contest_id = $this->security->xss_clean($this->input->post('contestid'));
|
$contest_id = $this->security->xss_clean($this->input->post('contestid'));
|
||||||
$fromto = $this->security->xss_clean($this->input->post('contestdates'));
|
|
||||||
|
|
||||||
$fromto = explode(',', $fromto);
|
$from = $this->security->xss_clean($this->input->post('contestdatesfrom'));
|
||||||
|
$to = $this->security->xss_clean($this->input->post('contestdatesto'));
|
||||||
$from = $fromto[0];
|
|
||||||
$to = $fromto[1];
|
|
||||||
|
|
||||||
$station = $this->stations->profile($station_id);
|
$station = $this->stations->profile($station_id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ class Contesting_model extends CI_Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_contest_dates($station_id, $year, $contestid) {
|
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') . "
|
from " . $this->config->item('table_name') . "
|
||||||
where coalesce(COL_CONTEST_ID, '') <> ''
|
where coalesce(COL_CONTEST_ID, '') <> ''
|
||||||
and station_id =" . $station_id .
|
and station_id =" . $station_id .
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ function loadYears() {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
data: {'station_id': $("#station_id").val()},
|
data: {'station_id': $("#station_id").val()},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
if (data.length > 0) {
|
||||||
$(".contestyear").append('<div class="col-md-2 control-label" for="year">Select year: </div>' +
|
$(".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 id="year" class="custom-select my-1 mr-sm-2 col-md-2" name="year">' +
|
||||||
'</select>' +
|
'</select>' +
|
||||||
|
|
@ -18,6 +19,9 @@ function loadYears() {
|
||||||
.attr("value",value.year)
|
.attr("value",value.year)
|
||||||
.text(value.year));
|
.text(value.year));
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
$(".contestyear").append("No contests were found for this station location!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -57,15 +61,25 @@ function loadContestDates() {
|
||||||
'station_id': $("#station_id").val()},
|
'station_id': $("#station_id").val()},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$(".contestdates").append('<div class="col-md-2 control-label" for="contestdates">Select date range: </div>' +
|
$(".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-3" id="contestdates" name="contestdates">' +
|
'<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>' +
|
'</select>' +
|
||||||
' <button class="btn btn-sm btn-primary" type="submit">Export</button>');
|
' <button class="btn btn-sm btn-primary" type="submit">Export</button>');
|
||||||
|
|
||||||
$.each(data, function(key, value) {
|
$.each(data, function(key, value) {
|
||||||
$('#contestdates')
|
$('#contestdatesfrom')
|
||||||
.append($("<option></option>")
|
.append($("<option></option>")
|
||||||
.attr("value", value.mindate + ',' + value.maxdate)
|
.attr("value", value.date)
|
||||||
.text(value.mindate + ' - ' + value.maxdate));
|
.text(value.date));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$.each(data, function(key, value) {
|
||||||
|
$('#contestdatesto')
|
||||||
|
.append($("<option></option>")
|
||||||
|
.attr("value", value.date)
|
||||||
|
.text(value.date));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用