| Server IP : 162.214.74.102 / Your IP : 216.73.217.111 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_projetos/sopizzas/ |
Upload File : |
<?php
//$_REQUEST['securitykey'] = SECURITY_KEY;
//include("webservice/includes/main_init.php");
include("webservice/includes/config.php");
include_once 'webservice/includes/dbconnection.php';
$link = Db_Connect();
include_once 'webservice/includes/common_function.php';
$orderid = $_REQUEST["id"];
if($orderid!='' or $orderid>0)
{
$execute = array(':orderid' => $orderid);
$order = find("first", "rt_order", "deliverylatitude, deliverylongitude, driverid, restaurant_id", "where orderid =:orderid", $execute);
$res_id = $order['restaurant_id'];
$deliverylatitude = $order['deliverylatitude'];
$deliverylongitude = $order['deliverylongitude'];
$execute = array(':driverid' => $order['driverid']);
$driver = find("first", "rt_driver", "current_latitude, current_longitude", "where driver_id =:driverid", $execute);
$current_latitude = $driver['current_latitude'];
$current_longitude = $driver['current_longitude'];
// $current_latitude = "52.672238";
// $current_longitude = "6.144017";
$execute = array(':restaurant_id' => $res_id);
$restaurant = find("first", "rt_restaurant", "latitude, longitude", "where restaurant_id =:restaurant_id", $execute);
// print_r($restaurant); exit();
$restaurant_latitude = $restaurant['latitude'];
$restaurant_longitude = $restaurant['longitude'];
}else{
echo "sorry!";
exit();
}
?>
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>My order track</TITLE>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" ></script>
</HEAD>
<BODY>
<div id="map" style="width: 800px;height: 500px;"></div>
<INPUT type="hidden" NAME="order_latitude" id="order_latitude" value="<?php echo $deliverylatitude; ?>">
<INPUT type="hidden" NAME="order_longitude" id="order_longitude" value="<?php echo $deliverylongitude; ?>">
<INPUT type="hidden" NAME="restaurant_latitude" id="restaurant_latitude" value="<?php echo $restaurant_latitude; ?>">
<INPUT type="hidden" NAME="restaurant_longitude" id="restaurant_longitude" value="<?php echo $restaurant_longitude; ?>">
<INPUT type="hidden" NAME="current_latitude" id="current_latitude" value="<?php echo $current_latitude; ?>">
<INPUT type="hidden" NAME="current_longitude" id="current_longitude" value="<?php echo $current_longitude; ?>">
<div style="display:none;" id="map_canvas" style="float:left;width:70%;height:100%;"></div>
<div style="display:none;" id="control_panel" style="float:right;width:30%;text-align:left;padding-top:20px">
<table border="1"><tr><td>
<div style="display:none;" id="directions_panel" style="margin:20px;background-color:#FFEE77;"></div>
</td></tr><tr><td>
<div style="display:none;" id="direction_details" style="margin:20px;"></div>
</td></tr><tr><td>
<div style="display:none;" id="side_bar" style="margin:20px;"></div>
</BODY>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC8zo3TpQeSWfXrDvro_gPE5YdrAFQr6fQ">
</script>
<script type="text/javascript">
$(document).ready(function(){
initialize();
});
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var gmarkers = [];
var map = null;
var startLocation = null;
var endLocation = null;
var directionsService = null;
var waypts = null;
var polyline = new google.maps.Polyline({
path: [],
strokeColor: '#FF0000',
strokeWeight: 3
});
function initialize() {
//driverlatlon();
directionsDisplay = new google.maps.DirectionsRenderer();
var chicago = new google.maps.LatLng(32.926395, -117.207948);
var myOptions = {
zoom: 6,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: chicago
}
map = new google.maps.Map(document.getElementById("map"), myOptions);
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});
directionsDisplay.setMap(map);
calcRoute();
//createMarker(new google.maps.LatLng(current_latitude,current_longitude), "waypoint", "", "black");
}
function calcRoute() {
var order_latitude = $("#order_latitude").val();
var order_longitude = $("#order_longitude").val();
var restaurant_latitude = $("#restaurant_latitude").val();
var restaurant_longitude = $("#restaurant_longitude").val();
var current_latitude = $("#current_latitude").val();
var current_longitude = $("#current_longitude").val();
directionsService = new google.maps.DirectionsService();
var request = {
origin: new google.maps.LatLng(restaurant_latitude, restaurant_longitude),
destination: new google.maps.LatLng(order_latitude, order_longitude),
waypoints: [{
location:new google.maps.LatLng(current_latitude,current_longitude),
stopover:true}],
optimizeWaypoints: true,
provideRouteAlternatives: true,
travelMode: google.maps.DirectionsTravelMode.DRIVING //DRIVING, BICYCLING, TRANSIT, WALKING
};
directionsService.route(request, RenderCustomDirections);
}
function RenderCustomDirections(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
waypts = [];
var bounds = new google.maps.LatLngBounds();
var route = response.routes[0];
var summaryPanel = document.getElementById("directions_panel");
var detailsPanel = document.getElementById("direction_details");
startLocation = new Object();
endLocation = new Object();
summaryPanel.innerHTML = "";
detailsPanel.innerHTML = '<ul>';
// For each route, display summary information.
for (var i = 0; i < route.legs.length; i++) {
var routeSegment = i + 1;
summaryPanel.innerHTML += "<b>Route Segment: " + routeSegment + "</b><br />";
summaryPanel.innerHTML += route.legs[i].start_address + " to ";
summaryPanel.innerHTML += route.legs[i].end_address + "<br />";
summaryPanel.innerHTML += route.legs[i].distance.text + "<br /><br />";
}
var path = response.routes[0].overview_path;
var legs = response.routes[0].legs;
// alert("processing "+legs.length+" legs");
for (i=0;i<legs.length;i++) {
if (i == 0) {
startLocation.latlng = legs[i].start_location;
startLocation.address = legs[i].start_address;
startLocation.marker = createMarker(legs[i].start_location,"start",legs[i].start_address,"green");
} else {
waypts[i] = new Object();
waypts[i].latlng = legs[i].start_location;
waypts[i].address = legs[i].start_address;
waypts[i].marker = createMarker(legs[i].start_location,"waypoint",legs[i].start_address,"yellow");
}
endLocation.latlng = legs[i].end_location;
endLocation.address = legs[i].end_address;
var steps = legs[i].steps;
// alert("processing "+steps.length+" steps");
for (j=0;j<steps.length;j++) {
var nextSegment = steps[j].path;
/*
detailsPanel.innerHTML += "<li>"+steps[j].instructions;
var dist_dur = "";
if (steps[j].distance && steps[j].distance.text) dist_dur += " "+steps[j].distance.text;
if (steps[j].duration && steps[j].duration.text) dist_dur += " "+steps[j].duration.text;
if (dist_dur != "") {
detailsPanel.innerHTML += "("+dist_dur+")<br /></li>";
} else {
detailsPanel.innerHTML += "</li>";
}
*/
for (k=0;k<nextSegment.length;k++) {
polyline.getPath().push(nextSegment[k]);
bounds.extend(nextSegment[k]);
}
}
}
detailsPanel.innerHTML += "</ul>"
polyline.setMap(map);
map.fitBounds(bounds);
endLocation.marker = createMarker(endLocation.latlng,"end",endLocation.address,"red");
// == create the initial sidebar ==
makeSidebar();
}
else alert(status);
}
var icons = new Array();
icons["red"] = new google.maps.MarkerImage("mapIcons/marker_red.png",
// This marker is 20 pixels wide by 34 pixels tall.
new google.maps.Size(20, 34),
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is at 9,34.
new google.maps.Point(9, 34));
function getMarkerImage(iconColor) {
if ((typeof(iconColor)=="undefined") || (iconColor==null)) {
iconColor = "red";
}
if (!icons[iconColor]) {
icons[iconColor] = new google.maps.MarkerImage("mapIcons/marker_"+ iconColor +".png",
// This marker is 20 pixels wide by 34 pixels tall.
new google.maps.Size(20, 34),
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is at 6,20.
new google.maps.Point(9, 34));
}
return icons[iconColor];
}
// Marker sizes are expressed as a Size of X,Y
// where the origin of the image (0,0) is located
// in the top left of the image.
// Origins, anchor positions and coordinates of the marker
// increase in the X direction to the right and in
// the Y direction down.
var iconImage = new google.maps.MarkerImage('mapIcons/marker_red.png',
// This marker is 20 pixels wide by 34 pixels tall.
new google.maps.Size(20, 34),
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is at 9,34.
new google.maps.Point(9, 34));
var iconShadow = new google.maps.MarkerImage('http://www.google.com/mapfiles/shadow50.png',
// The shadow image is larger in the horizontal dimension
// while the position and offset are the same as for the main image.
new google.maps.Size(37, 34),
new google.maps.Point(0,0),
new google.maps.Point(9, 34));
// Shapes define the clickable region of the icon.
// The type defines an HTML <area> element 'poly' which
// traces out a polygon as a series of X,Y points. The final
// coordinate closes the poly by connecting to the first
// coordinate.
var iconShape = {
coord: [9,0,6,1,4,2,2,4,0,8,0,12,1,14,2,16,5,19,7,23,8,26,9,30,9,34,11,34,11,30,12,26,13,24,14,21,16,18,18,16,20,12,20,8,18,4,16,2,15,1,13,0],
type: 'poly'
};
var infowindow = new google.maps.InfoWindow(
{
size: new google.maps.Size(150,50)
});
function createMarker(latlng, label, html, color) {
// alert("createMarker("+latlng+","+label+","+html+","+color+")");
if(label=='start')
{
icon= 'https://www.orderingsystemonline.com/staging/assets/restaurant-pin.png';
}
if(label=='end')
{
icon= 'https://www.orderingsystemonline.com/staging/assets/home-pin.png';
}
if(label=='waypoint')
{
icon= 'https://www.orderingsystemonline.com/staging/assets/delivery-pin.png';
}
var contentString = '<b>'+label+'</b><br>'+html;
var marker = new google.maps.Marker({
position: latlng,
draggable: true,
map: map,
shadow: iconShadow,
icon: icon,
shape: iconShape,
title: label,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
marker.myname = label;
gmarkers.push(marker);
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map,marker);
});
google.maps.event.addListener(marker, 'dragend', function() {
// alert("drag ended! start:"+startLocation.marker.getPosition()+" end:"+endLocation.marker.getPosition());
var request = {
origin: startLocation.marker.getPosition(),
destination: endLocation.marker.getPosition(),
travelMode: google.maps.DirectionsTravelMode.WALKING
};
startLocation.marker.setMap(null);
endLocation.marker.setMap(null);
gmarkers = [];
polyline.setMap(null);
polyline = new google.maps.Polyline({
path: [],
strokeColor: '#FF0000',
strokeWeight: 3
});
directionsService.route(request, RenderCustomDirections);
});
return marker;
}
</script>
</HTML>