kopia lustrzana https://github.com/magicbug/Cloudlog
Added KML output options see wiki
rodzic
0fe30402bf
commit
fbfd9ced75
|
@ -0,0 +1,82 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|
||||
Provides outputted kml files for use with Google Map services
|
||||
All maps are stored within /kml in the root directory
|
||||
|
||||
*/
|
||||
|
||||
class Kml extends CI_Controller {
|
||||
|
||||
public function index()
|
||||
{
|
||||
// Load Librarys
|
||||
$this->load->library('qra');
|
||||
$this->load->helper('file');
|
||||
|
||||
// Load Database connections
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
// Get QSOs with Valid QRAs
|
||||
$qsos = $this->logbook_model->kml_get_all_qsos();
|
||||
|
||||
//header('Content-type: text/xml');
|
||||
//header("Cache-Control: no-cache");
|
||||
|
||||
$output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
|
||||
$output .= "<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
|
||||
|
||||
$output .= "<Document>";
|
||||
|
||||
foreach ($qsos->result() as $row)
|
||||
{
|
||||
$output .= "<Placemark>";
|
||||
//print_r($row);
|
||||
if($row->COL_GRIDSQUARE != null) {
|
||||
$stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
|
||||
|
||||
$lat = $stn_loc[0];
|
||||
$lng = $stn_loc[1];
|
||||
} else {
|
||||
$query = $this->db->query('
|
||||
SELECT *
|
||||
FROM dxcc
|
||||
WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
|
||||
ORDER BY LENGTH( prefix ) DESC
|
||||
LIMIT 1
|
||||
');
|
||||
|
||||
foreach ($query->result() as $dxcc) {
|
||||
$lat = $dxcc->lat;
|
||||
$lng = $dxcc->long;
|
||||
}
|
||||
}
|
||||
|
||||
$timestamp = strtotime($row->COL_TIME_ON);
|
||||
|
||||
|
||||
$output .= "<name>".$row->COL_CALL."</name>";
|
||||
$output .= "<description><![CDATA[<p>Date/Time: ".date('Y-m-d H:i:s', ($timestamp))."<br/>Band: ".$row->COL_BAND."<br /></p>]]></description>";
|
||||
$output .= "<Point>";
|
||||
$output .= "<coordinates>".$lng.",".$lat.",0</coordinates>";
|
||||
$output .= "</Point>";
|
||||
$output .= "</Placemark>";
|
||||
}
|
||||
|
||||
|
||||
$output .= "</Document>";
|
||||
$output .= "</kml>";
|
||||
|
||||
if ( ! write_file('kml/qsos.kml', $output))
|
||||
{
|
||||
echo 'Unable to write the file';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'qsos.kml written! and can be found in /kml/qsos.kml';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -171,6 +171,15 @@ class Logbook_model extends CI_Model {
|
|||
return $query;
|
||||
}
|
||||
|
||||
/* Get All QSOs with a Valid Grid */
|
||||
function kml_get_all_qsos() {
|
||||
$this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_GRIDSQUARE');
|
||||
$this->db->where('COL_GRIDSQUARE != \'null\'');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function get_date_qsos($date) {
|
||||
$this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME');
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
<div class="dashboard_log">
|
||||
<table class="logbook" width="100%">
|
||||
<tr class="log_title titles">
|
||||
<td>Date</td>
|
||||
<td>Time</td>
|
||||
<td>Call</td>
|
||||
<td>Mode</td>
|
||||
|
|
|
@ -11,19 +11,70 @@
|
|||
},
|
||||
"buffers":
|
||||
[
|
||||
{
|
||||
"file": "application/controllers/social.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1757,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "application/controllers/dashboard.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 6056,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "application/models/logbook_model.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 13676,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"contents": " <script type=\"text/javascript\" src=\"<?php echo base_url() ;?>/fancybox/jquery.mousewheel-3.0.4.pack.js\"></script>\n\n <script type=\"text/javascript\" src=\"<?php echo base_url() ;?>/fancybox/jquery.fancybox-1.3.4.pack.js\"></script>\n\n <link rel=\"stylesheet\" type=\"text/css\" href=\"<?php echo base_url() ;?>/fancybox/jquery.fancybox-1.3.4.css\" media=\"screen\" />\n\n <script type=\"text/javascript\">\n\n $(document).ready(function() {\n $(\".qsobox\").fancybox({\n 'autoDimensions' : false,\n 'width' : 700,\n 'height' : 300,\n 'transitionIn' : 'fade',\n 'transitionOut' : 'fade',\n 'type' : 'iframe'\n });\n\n\n });\n\n </script>\n\n\n \n <script type=\"text/javascript\">\n function create_map() {\n var latlng = new google.maps.LatLng(40.313043, -32.695312);\n var myOptions = {\n zoom: 2,\n center: latlng,\n mapTypeId: google.maps.MapTypeId.ROADMAP\n };\n var infowindow = new google.maps.InfoWindow();\n\n var marker, i;\n\n /* Get QSO points via json*/\n $.getJSON(\"/logbook/index.php/social/json_map/<?php echo $date; ?>\", function(data) {\n \n $.each(data.markers, function(i, val) {\n /* Create Markers */\n marker = new google.maps.Marker({\n position: new google.maps.LatLng(this.lat, this.lng),\n map: map\n });\n \n /* Store Popup Text */\n var content = this.html;\n \n /* Create Popups */\n google.maps.event.addListener(marker, 'click', (function(marker, i) {\n return function() {\n infowindow.setContent(content);\n infowindow.open(map, marker);\n }\n })(marker, i));\n });\n });\n\n var map = new google.maps.Map(document.getElementById(\"map\"),\n myOptions);\n }\n\n $(document).ready(function(){\n create_map();\n });\n </script>\n\n<h2>Social Media Map - <?php echo $formated_date; ?></h2>\n<div class=\"wrap_content dashboard\">\n\n <div id=\"map\" style=\"width: 100%; height: 300px\"></div> \n\n\n <div id=\"dashboard_container\">\n \n <div class=\"dashboard_top\">\n \n <div class=\"dashboard_log\">\n <table class=\"logbook\" width=\"100%\">\n <tr class=\"log_title titles\">\n <td>Time</td>\n <td>Call</td>\n <td>Mode</td>\n <td>Sent</td>\n <td>Recv</td>\n <td>Band</td>\n </tr>\n\n <?php $i = 0; \n foreach ($qsos->result() as $row) { ?>\n <?php echo '<tr class=\"tr'.($i & 1).'\">'; ?>\n <td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('d/m/y', $timestamp); ?></td>\n <td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>\n <td><a class=\"qsobox\" href=\"<?php echo site_url('logbook/view').\"/\".$row->COL_PRIMARY_KEY; ?>\"><?php echo strtoupper($row->COL_CALL); ?></a></td>\n <td><?php echo $row->COL_MODE; ?></td>\n <td><?php echo $row->COL_RST_SENT; ?></td>\n <td><?php echo $row->COL_RST_RCVD; ?></td>\n <?php if($row->COL_SAT_NAME != null) { ?>\n <td>SAT</td>\n <?php } else { ?>\n <td><?php echo $row->COL_BAND; ?></td>\n <?php } ?>\n </tr>\n <?php $i++; } ?>\n\n </table>\n\n </div>\n \n <div class=\"clear\"></div>\n </div>\n \n <!-- <div class=\"dashboard_bottom\">\n <div class=\"chart\" id=\"modechart_div\"></div>\n <div class=\"chart\" id=\"bandchart_div\"></div>\n </div> -->\n \n </div>\n\n <div class=\"clear\"></div>\n</div>",
|
||||
"file": "application/views/social/map.php",
|
||||
"file_size": 3479,
|
||||
"file_write_time": 129618638065790029,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 3336,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "application/config/routes.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1545,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
}
|
||||
],
|
||||
"build_system": "",
|
||||
"command_palette":
|
||||
{
|
||||
"height": 392.0,
|
||||
"height": 286.0,
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
"Package Control: ",
|
||||
"Package Control: Enable Package"
|
||||
],
|
||||
[
|
||||
"Pa",
|
||||
"Package Control: Add Repository"
|
||||
]
|
||||
],
|
||||
"width": 512.0
|
||||
},
|
||||
"console":
|
||||
{
|
||||
"height": 0.0
|
||||
"height": 143.0
|
||||
},
|
||||
"distraction_free":
|
||||
{
|
||||
|
@ -36,6 +87,7 @@
|
|||
},
|
||||
"file_history":
|
||||
[
|
||||
"/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/User/Default (Windows).sublime-keymap",
|
||||
"/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/dashboard.php",
|
||||
"/C/Users/Peter/git/HRD-Web-Frontend/application/views/dashboard/index.php",
|
||||
"/C/wamp/www/m3php/data.html",
|
||||
|
@ -47,7 +99,7 @@
|
|||
],
|
||||
"find":
|
||||
{
|
||||
"height": 0.0
|
||||
"height": 32.0
|
||||
},
|
||||
"find_in_files":
|
||||
{
|
||||
|
@ -64,6 +116,8 @@
|
|||
"case_sensitive": false,
|
||||
"find_history":
|
||||
[
|
||||
"get_last_qsos",
|
||||
"map_"
|
||||
],
|
||||
"highlight": true,
|
||||
"in_selection": false,
|
||||
|
@ -81,8 +135,144 @@
|
|||
"groups":
|
||||
[
|
||||
{
|
||||
"selected": 3,
|
||||
"sheets":
|
||||
[
|
||||
{
|
||||
"buffer": 0,
|
||||
"file": "application/controllers/social.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1757,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
392,
|
||||
405
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/PHP/PHP.tmLanguage",
|
||||
"translate_tabs_to_spaces": false
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 1,
|
||||
"file": "application/controllers/dashboard.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 6056,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
307,
|
||||
271
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/PHP/PHP.tmLanguage",
|
||||
"translate_tabs_to_spaces": false
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 72.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 2,
|
||||
"file": "application/models/logbook_model.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 13676,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
6092,
|
||||
6105
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/PHP/PHP.tmLanguage",
|
||||
"tab_size": 4.0,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 2712.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 3,
|
||||
"file": "application/views/social/map.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 3336,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
2964,
|
||||
2964
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/PHP/PHP.tmLanguage",
|
||||
"translate_tabs_to_spaces": false
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 1464.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 4,
|
||||
"file": "application/config/routes.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1545,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
1392,
|
||||
1392
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/PHP/PHP.tmLanguage"
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 270.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -92,7 +282,7 @@
|
|||
},
|
||||
"input":
|
||||
{
|
||||
"height": 0.0
|
||||
"height": 31.0
|
||||
},
|
||||
"layout":
|
||||
{
|
||||
|
@ -142,6 +332,6 @@
|
|||
"show_open_files": false,
|
||||
"show_tabs": true,
|
||||
"side_bar_visible": true,
|
||||
"side_bar_width": 211.0,
|
||||
"side_bar_width": 210.0,
|
||||
"status_bar_visible": true
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Ładowanie…
Reference in New Issue