kopia lustrzana https://github.com/magicbug/Cloudlog
Moved dashboard maps to Google Maps API v3 removing the need for an API key.
rodzic
e13e7819ad
commit
5523f2e2c2
|
@ -5,7 +5,6 @@
|
|||
$config['table_name'] = "table_hrd_contacts_v01";
|
||||
$config['locator'] = "IO91JS";
|
||||
$config['display_freq'] = false; // hide and display freq input on Add QSO
|
||||
$config['google_maps_api'] = "ABQIAAAA74tY2H5PTGpzLdnwXQmLXxTAaiXfF7TN3brq2P-N4wxlXpK9XRR0YWnumNpDAv2MVqJhk4dDpznb9A";
|
||||
|
||||
/* User options */
|
||||
// Use authentication?
|
||||
|
|
|
@ -63,12 +63,19 @@ class Dashboard extends CI_Controller {
|
|||
$qsos = $this->logbook_model->map_week_qsos($mon, $sun);
|
||||
|
||||
echo "{\"markers\": [";
|
||||
|
||||
$count = 1;
|
||||
foreach ($qsos->result() as $row) {
|
||||
//print_r($row);
|
||||
if($row->COL_GRIDSQUARE != null) {
|
||||
$stn_loc = qra2latlong($row->COL_GRIDSQUARE);
|
||||
echo "{\"point\":new GLatLng(".$stn_loc[0].",".$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."\"},";
|
||||
if($count != 1) {
|
||||
echo ",";
|
||||
}
|
||||
|
||||
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 *
|
||||
|
@ -79,7 +86,11 @@ class Dashboard extends CI_Controller {
|
|||
');
|
||||
|
||||
foreach ($query->result() as $dxcc) {
|
||||
echo "{\"point\":new GLatLng(".$dxcc->lat.",".$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."\"},";
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,51 @@
|
|||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function create_map() {
|
||||
var latlng = new google.maps.LatLng(40.313043, -32.695312);
|
||||
var myOptions = {
|
||||
zoom: 3,
|
||||
center: latlng,
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
};
|
||||
var infowindow = new google.maps.InfoWindow();
|
||||
|
||||
var marker, i;
|
||||
|
||||
/* Get QSO points via json*/
|
||||
$.getJSON("/logbook/index.php/dashboard/map", function(data) {
|
||||
|
||||
$.each(data.markers, function(i, val) {
|
||||
/* Create Markers */
|
||||
marker = new google.maps.Marker({
|
||||
position: new google.maps.LatLng(this.lat, this.lng),
|
||||
map: map
|
||||
});
|
||||
|
||||
/* Store Popup Text */
|
||||
var content = this.html;
|
||||
|
||||
/* Create Popups */
|
||||
google.maps.event.addListener(marker, 'click', (function(marker, i) {
|
||||
return function() {
|
||||
infowindow.setContent(content);
|
||||
infowindow.open(map, marker);
|
||||
}
|
||||
})(marker, i));
|
||||
});
|
||||
});
|
||||
|
||||
var map = new google.maps.Map(document.getElementById("map"),
|
||||
myOptions);
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
create_map();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) { ?>
|
||||
<div id="message" >
|
||||
|
@ -185,90 +230,5 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
<div class="dash_left">
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
if (GBrowserIsCompatible()) {
|
||||
// Display the map, with some controls
|
||||
var map = new GMap(document.getElementById("map"));
|
||||
map.addControl(new GLargeMapControl());
|
||||
//map.addControl(new GMapTypeControl());
|
||||
map.setCenter(new GLatLng(33.137551,0.703125),2);
|
||||
|
||||
// arrays to hold copies of the markers and html used by the side_bar
|
||||
// because the function closure trick doesnt work there
|
||||
var side_bar_html = "";
|
||||
var gmarkers = [];
|
||||
var htmls = [];
|
||||
var i = 0;
|
||||
|
||||
// A function to create the marker and set up the event window
|
||||
function createMarker(point,name,html) {
|
||||
var marker = new GMarker(point);
|
||||
GEvent.addListener(marker, "click", function() {
|
||||
marker.openInfoWindowHtml(html);
|
||||
});
|
||||
// save the info we need to use later for the side_bar
|
||||
gmarkers[i] = marker;
|
||||
htmls[i] = html;
|
||||
// add a line to the side_bar html
|
||||
side_bar_html += '<a href="javascript:myclick(' + i + ')">' + name + '<\/a><br>';
|
||||
i++;
|
||||
return marker;
|
||||
}
|
||||
|
||||
// This function picks up the click and opens the corresponding info window
|
||||
function myclick(i) {
|
||||
gmarkers[i].openInfoWindowHtml(htmls[i]);
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// === Define the function thats going to process the JSON file ===
|
||||
process_it = function(doc) {
|
||||
// === Parse the JSON document ===
|
||||
var jsonData = eval('(' + doc + ')');
|
||||
|
||||
// === Plot the markers ===
|
||||
for (var i=0; i<jsonData.markers.length; i++) {
|
||||
var marker = createMarker(jsonData.markers[i].point, jsonData.markers[i].label, jsonData.markers[i].html);
|
||||
map.addOverlay(marker);
|
||||
}
|
||||
|
||||
// put the assembled side_bar_html contents into the side_bar div
|
||||
document.getElementById("side_bar").innerHTML = side_bar_html;
|
||||
|
||||
// === Plot the polylines ===
|
||||
for (var i=0; i<jsonData.lines.length; i++) {
|
||||
map.addOverlay(new GPolyline(jsonData.lines[i].points, jsonData.lines[i].colour, jsonData.lines[i].width));
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// === Fetch the JSON data file ====
|
||||
GDownloadUrl("<?php echo site_url('/dashboard/map'); ?>", process_it);
|
||||
// ================================================================
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
alert("Sorry, the Google Maps API is not compatible with this browser");
|
||||
}
|
||||
|
||||
// This Javascript is based on code provided by the
|
||||
// Community Church Javascript Team
|
||||
// http://www.bisphamchurch.org.uk/
|
||||
// http://econym.org.uk/gmap/
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
|
@ -142,11 +142,10 @@
|
|||
|
||||
</style>
|
||||
|
||||
<script src="http://maps.google.com/maps?file=api&v=3&key=<?php echo $this->config->item('google_maps_api'); ?>&sensor=true"
|
||||
type="text/javascript"></script>
|
||||
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
|
||||
</head>
|
||||
|
||||
<body onunload="GUnload()">
|
||||
<body>
|
||||
|
||||
<div id="nav">
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": "/C/Users/Peter/git/HRD-Web-Frontend"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
{
|
||||
"auto_complete":
|
||||
{
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
"background",
|
||||
"background: background-color: hex"
|
||||
]
|
||||
]
|
||||
},
|
||||
"buffers":
|
||||
[
|
||||
],
|
||||
"build_system": "",
|
||||
"command_palette":
|
||||
{
|
||||
"height": 392.0,
|
||||
"selected_items":
|
||||
[
|
||||
],
|
||||
"width": 512.0
|
||||
},
|
||||
"console":
|
||||
{
|
||||
"height": 0.0
|
||||
},
|
||||
"distraction_free":
|
||||
{
|
||||
"menu_visible": true,
|
||||
"show_minimap": false,
|
||||
"show_open_files": false,
|
||||
"show_tabs": false,
|
||||
"side_bar_visible": false,
|
||||
"status_bar_visible": false
|
||||
},
|
||||
"file_history":
|
||||
[
|
||||
"/C/Users/Peter/git/HRD-Web-Frontend/index.php",
|
||||
"/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/Default/Base File.sublime-settings",
|
||||
"/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/User/Base File.sublime-settings"
|
||||
],
|
||||
"find":
|
||||
{
|
||||
"height": 0.0
|
||||
},
|
||||
"find_in_files":
|
||||
{
|
||||
"height": 0.0,
|
||||
"include_history":
|
||||
[
|
||||
],
|
||||
"location_history":
|
||||
[
|
||||
]
|
||||
},
|
||||
"find_state":
|
||||
{
|
||||
"case_sensitive": false,
|
||||
"find_history":
|
||||
[
|
||||
],
|
||||
"highlight": true,
|
||||
"in_selection": false,
|
||||
"preserve_case": false,
|
||||
"regex": false,
|
||||
"replace_history":
|
||||
[
|
||||
],
|
||||
"reverse": false,
|
||||
"show_context": true,
|
||||
"use_buffer": true,
|
||||
"whole_word": false,
|
||||
"wrap": true
|
||||
},
|
||||
"groups":
|
||||
[
|
||||
{
|
||||
"sheets":
|
||||
[
|
||||
]
|
||||
}
|
||||
],
|
||||
"incremental_find":
|
||||
{
|
||||
"height": 0.0
|
||||
},
|
||||
"input":
|
||||
{
|
||||
"height": 0.0
|
||||
},
|
||||
"layout":
|
||||
{
|
||||
"cells":
|
||||
[
|
||||
[
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1
|
||||
]
|
||||
],
|
||||
"cols":
|
||||
[
|
||||
0.0,
|
||||
1.0
|
||||
],
|
||||
"rows":
|
||||
[
|
||||
0.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
"menu_visible": true,
|
||||
"replace":
|
||||
{
|
||||
"height": 0.0
|
||||
},
|
||||
"save_all_on_build": true,
|
||||
"select_file":
|
||||
{
|
||||
"height": 0.0,
|
||||
"selected_items":
|
||||
[
|
||||
],
|
||||
"width": 0.0
|
||||
},
|
||||
"select_project":
|
||||
{
|
||||
"height": 500.0,
|
||||
"selected_items":
|
||||
[
|
||||
],
|
||||
"width": 380.0
|
||||
},
|
||||
"show_minimap": true,
|
||||
"show_open_files": false,
|
||||
"show_tabs": true,
|
||||
"side_bar_visible": true,
|
||||
"side_bar_width": 150.0,
|
||||
"status_bar_visible": true
|
||||
}
|
Ładowanie…
Reference in New Issue