kopia lustrzana https://github.com/magicbug/Cloudlog
[Map][Custom] /map/custom you can select to dates to map QSOs
rodzic
9d4ab310d2
commit
fa48db4263
|
@ -31,6 +31,105 @@ class Map extends CI_Controller {
|
|||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
function custom()
|
||||
{
|
||||
|
||||
// Calculate Lat/Lng from Locator to use on Maps
|
||||
if($this->session->userdata('user_locator')) {
|
||||
$this->load->library('qra');
|
||||
|
||||
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
|
||||
$data['qra'] = "set";
|
||||
$data['qra_lat'] = $qra_position[0];
|
||||
$data['qra_lng'] = $qra_position[1];
|
||||
} else {
|
||||
$data['qra'] = "none";
|
||||
}
|
||||
|
||||
$this->load->model('Stations');
|
||||
$station_id = $this->Stations->find_active();
|
||||
$station_data = $this->Stations->profile_clean($station_id);
|
||||
|
||||
// load the view
|
||||
$data['station_profile'] = $station_data;
|
||||
$data['page_title'] = "Map QSOs";
|
||||
|
||||
|
||||
if ($this->input->post('from')) {
|
||||
$from = $this->input->post('from');
|
||||
$from = DateTime::createFromFormat('m/d/Y g:i A', $from);
|
||||
$from = $from->format('Y-m-d');
|
||||
$footer_data['date_from'] = $from;
|
||||
} else {
|
||||
$footer_data['date_from'] = date('Y-m-d');
|
||||
}
|
||||
if ($this->input->post('to')) {
|
||||
$to = DateTime::createFromFormat('m/d/Y g:i A', $this->input->post('to'));
|
||||
$to = $to->modify('+1 day')->format('Y-m-d');
|
||||
$footer_data['date_to'] = $to;
|
||||
} else {
|
||||
$temp_to = new DateTime('tomorrow');
|
||||
$footer_data['date_to'] = $temp_to->format('Y-m-d');
|
||||
}
|
||||
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('map/custom_date');
|
||||
$this->load->view('interface_assets/footer',$footer_data);
|
||||
}
|
||||
|
||||
|
||||
function map_data_custom() {
|
||||
$start_date = $this->uri->segment(3);
|
||||
$end_date = $this->uri->segment(4);
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
$this->load->library('qra');
|
||||
|
||||
$qsos = $this->logbook_model->map_week_qsos($start_date, $end_date);
|
||||
|
||||
echo "{\"markers\": [";
|
||||
$count = 1;
|
||||
foreach ($qsos->result() as $row) {
|
||||
//print_r($row);
|
||||
if($row->COL_GRIDSQUARE != null) {
|
||||
$stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
|
||||
if($count != 1) {
|
||||
echo ",";
|
||||
}
|
||||
|
||||
if($row->COL_SAT_NAME != null) {
|
||||
echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />SAT: ".$row->COL_SAT_NAME."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
|
||||
} else {
|
||||
echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />Band: ".$row->COL_BAND."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
|
||||
}
|
||||
|
||||
$count++;
|
||||
|
||||
} else {
|
||||
$query = $this->db->query('
|
||||
SELECT *
|
||||
FROM dxcc_entities
|
||||
WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
|
||||
ORDER BY LENGTH( prefix ) DESC
|
||||
LIMIT 1
|
||||
');
|
||||
|
||||
foreach ($query->result() as $dxcc) {
|
||||
if($count != 1) {
|
||||
echo ",";
|
||||
}
|
||||
echo "{\"lat\":\"".$dxcc->lat."\",\"lng\":\"".$dxcc->long."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />Band: ".$row->COL_BAND."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
echo "]";
|
||||
echo "}";
|
||||
|
||||
}
|
||||
|
||||
function map_data() {
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
|
|
|
@ -142,7 +142,41 @@ $('[data-fancybox]').fancybox({
|
|||
|
||||
</script>
|
||||
|
||||
<?php if ($this->uri->segment(1) == "map") { ?>
|
||||
<?php if ($this->uri->segment(1) == "map" && $this->uri->segment(2) == "custom") { ?>
|
||||
<!-- Javascript used for ADIF Import and Export Areas -->
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/moment.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/tempusdominus-bootstrap-4.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/L.Maidenhead.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/leafembed.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
});
|
||||
|
||||
<?php if($qra == "set") { ?>
|
||||
var q_lat = <?php echo $qra_lat; ?>;
|
||||
var q_lng = <?php echo $qra_lng; ?>;
|
||||
<?php } else { ?>
|
||||
var q_lat = 40.313043;
|
||||
var q_lng = -32.695312;
|
||||
<?php } ?>
|
||||
|
||||
var qso_loc = '<?php echo site_url('map/map_data_custom/');?><?php echo urlencode($date_from); ?>/<?php echo urlencode($date_to); ?>';
|
||||
var q_zoom = 2;
|
||||
|
||||
$(document).ready(function(){
|
||||
<?php if ($this->config->item('map_gridsquares') != FALSE) { ?>
|
||||
var grid = "Yes";
|
||||
<?php } else { ?>
|
||||
var grid = "No";
|
||||
<?php } ?>
|
||||
initmap(grid);
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->uri->segment(1) == "map" && $this->uri->segment(2) == "") { ?>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/L.Maidenhead.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/leafembed.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<div class="container map-QSOs">
|
||||
|
||||
<h2><?php echo $station_profile->station_profile_name; ?> Station Profile QSOs (Custom Date)</h2>
|
||||
|
||||
<?php if($this->session->flashdata('notice')) { ?>
|
||||
<div class="alert alert-info" role="alert">
|
||||
<?php echo $this->session->flashdata('notice'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<form method="post" action="<?php echo site_url('map/custom');?>">
|
||||
<p class="card-text">From date:</p>
|
||||
<div class="row">
|
||||
<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">
|
||||
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="card-text">To date:</p>
|
||||
|
||||
<div class="row">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<input type="submit" value="Load Map">
|
||||
<br><br>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Map -->
|
||||
<div id="map" style="width: 100%; height: 700px;"></div>
|
||||
|
||||
<div class="alert alert-success" role="alert">Showing QSOs for Custom Date for Active Station Profile - <?php echo $station_profile->station_profile_name; ?> </div>
|
Ładowanie…
Reference in New Issue