@@ -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); |
@@ -30,19 +30,19 @@ |
||
30 | 30 | $addresses = array(); |
31 | 31 | |
32 | 32 | $address1 = (array)Address::fromArray(array( |
33 | - 'address' => '717 5th Ave New York, NY 10021', |
|
34 | - 'alias' => 'Giorgio Armani', |
|
35 | - 'lat' => 40.7669692, |
|
36 | - 'lng' => 73.9693864, |
|
37 | - 'time' => 0 |
|
33 | + 'address' => '717 5th Ave New York, NY 10021', |
|
34 | + 'alias' => 'Giorgio Armani', |
|
35 | + 'lat' => 40.7669692, |
|
36 | + 'lng' => 73.9693864, |
|
37 | + 'time' => 0 |
|
38 | 38 | )); |
39 | 39 | |
40 | 40 | $addresses[0] = $address1; |
41 | 41 | |
42 | 42 | $OptimizationParameters = (array)OptimizationProblem::fromArray(array( |
43 | - "optimization_problem_id" => $optimization_problem_id, |
|
44 | - "addresses" => $addresses, |
|
45 | - "reoptimize" => 1, |
|
43 | + "optimization_problem_id" => $optimization_problem_id, |
|
44 | + "addresses" => $addresses, |
|
45 | + "reoptimize" => 1, |
|
46 | 46 | )); |
47 | 47 | |
48 | 48 | $optimizationproblem = new OptimizationProblem(); |
@@ -25,20 +25,20 @@ |
||
25 | 25 | $addresses = array(); |
26 | 26 | |
27 | 27 | $params = array( |
28 | - "route_id" => $routeId, |
|
29 | - "addresses" => array( |
|
30 | - "0" => array( |
|
31 | - "address" => "Cabo Rojo, Cabo Rojo 00623, Puerto Rico", |
|
32 | - "alias" => "", |
|
33 | - "lat" => 18.086627, |
|
34 | - "lng" => -67.145735, |
|
35 | - "curbside_lat" => 18.086627, |
|
36 | - "curbside_lng" => -67.145735, |
|
37 | - "is_departed" => false, |
|
38 | - "is_visited" => false |
|
39 | - ) |
|
40 | - ), |
|
41 | - "optimal_position" => true |
|
28 | + "route_id" => $routeId, |
|
29 | + "addresses" => array( |
|
30 | + "0" => array( |
|
31 | + "address" => "Cabo Rojo, Cabo Rojo 00623, Puerto Rico", |
|
32 | + "alias" => "", |
|
33 | + "lat" => 18.086627, |
|
34 | + "lng" => -67.145735, |
|
35 | + "curbside_lat" => 18.086627, |
|
36 | + "curbside_lng" => -67.145735, |
|
37 | + "is_departed" => false, |
|
38 | + "is_visited" => false |
|
39 | + ) |
|
40 | + ), |
|
41 | + "optimal_position" => true |
|
42 | 42 | ); |
43 | 43 | |
44 | 44 | $route1 = new Route(); |
@@ -29,10 +29,10 @@ |
||
29 | 29 | $address=new Address(); |
30 | 30 | |
31 | 31 | $params = array( |
32 | - "route_id" => $routeId, |
|
33 | - "address_id" => $route_destination_id, |
|
34 | - "is_departed" => 1, |
|
35 | - "member_id" => 1 |
|
32 | + "route_id" => $routeId, |
|
33 | + "address_id" => $route_destination_id, |
|
34 | + "is_departed" => 1, |
|
35 | + "member_id" => 1 |
|
36 | 36 | ); |
37 | 37 | |
38 | 38 | $result = $address->markAsDeparted($params); |
@@ -23,25 +23,25 @@ |
||
23 | 23 | $addresses = array(); |
24 | 24 | |
25 | 25 | $address1 = (array)Address::fromArray(array( |
26 | - 'address' => '146 Bill Johnson Rd NE Milledgeville GA 31061', |
|
27 | - 'lat' => 33.143526, |
|
28 | - 'lng' => -83.240354, |
|
29 | - 'time' => 0 |
|
26 | + 'address' => '146 Bill Johnson Rd NE Milledgeville GA 31061', |
|
27 | + 'lat' => 33.143526, |
|
28 | + 'lng' => -83.240354, |
|
29 | + 'time' => 0 |
|
30 | 30 | )); |
31 | 31 | |
32 | 32 | $address2 = (array)Address::fromArray(array( |
33 | - 'address' => '222 Blake Cir Milledgeville GA 31061', |
|
34 | - 'lat' => 33.177852, |
|
35 | - 'lng' => -83.263535, |
|
36 | - 'time' => 0 |
|
33 | + 'address' => '222 Blake Cir Milledgeville GA 31061', |
|
34 | + 'lat' => 33.177852, |
|
35 | + 'lng' => -83.263535, |
|
36 | + 'time' => 0 |
|
37 | 37 | )); |
38 | 38 | |
39 | 39 | $addresses[] = $address1; |
40 | 40 | $addresses[] = $address2; |
41 | 41 | |
42 | 42 | $routeParameters = array( |
43 | - "route_id" => $routeId, |
|
44 | - "addresses" => array($address1, $address2) |
|
43 | + "route_id" => $routeId, |
|
44 | + "addresses" => array($address1, $address2) |
|
45 | 45 | ); |
46 | 46 | |
47 | 47 | $route1 = new Route(); |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | $addressRand=(array)$route->GetRandomAddressFromRoute($routeId); |
24 | 24 | |
25 | 25 | if (isset($addressRand['is_depot'])) { |
26 | - if ($addressRand['is_depot']) { |
|
27 | - echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
28 | - return; |
|
29 | - } |
|
26 | + if ($addressRand['is_depot']) { |
|
27 | + echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
28 | + return; |
|
29 | + } |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | // Get random address's id from selected route above |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | $address = new Address(); |
40 | 40 | |
41 | 41 | $params = array( |
42 | - "route_id" => $routeId, |
|
43 | - "address_id" => $route_destination_id, |
|
44 | - "is_visited" => 1, |
|
45 | - "member_id" => 1 |
|
42 | + "route_id" => $routeId, |
|
43 | + "address_id" => $route_destination_id, |
|
44 | + "is_visited" => 1, |
|
45 | + "member_id" => 1 |
|
46 | 46 | ); |
47 | 47 | |
48 | 48 | $result = $address->markAsVisited($params); |
@@ -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 | } |
@@ -26,16 +26,16 @@ |
||
26 | 26 | // Set GPS postion to the selected route |
27 | 27 | // Set right member_id corresponding to the API key |
28 | 28 | $params = TrackSetParams::fromArray(array( |
29 | - 'format' => Format::CSV, |
|
30 | - 'route_id' => $routeId, |
|
31 | - 'member_id' => 1, |
|
32 | - 'course' => 1, |
|
33 | - 'speed' => 120, |
|
34 | - 'lat' => 41.8927521, |
|
35 | - 'lng' => -109.0803888, |
|
36 | - 'device_type' => 'android_phone', |
|
37 | - 'device_guid' => 'qweqweqwe', |
|
38 | - 'device_timestamp' => date('Y-m-d H:i:s', strtotime('-1 day')) |
|
29 | + 'format' => Format::CSV, |
|
30 | + 'route_id' => $routeId, |
|
31 | + 'member_id' => 1, |
|
32 | + 'course' => 1, |
|
33 | + 'speed' => 120, |
|
34 | + 'lat' => 41.8927521, |
|
35 | + 'lng' => -109.0803888, |
|
36 | + 'device_type' => 'android_phone', |
|
37 | + 'device_guid' => 'qweqweqwe', |
|
38 | + 'device_timestamp' => date('Y-m-d H:i:s', strtotime('-1 day')) |
|
39 | 39 | )); |
40 | 40 | |
41 | 41 | $status = Track::set($params); |
@@ -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' => 105323, |
|
33 | - 'course' => 3, |
|
34 | - 'speed' => 100, |
|
35 | - 'lat' => 41.8927521, |
|
36 | - 'lng' => -109.0803888, |
|
37 | - 'device_type' => DeviceType::IPHONE, |
|
38 | - 'device_guid' => 'qweqweqwe', |
|
39 | - 'device_timestamp' => date('Y-m-d H:i:s') |
|
30 | + 'format' => Format::SERIALIZED, |
|
31 | + 'route_id' => $routeId, |
|
32 | + 'member_id' => 105323, |
|
33 | + 'course' => 3, |
|
34 | + 'speed' => 100, |
|
35 | + 'lat' => 41.8927521, |
|
36 | + 'lng' => -109.0803888, |
|
37 | + 'device_type' => DeviceType::IPHONE, |
|
38 | + 'device_guid' => 'qweqweqwe', |
|
39 | + 'device_timestamp' => date('Y-m-d H:i:s') |
|
40 | 40 | )); |
41 | 41 | |
42 | 42 | $status = Track::set($params); |
@@ -46,23 +46,23 @@ discard block |
||
46 | 46 | assert($status['status'], "Can't send GPS position to the selected route"); |
47 | 47 | |
48 | 48 | if (!$status) { |
49 | - echo "Setting of GPS position failed"; |
|
50 | - return; |
|
49 | + echo "Setting of GPS position failed"; |
|
50 | + return; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $params = array( |
54 | - 'route_id' => $routeId, |
|
55 | - 'device_tracking_history' => '1' |
|
54 | + 'route_id' => $routeId, |
|
55 | + 'device_tracking_history' => '1' |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | $result = $route->GetLastLocation($params); |
59 | 59 | |
60 | 60 | if (isset($result->tracking_history)) |
61 | 61 | foreach ($result->tracking_history as $history) { |
62 | - echo "Speed --> ".$history['s']."<br>"; |
|
63 | - echo "course --> ".$history['d']."<br>"; |
|
64 | - echo "Timestamp --> ".$history['ts_friendly']."<br>"; |
|
65 | - echo "Latitude --> ".$history['lt']."<br>"; |
|
66 | - echo "Longitude --> ".$history['lg']."<br>"; |
|
67 | - echo "========================================<br><br>"; |
|
62 | + echo "Speed --> ".$history['s']."<br>"; |
|
63 | + echo "course --> ".$history['d']."<br>"; |
|
64 | + echo "Timestamp --> ".$history['ts_friendly']."<br>"; |
|
65 | + echo "Latitude --> ".$history['lt']."<br>"; |
|
66 | + echo "Longitude --> ".$history['lg']."<br>"; |
|
67 | + echo "========================================<br><br>"; |
|
68 | 68 | } |