Changeset 210 for trunk/client/inc
- Timestamp:
- May 16, 2014, 1:38:42 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/inc/javascript.php
r64 r210 48 48 ######################################################### 49 49 50 50 51 function googlemaps(){ 51 52 global $dbi,$prefix,$id_comune,$googlemaps,$op,$gkey,$lang; … … 56 57 $sql = mysql_query("select indirizzo from ".$prefix."_ele_sede where id_sede='$id_sede'", $dbi); 57 58 list($indirizzo)=mysql_fetch_row($sql); 58 $indirizzocomune="$indirizzo , $comune , $lang"; 59 # javascript per mappa 60 $jsmaps =" 61 <div id=\"mapsearch\" style=\"margin:0 auto 0;\"> 62 <span style=\"color:#676767;font-size:11px;margin:10px;padding:4px;\">Loading...</span> 63 </div> 59 $address="$indirizzo $comune"; 60 61 $url = sprintf('http://maps.google.com/maps?output=js&q=%s',rawurlencode($address)); 62 $result = false; 63 64 if($result = file_get_contents($url)) { 65 $coords = array(); 66 67 if(strpos($result,'errortips') > 1 || strpos($result,'Did you mean:') !== false) { 68 return false; 69 } 70 71 preg_match('!center:\s*{lat:\s*(-?\d+\.\d+),lng:\s*(-?\d+\.\d+)}!U', $result, $matches); 72 73 $coords['lat'] = $matches[1]; 74 $coords['long'] = $matches[2]; 75 } 64 76 65 66 <script src=\"http://maps.google.com/maps?file=api&v=2&key=$gkey\" 67 type=\"text/javascript\"></script> 68 <script src=\"http://www.google.com/uds/api?file=uds.js&v=1.0&source=uds-msw&key=$gkey\" 69 type=\"text/javascript\"></script> 70 <style type=\"text/css\"> 71 @import url(\"http://www.google.com/uds/css/gsearch.css\"); 72 </style> 73 <script type=\"text/javascript\"> 74 window._uds_msw_donotrepair = true; 75 </script> 76 <script src=\"http://www.google.com/uds/solutions/mapsearch/gsmapsearch.js?mode=new\" 77 type=\"text/javascript\"></script> 78 <style type=\"text/css\"> 79 @import url(\"http://www.google.com/uds/solutions/mapsearch/gsmapsearch.css\"); 80 </style> 77 echo ' 78 <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&language=it"></script> 79 <script type="text/javascript"> 80 function initialize() { 81 var latlng = new google.maps.LatLng('.$coords['lat'].','.$coords['long'].'); // centro della mappa 82 var myLatlng = new google.maps.LatLng('.$coords['lat'].','.$coords['long'].'); // segnapunto 83 // definizione della mappa 84 var myOptions = { 85 zoom: 16, 86 center: latlng, 87 mapTypeId: google.maps.MapTypeId.ROADMAP, 88 mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR} 89 } 90 mymap = new google.maps.Map(document.getElementById("map"), myOptions); 91 // definizione segnapunto 92 var marker = new google.maps.Marker({ 93 position: myLatlng, 94 map: mymap, 95 title:"'.$address.'" 96 }); 81 97 82 <style type=\"text/css\"> 83 .gsmsc-mapDiv { 84 height : 350px; 85 } 86 87 .gsmsc-idleMapDiv { 88 height : 350px; 89 } 90 91 #mapsearch { 92 width : 450px; 93 margin: 10px; 94 padding: 4px; 95 } 96 </style> 97 <script type=\"text/javascript\"> 98 function LoadMapSearchControl() { 99 100 var options = { 101 zoomControl : GSmapSearchControl.ZOOM_CONTROL_ENABLE_ALL, 102 title : \"$indirizzo\", 103 url : \"http://www.eleonline.it\", 104 idleMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM+1, 105 activeMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM+1 106 } 107 108 new GSmapSearchControl( 109 document.getElementById(\"mapsearch\"), 110 \"$indirizzocomune\", 111 options 112 ); 113 114 } 115 116 GSearch.setOnLoadCallback(LoadMapSearchControl); 117 </script> 118 119 <center>"; 120 121 return $jsmaps; 98 } 99 </script> 100 '; 122 101 } 123 124 125 102 ?>
Note:
See TracChangeset
for help on using the changeset viewer.