diff --git a/assets/imgs/custmarker.png b/assets/imgs/custmarker.png new file mode 100644 index 0000000..363da85 Binary files /dev/null and b/assets/imgs/custmarker.png differ diff --git a/mod_taxi.php b/mod_taxi.php new file mode 100644 index 0000000..f6af67b --- /dev/null +++ b/mod_taxi.php @@ -0,0 +1,271 @@ +get('eurokm'); + +$document = & JFactory::getDocument(); +$document->addScript('http://maps.google.com/maps/api/js?sensor=true'); + +$document->addScriptDeclaration(" + var location1; + var location2; + + var address1; + var address2; + + var latlng; + var geocoder; + var map; + + var line; + + var infowindow1; + var infowindow2; + + var distance; + + function initialize(){ + geocoder = new google.maps.Geocoder(); + + address1 = document.getElementById(\"address1\").value; + address2 = document.getElementById(\"address2\").value; + + if (geocoder){ + geocoder.geocode( { 'address': address1}, function(results, status){ + if (status == google.maps.GeocoderStatus.OK){ + location1 = results[0].geometry.location; + } else { + alert('Geocode was not successful for the following reason: ' + status); + } + }); + + geocoder.geocode( { 'address': address2}, function(results, status){ + if (status == google.maps.GeocoderStatus.OK){ + location2 = results[0].geometry.location; + showMap(); + } else { + alert('Geocode was not successful for the following reason: ' + status); + } + }); + + } + } + + function showMap(){ + latlng = new google.maps.LatLng((location1.lat()+location2.lat())/2,(location1.lng()+location2.lng())/2); + var maptype = document.getElementById('maptype').value; + var typeId; + + if (maptype == 'roadmap') + typeId = google.maps.MapTypeId.ROADMAP; + else if (maptype == 'hybrid') + typeId = google.maps.MapTypeId.HYBRID; + else if (maptype == 'satellite') + typeId = google.maps.MapTypeId.SATELLITE; + else if (maptype == 'terrain') + typeId = google.maps.MapTypeId.TERRAIN; + + var mapOptions = { + zoom: 1, + center: latlng, + mapTypeId: typeId + }; + + map = new google.maps.Map(document.getElementById(\"map_canvas\"), mapOptions); + + google.maps.event.addListener(map, 'maptypeid_changed', function() { + maptype = map.getMapTypeId(); + document.getElementById('maptype').value = maptype; + }); + + var rabbit = new google.maps.MarkerImage('distance-finder-custom-marker-image.png'); + + var marker1 = new google.maps.Marker({ + map: map, + position: location1, + title: 'First location', + icon: rabbit, + draggable: true + }); + + var marker2 = new google.maps.Marker({ + map: map, + position: location2, + title: 'Second location', + icon: rabbit, + draggable: true + }); + + var text1 = '
Coordinates: '+location1+'
'+ + 'Address: '+address1+'
'+ + 'Coordinates: '+location2+'
'+ + 'Address: '+address2+'
'+ + 'Coordinates: '+location1+'
'+ + 'Address: '+address1+'
'+ + 'Coordinates: '+location2+'
'+ + 'Address: '+address2+'
'+ + 'Calcola il costo del tuo taxi | +||||||
+ | ||||||
Indirizzo di partenza: | ++ | + | + | |||
Indirizzo di arrivo: | ++ | + | + | |||
Mezzo: + + | +||||||
+ | ||||||
+ |