@@ -27,16 +27,16 @@ discard block |
||
| 27 | 27 | // Set GPS postion to the selected route |
| 28 | 28 | // Set right member_id corresponding to the API key |
| 29 | 29 | $params = TrackSetParams::fromArray(array( |
| 30 | - 'format' => Format::SERIALIZED, |
|
| 31 | - 'route_id' => $routeId, |
|
| 32 | - 'member_id' => 1, |
|
| 33 | - 'course' => 1, |
|
| 34 | - 'speed' => 120, |
|
| 35 | - 'lat' => 41.8927521, |
|
| 36 | - 'lng' => -109.0803888, |
|
| 37 | - 'device_type' => 'android_phone', |
|
| 38 | - 'device_guid' => 'qweqweqwe', |
|
| 39 | - 'device_timestamp' => date('Y-m-d H:i:s', strtotime('-2 day')) |
|
| 30 | + 'format' => Format::SERIALIZED, |
|
| 31 | + 'route_id' => $routeId, |
|
| 32 | + 'member_id' => 1, |
|
| 33 | + 'course' => 1, |
|
| 34 | + 'speed' => 120, |
|
| 35 | + 'lat' => 41.8927521, |
|
| 36 | + 'lng' => -109.0803888, |
|
| 37 | + 'device_type' => 'android_phone', |
|
| 38 | + 'device_guid' => 'qweqweqwe', |
|
| 39 | + 'device_timestamp' => date('Y-m-d H:i:s', strtotime('-2 day')) |
|
| 40 | 40 | )); |
| 41 | 41 | |
| 42 | 42 | $status = Track::set($params); |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | $endDate = time() + 1 * 24 * 3600; |
| 51 | 51 | |
| 52 | 52 | $params = array( |
| 53 | - 'route_id' => $routeId, |
|
| 54 | - 'format' => Format::JSON, |
|
| 55 | - 'time_period' => 'custom', |
|
| 56 | - 'start_date' => $startDate, |
|
| 57 | - 'end_date' => $endDate |
|
| 53 | + 'route_id' => $routeId, |
|
| 54 | + 'format' => Format::JSON, |
|
| 55 | + 'time_period' => 'custom', |
|
| 56 | + 'start_date' => $startDate, |
|
| 57 | + 'end_date' => $endDate |
|
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | 60 | $result = $route->GetTrackingHistoryFromTimeRange($params); |
| 61 | 61 | |
| 62 | 62 | foreach ($result as $key => $value) |
| 63 | 63 | { |
| 64 | - if (is_array($value)) { |
|
| 65 | - Route4Me::simplePrint($value); |
|
| 66 | - } else { |
|
| 67 | - echo "$key => $value <br>"; |
|
| 68 | - } |
|
| 64 | + if (is_array($value)) { |
|
| 65 | + Route4Me::simplePrint($value); |
|
| 66 | + } else { |
|
| 67 | + echo "$key => $value <br>"; |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -29,10 +29,10 @@ |
||
| 29 | 29 | |
| 30 | 30 | // Remove 2 random orders |
| 31 | 31 | $orderParameters = Order::fromArray(array( |
| 32 | - 'order_ids' => array( |
|
| 33 | - 0 => $randomOrderID1, |
|
| 34 | - 1 => $randomOrderID2, |
|
| 35 | - ) |
|
| 32 | + 'order_ids' => array( |
|
| 33 | + 0 => $randomOrderID1, |
|
| 34 | + 1 => $randomOrderID2, |
|
| 35 | + ) |
|
| 36 | 36 | )); |
| 37 | 37 | |
| 38 | 38 | $response = $order->removeOrder($orderParameters); |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | // Add an address note |
| 30 | 30 | $noteParameters = array( |
| 31 | - "route_id" => $route_id, |
|
| 32 | - "address_id" => $route_destination_id, |
|
| 33 | - "dev_lat" => 33.132675170898, |
|
| 34 | - "dev_lng" => -83.244743347168, |
|
| 35 | - "device_type" => "web", |
|
| 36 | - "strUpdateType" => "dropoff", |
|
| 37 | - "strNoteContents" => "Test ".time() |
|
| 31 | + "route_id" => $route_id, |
|
| 32 | + "address_id" => $route_destination_id, |
|
| 33 | + "dev_lat" => 33.132675170898, |
|
| 34 | + "dev_lng" => -83.244743347168, |
|
| 35 | + "device_type" => "web", |
|
| 36 | + "strUpdateType" => "dropoff", |
|
| 37 | + "strNoteContents" => "Test ".time() |
|
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | $address = new Address(); |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | // Get address notes |
| 47 | 47 | $noteParameters = array( |
| 48 | - "route_id" => $route_id, |
|
| 49 | - "route_destination_id" => $route_destination_id |
|
| 48 | + "route_id" => $route_id, |
|
| 49 | + "route_destination_id" => $route_destination_id |
|
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | 52 | $address = new Address(); |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | echo "Destination note count --> ".$notes['destination_note_count']."<br>"; |
| 57 | 57 | |
| 58 | 58 | foreach ($notes['notes'] as $note) { |
| 59 | - echo "========== Notes ==================<br>"; |
|
| 60 | - echo "note_id --> ".$note['note_id']."<br>"; |
|
| 61 | - $content = isset($note['contents']) ? $note['contents'] : ""; |
|
| 62 | - if (strlen($content)>0) { |
|
| 63 | - echo "contents --> $content"."<br>"; |
|
| 64 | - } |
|
| 59 | + echo "========== Notes ==================<br>"; |
|
| 60 | + echo "note_id --> ".$note['note_id']."<br>"; |
|
| 61 | + $content = isset($note['contents']) ? $note['contents'] : ""; |
|
| 62 | + if (strlen($content)>0) { |
|
| 63 | + echo "contents --> $content"."<br>"; |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 12 | 12 | |
| 13 | 13 | $geocodingParameters = array( |
| 14 | - 'format' => 'xml', |
|
| 15 | - 'addresses' => '42.35863,-71.05670' |
|
| 14 | + 'format' => 'xml', |
|
| 15 | + 'addresses' => '42.35863,-71.05670' |
|
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | 18 | $fGeoCoding = new Geocoding(); |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | $fgResult = $fGeoCoding->reverseGeocoding($geocodingParameters); |
| 21 | 21 | |
| 22 | 22 | if ($geocodingParameters['format']=='json') { |
| 23 | - foreach ($fgResult as $dest) { |
|
| 24 | - Route4Me::simplePrint($dest); |
|
| 25 | - echo "<br>"; |
|
| 26 | - } |
|
| 23 | + foreach ($fgResult as $dest) { |
|
| 24 | + Route4Me::simplePrint($dest); |
|
| 25 | + echo "<br>"; |
|
| 26 | + } |
|
| 27 | 27 | } else { |
| 28 | - foreach ($fgResult['destination'] as $dest) { |
|
| 29 | - Route4Me::simplePrint($dest); |
|
| 30 | - echo "<br>"; |
|
| 31 | - } |
|
| 28 | + foreach ($fgResult['destination'] as $dest) { |
|
| 29 | + Route4Me::simplePrint($dest); |
|
| 30 | + echo "<br>"; |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $route = new Route(); |
| 17 | 17 | |
| 18 | 18 | $grParams = array( |
| 19 | - 'offset' => 0, |
|
| 20 | - 'limit' => 10 |
|
| 19 | + 'offset' => 0, |
|
| 20 | + 'limit' => 10 |
|
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | 23 | $routes = $route->getRoutes($grParams); |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | echo "<br> From the route -> ".$route_id0."<br>"; |
| 33 | 33 | |
| 34 | 34 | if (is_null($route_id0)) { |
| 35 | - echo "Can't retrieve random route_id!.. Try again."; |
|
| 36 | - return; |
|
| 35 | + echo "Can't retrieve random route_id!.. Try again."; |
|
| 36 | + return; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Get random source destination from selected source route above |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | $to_route_id = $route_id0; |
| 49 | 49 | |
| 50 | 50 | while ($to_route_id==$route_id0) { |
| 51 | - $to_route_id = $routes[rand(0, sizeof($routes) - 1)]->route_id; |
|
| 51 | + $to_route_id = $routes[rand(0, sizeof($routes) - 1)]->route_id; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | echo "<br> to the route -> ".$to_route_id."<br>"; |
| 55 | 55 | |
| 56 | 56 | if (is_null($to_route_id)) { |
| 57 | - echo "Can't retrieve random route_id!.. Try again."; |
|
| 58 | - return; |
|
| 57 | + echo "Can't retrieve random route_id!.. Try again."; |
|
| 58 | + return; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Get random destination destination from selected source route above |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | $after_destination_id = $addressRand2['route_destination_id']; |
| 65 | 65 | |
| 66 | 66 | if (is_null($after_destination_id)) { |
| 67 | - echo "can't retrieve random address!.. Try again."; |
|
| 68 | - return; |
|
| 67 | + echo "can't retrieve random address!.. Try again."; |
|
| 68 | + return; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | echo "after_destination_id = $after_destination_id <br>"; |
| 72 | 72 | |
| 73 | 73 | // Move the destination to the route |
| 74 | 74 | $routeparams = array( |
| 75 | - 'to_route_id' => $to_route_id, |
|
| 76 | - 'route_destination_id' => strval($route_destination_id), |
|
| 77 | - 'after_destination_id' => strval($after_destination_id) |
|
| 75 | + 'to_route_id' => $to_route_id, |
|
| 76 | + 'route_destination_id' => strval($route_destination_id), |
|
| 77 | + 'after_destination_id' => strval($after_destination_id) |
|
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | 80 | $address = new Address(); |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | assert(!is_null($addressRand), "Can't retrieve random address"); |
| 28 | 28 | |
| 29 | 29 | if (isset($addressRand['is_depot'])) { |
| 30 | - if ($addressRand['is_depot']) { |
|
| 31 | - echo "This address is depot!.. Try again."; |
|
| 32 | - return; |
|
| 33 | - } |
|
| 30 | + if ($addressRand['is_depot']) { |
|
| 31 | + echo "This address is depot!.. Try again."; |
|
| 32 | + return; |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $route_destination_id = $addressRand['route_destination_id']; |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Remove the destination from the optimization |
| 41 | 41 | $params = array( |
| 42 | - "optimization_problem_id" => $optimization_problem_id, |
|
| 43 | - "route_destination_id" => $route_destination_id |
|
| 42 | + "optimization_problem_id" => $optimization_problem_id, |
|
| 43 | + "route_destination_id" => $route_destination_id |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | $result = $optimization->removeAddress($params); |