@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | // Get an order |
27 | 27 | $orderParameters = Order::fromArray(array( |
28 | - "order_id" => $orderID |
|
28 | + "order_id" => $orderID |
|
29 | 29 | )); |
30 | 30 | |
31 | 31 | $response = $order->getOrder($orderParameters); |
@@ -14,22 +14,22 @@ |
||
14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
15 | 15 | |
16 | 16 | $orderParameters = Order::fromArray(array( |
17 | - "address_1" => "1358 E Luzerne St, Philadelphia, PA 19124, US", |
|
18 | - "cached_lat" => 48.335991, |
|
19 | - "cached_lng" => 31.18287, |
|
20 | - "address_alias" => "Auto test address", |
|
21 | - "address_city" => "Philadelphia", |
|
22 | - "day_scheduled_for_YYMMDD" => date("Y-m-d"), |
|
23 | - "EXT_FIELD_first_name" => "Igor", |
|
24 | - "EXT_FIELD_last_name" => "Progman", |
|
25 | - "EXT_FIELD_email" => "[email protected]", |
|
26 | - "EXT_FIELD_phone" => "380380380380", |
|
27 | - "EXT_FIELD_custom_data" => array( |
|
28 | - 0 => array( |
|
29 | - 'order_id' => '10', |
|
30 | - 'name' => 'Bill Soul' |
|
31 | - ) |
|
32 | - ) |
|
17 | + "address_1" => "1358 E Luzerne St, Philadelphia, PA 19124, US", |
|
18 | + "cached_lat" => 48.335991, |
|
19 | + "cached_lng" => 31.18287, |
|
20 | + "address_alias" => "Auto test address", |
|
21 | + "address_city" => "Philadelphia", |
|
22 | + "day_scheduled_for_YYMMDD" => date("Y-m-d"), |
|
23 | + "EXT_FIELD_first_name" => "Igor", |
|
24 | + "EXT_FIELD_last_name" => "Progman", |
|
25 | + "EXT_FIELD_email" => "[email protected]", |
|
26 | + "EXT_FIELD_phone" => "380380380380", |
|
27 | + "EXT_FIELD_custom_data" => array( |
|
28 | + 0 => array( |
|
29 | + 'order_id' => '10', |
|
30 | + 'name' => 'Bill Soul' |
|
31 | + ) |
|
32 | + ) |
|
33 | 33 | )); |
34 | 34 | |
35 | 35 | $order = new Order(); |
@@ -31,10 +31,10 @@ |
||
31 | 31 | $body = json_decode($jfile); |
32 | 32 | |
33 | 33 | $orderParameters = array( |
34 | - "optimization_problem_id" => $optimizationProblemId, |
|
35 | - "redirect" => 0, |
|
36 | - "device_type" => "web", |
|
37 | - "addresses" => $body->addresses |
|
34 | + "optimization_problem_id" => $optimizationProblemId, |
|
35 | + "redirect" => 0, |
|
36 | + "device_type" => "web", |
|
37 | + "addresses" => $body->addresses |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | $order = new Order(); |
@@ -20,13 +20,13 @@ |
||
20 | 20 | |
21 | 21 | // Get route manifest |
22 | 22 | $params = array( |
23 | - "directions" => 1, |
|
24 | - "route_id" => $route_id |
|
23 | + "directions" => 1, |
|
24 | + "route_id" => $route_id |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | $route = Route::getRoutes($params); |
28 | 28 | |
29 | 29 | foreach ($route->addresses as $addr1) { |
30 | - Route4Me::simplePrint((array)$addr1, true); |
|
31 | - echo "<br>"; |
|
30 | + Route4Me::simplePrint((array)$addr1, true); |
|
31 | + echo "<br>"; |
|
32 | 32 | } |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | |
26 | 26 | if (isset($addressRand['is_depot'])) |
27 | 27 | { |
28 | - if ($addressRand['is_depot']) { |
|
29 | - echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
30 | - return; |
|
31 | - } |
|
28 | + if ($addressRand['is_depot']) { |
|
29 | + echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
30 | + return; |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $address_id = $addressRand['route_destination_id']; |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | // Mark the address as detected as visited |
39 | 39 | $addressParameters = (array)Address::fromArray(array( |
40 | - "route_id" => $routeId, |
|
41 | - "route_destination_id" => $address_id, |
|
42 | - "is_visited" => TRUE |
|
40 | + "route_id" => $routeId, |
|
41 | + "route_destination_id" => $address_id, |
|
42 | + "is_visited" => TRUE |
|
43 | 43 | )); |
44 | 44 | |
45 | 45 | $address = new Address(); |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | |
26 | 26 | if (isset($addressRand['is_depot'])) |
27 | 27 | { |
28 | - if ($addressRand['is_depot']) { |
|
29 | - echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
30 | - return; |
|
31 | - } |
|
28 | + if ($addressRand['is_depot']) { |
|
29 | + echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
30 | + return; |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | // Get random address's id from selected route above |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | // Mark the address as detected as deoarted |
41 | 41 | $addressParameters = (array)Address::fromArray(array( |
42 | - "route_id" => $routeId, |
|
43 | - "route_destination_id" => $route_destination_id, |
|
44 | - "is_departed" => TRUE |
|
42 | + "route_id" => $routeId, |
|
43 | + "route_destination_id" => $route_destination_id, |
|
44 | + "is_departed" => TRUE |
|
45 | 45 | )); |
46 | 46 | |
47 | 47 | $address = new Address(); |
@@ -19,8 +19,8 @@ |
||
19 | 19 | assert(!is_null($route_id), "Can't retrieve a random route ID"); |
20 | 20 | |
21 | 21 | $params = array( |
22 | - 'device_tracking_history' => true, |
|
23 | - 'route_id' => $route_id |
|
22 | + 'device_tracking_history' => true, |
|
23 | + 'route_id' => $route_id |
|
24 | 24 | ); |
25 | 25 | |
26 | 26 | // Get route tracking |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | |
19 | 19 | // Select a route with more than 4 addresses. |
20 | 20 | $routesParams = array( |
21 | - "offset" => 0, |
|
22 | - "limit" => 20 |
|
21 | + "offset" => 0, |
|
22 | + "limit" => 20 |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | $routes = $route->getRoutes($routesParams); |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | $selectedRoute = null; |
28 | 28 | |
29 | 29 | foreach ($routes as $route1) { |
30 | - if (isset($route1->destination_count)) { |
|
31 | - if ($route1->destination_count>4) { |
|
32 | - $selectedRoute = $route->getRoutes(array('route_id' => $route1->route_id)); |
|
33 | - break; |
|
34 | - } |
|
35 | - } |
|
30 | + if (isset($route1->destination_count)) { |
|
31 | + if ($route1->destination_count>4) { |
|
32 | + $selectedRoute = $route->getRoutes(array('route_id' => $route1->route_id)); |
|
33 | + break; |
|
34 | + } |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | assert(!is_null($selectedRoute), "Can't select a route with more than 4 addresses"); |
@@ -44,19 +44,19 @@ discard block |
||
44 | 44 | echo "Route ID-> $routeID, Route destination ID -> $routeDestinationID <br>"; |
45 | 45 | |
46 | 46 | $params = array( |
47 | - "route_id" => $routeID, |
|
48 | - "route_destination_id" => $routeDestinationID, |
|
49 | - "addresses" => array( |
|
50 | - "0" => array( |
|
51 | - "route_destination_id" => $routeDestinationID, |
|
52 | - "sequence_no" => 3 |
|
53 | - ) |
|
54 | - ) |
|
47 | + "route_id" => $routeID, |
|
48 | + "route_destination_id" => $routeDestinationID, |
|
49 | + "addresses" => array( |
|
50 | + "0" => array( |
|
51 | + "route_destination_id" => $routeDestinationID, |
|
52 | + "sequence_no" => 3 |
|
53 | + ) |
|
54 | + ) |
|
55 | 55 | ); |
56 | 56 | |
57 | 57 | $response = $route->resequenceRoute($params); |
58 | 58 | |
59 | 59 | foreach ($response['addresses'] as $address) { |
60 | - Route4Me::simplePrint($address); |
|
61 | - echo "<br>"; |
|
60 | + Route4Me::simplePrint($address); |
|
61 | + echo "<br>"; |
|
62 | 62 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
5 | 5 | require $root.'/vendor/autoload.php'; |
6 | 6 | |
7 | 7 | use Route4Me\Route4Me; |
@@ -23,26 +23,26 @@ |
||
23 | 23 | |
24 | 24 | // Get a route with the path points |
25 | 25 | $params = array( |
26 | - "route_path_output" => "Points", |
|
27 | - "compress_path_points" => TRUE, |
|
28 | - "route_id" => $route_id |
|
26 | + "route_path_output" => "Points", |
|
27 | + "compress_path_points" => TRUE, |
|
28 | + "route_id" => $route_id |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | $routeResults = (array)$route->getRoutePoints($params); |
32 | 32 | |
33 | 33 | if (isset($routeResults['addresses'])) { |
34 | - foreach ($routeResults['addresses'] as $key => $address) { |
|
35 | - $araddress = (array)$address; |
|
34 | + foreach ($routeResults['addresses'] as $key => $address) { |
|
35 | + $araddress = (array)$address; |
|
36 | 36 | |
37 | - if (isset($araddress['route_destination_id'])) { |
|
38 | - echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
39 | - } |
|
37 | + if (isset($araddress['route_destination_id'])) { |
|
38 | + echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
39 | + } |
|
40 | 40 | |
41 | - if (isset($araddress['path_to_next'])) { |
|
42 | - echo "path_to_next:<br>"; |
|
43 | - Route4Me::simplePrint((array)$araddress['path_to_next']); |
|
44 | - } |
|
41 | + if (isset($araddress['path_to_next'])) { |
|
42 | + echo "path_to_next:<br>"; |
|
43 | + Route4Me::simplePrint((array)$araddress['path_to_next']); |
|
44 | + } |
|
45 | 45 | |
46 | - echo "<br>"; |
|
47 | - } |
|
46 | + echo "<br>"; |
|
47 | + } |
|
48 | 48 | } |