[Map][Custom] Allows filtering custom map by band

pull/1091/head
Peter Goodhall 2021-07-14 11:37:06 +01:00
rodzic ad7525aae8
commit 08623f4667
4 zmienionych plików z 71 dodań i 10 usunięć

Wyświetl plik

@ -34,6 +34,26 @@ class Map extends CI_Controller {
function custom()
{
$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
$bands = $data['worked_bands'];
}
else {
$bands[] = $this->input->post('band');
}
}
else {
$bands = $data['worked_bands'];
}
$data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view
// Calculate Lat/Lng from Locator to use on Maps
if($this->session->userdata('user_locator')) {
$this->load->library('qra');
@ -83,11 +103,12 @@ class Map extends CI_Controller {
function map_data_custom() {
$start_date = $this->uri->segment(3);
$end_date = $this->uri->segment(4);
$band = $this->uri->segment(5);
$this->load->model('logbook_model');
$this->load->library('qra');
$qsos = $this->logbook_model->map_week_qsos(rawurldecode($start_date), rawurldecode($end_date));
$qsos = $this->logbook_model->map_custom_qsos(rawurldecode($start_date), rawurldecode($end_date), $band);
echo "{\"markers\": [";
$count = 1;

Wyświetl plik

@ -1021,7 +1021,7 @@ class Logbook_model extends CI_Model {
}
/* Return QSOs over a period of days */
function map_week_qsos($start, $end) {
function map_week_qsos($start, $end, $band) {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
@ -1034,6 +1034,30 @@ class Logbook_model extends CI_Model {
return $query;
}
/* used to return custom qsos requires start, end date plus a band */
function map_custom_qsos($start, $end, $band) {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'");
$this->db->where("station_id", $station_id);
if($band != "All" && $band != "SAT") {
$this->db->where("COL_BAND", $band);
}
if ($band == "SAT") {
$this->db->where("COL_PROP_MODE", "SAT");
}
$this->db->order_by("COL_TIME_ON", "ASC");
$query = $this->db->get($this->config->item('table_name'));
return $query;
}
/* Returns QSOs for the date sent eg 2011-09-30 */
function map_day($date) {
$CI =& get_instance();

Wyświetl plik

@ -267,7 +267,7 @@ function getLookupResult() {
var q_lng = -32.695312;
<?php } ?>
var qso_loc = '<?php echo site_url('map/map_data_custom/');?><?php echo rawurlencode($date_from); ?>/<?php echo rawurlencode($date_to); ?>';
var qso_loc = '<?php echo site_url('map/map_data_custom/');?><?php echo rawurlencode($date_from); ?>/<?php echo rawurlencode($date_to); ?>/<?php echo rawurlencode($this->input->post('band')); ?>';
var q_zoom = 2;
$(document).ready(function(){

Wyświetl plik

@ -1,4 +1,4 @@
<div class="container map-QSOs">
<div class="container custom-map-QSOs">
<h2><?php echo $station_profile->station_profile_name; ?> Station Profile QSOs (Custom Date)</h2>
@ -9,8 +9,8 @@
<?php } ?>
<form method="post" action="<?php echo site_url('map/custom');?>">
<p class="card-text">From date:</p>
<div class="row">
<label class="col-md-2 control-label" for="from">Start Date/Time</label>
<div class="input-group date col-md-3" id="datetimepicker1" data-target-input="nearest">
<input name="from" type="text" placeholder="DD/MM/YYYY" class="form-control datetimepicker-input" data-target="#datetimepicker1"/>
<div class="input-group-append" data-target="#datetimepicker1" data-toggle="datetimepicker">
@ -18,15 +18,31 @@
</div>
</div>
</div>
</row>
<p class="card-text">To date:</p>
<div class="row">
<label class="col-md-2 control-label" for="to">End Date/Time</label>
<div class="row">
<div class="input-group date col-md-3" id="datetimepicker2" data-target-input="nearest">
<div class="input-group date col-md-3" id="datetimepicker2" data-target-input="nearest">
<input name="to" type="text" placeholder="DD/MM/YYYY" class="form-control datetimepicker-input" data-target="#datetimepicker2"/>
<div class="input-group-append" data-target="#datetimepicker2" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</div>
</div>
<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 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 . '"';
if ($this->input->post('band') == $band) echo ' selected';
echo '>' . $band . '</option>'."\n";
} ?>
</select>
</div>
</div>