Changeset 247 for trunk/client/inc
- Timestamp:
- Jan 30, 2016, 11:38:54 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/inc/javascript.php
r210 r247 49 49 50 50 51 52 53 54 55 51 56 function googlemaps(){ 52 57 global $dbi,$prefix,$id_comune,$googlemaps,$op,$gkey,$lang; … … 57 62 $sql = mysql_query("select indirizzo from ".$prefix."_ele_sede where id_sede='$id_sede'", $dbi); 58 63 list($indirizzo)=mysql_fetch_row($sql); 59 $address="$indirizzo $comune"; 64 $address=rawurlencode("$indirizzo,$comune,58047"); 65 66 $resultGeoCode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$address.'&sensor=false'); 67 68 $output= json_decode($resultGeoCode); 69 70 if($output->status == 'OK'){ 71 $latitude = $output->results[0]->geometry->location->lat; //Returns Latitude 72 $longitude = $output->results[0]->geometry->location->lng; // Returns Longitude 73 $location = $output->results[0]->formatted_address; 74 } 75 76 77 $coords['lat'] = $latitude; 78 $coords['long'] = $longitude; 79 80 81 82 83 84 /* 85 86 87 60 88 61 89 $url = sprintf('http://maps.google.com/maps?output=js&q=%s',rawurlencode($address)); … … 75 103 } 76 104 105 */ 106 107 108 109 110 111 112 77 113 echo ' 78 114 <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&language=it"></script> 79 115 <script type="text/javascript"> 80 function initialize() {116 function maps() { 81 117 var latlng = new google.maps.LatLng('.$coords['lat'].','.$coords['long'].'); // centro della mappa 82 118 var myLatlng = new google.maps.LatLng('.$coords['lat'].','.$coords['long'].'); // segnapunto … … 99 135 </script> 100 136 '; 137 101 138 } 102 139 ?>
Note:
See TracChangeset
for help on using the changeset viewer.