@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
4 | + $vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | 5 | |
6 | 6 | require $vdir.'/../vendor/autoload.php'; |
7 | 7 | |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | // Set the api key in the Route4Me class |
12 | 12 | Route4Me::setApiKey('11111111111111111111111111111111'); |
13 | 13 | |
14 | - $route=new Route(); |
|
14 | + $route = new Route(); |
|
15 | 15 | |
16 | - $route_id=$route->getRandomRouteId(0, 10); |
|
16 | + $route_id = $route->getRandomRouteId(0, 10); |
|
17 | 17 | |
18 | 18 | //$route_id='5D88D72CE6B1D794DDD677AE48A05BA7'; |
19 | - $routeDuplicate=$route->duplicateRoute($route_id); |
|
19 | + $routeDuplicate = $route->duplicateRoute($route_id); |
|
20 | 20 | |
21 | 21 | Route4Me::simplePrint($routeDuplicate); |
22 | 22 | ?> |
23 | 23 | \ No newline at end of file |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
5 | 5 | |
6 | - require $vdir.'/../vendor/autoload.php'; |
|
6 | + require $vdir.'/../vendor/autoload.php'; |
|
7 | 7 | |
8 | 8 | use Route4Me\Route4Me; |
9 | 9 | use Route4Me\Route; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | $routeId = 'AC16E7D338B551013FF34266FE81A5EE'; |
10 | 10 | $route = Route::getRoutes($routeId, array( |
11 | - 'device_tracking_history' => true |
|
11 | + 'device_tracking_history' => true |
|
12 | 12 | )); |
13 | 13 | |
14 | 14 | var_dump($route->tracking_history); |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -require __DIR__.'/../vendor/autoload.php';; |
|
2 | +require __DIR__.'/../vendor/autoload.php'; ; |
|
3 | 3 | |
4 | 4 | use Route4Me\Route4Me; |
5 | 5 | use Route4Me\Route; |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
5 | 5 | |
6 | - require $vdir.'/../vendor/autoload.php'; |
|
6 | + require $vdir.'/../vendor/autoload.php'; |
|
7 | 7 | |
8 | 8 | use Route4Me\Route4Me; |
9 | 9 | use Route4Me\Vehicle; |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
4 | + $vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | 5 | |
6 | 6 | require $vdir.'/../vendor/autoload.php'; |
7 | 7 |
@@ -17,8 +17,8 @@ |
||
17 | 17 | ); |
18 | 18 | |
19 | 19 | $url = $url . '?' . http_build_query(array_merge( |
20 | - array( 'api_key' => '11111111111111111111111111111111'), $query |
|
21 | - )); |
|
20 | + array( 'api_key' => '11111111111111111111111111111111'), $query |
|
21 | + )); |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <form action="<?php echo $url ?>" method="post" encript="text/csv"> |
@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | <html> |
3 | 3 | <body> |
4 | 4 | <?php |
5 | -$url="https://www.route4me.com/actions/addRouteNotes.php"; |
|
5 | +$url = "https://www.route4me.com/actions/addRouteNotes.php"; |
|
6 | 6 | |
7 | -$route_id="5C15E83A4BE005BCD1537955D28D51D7"; |
|
8 | -$address_id=162916895; |
|
7 | +$route_id = "5C15E83A4BE005BCD1537955D28D51D7"; |
|
8 | +$address_id = 162916895; |
|
9 | 9 | |
10 | -$query=array( |
|
10 | +$query = array( |
|
11 | 11 | "route_id" => $route_id, |
12 | 12 | "address_id" => $address_id, |
13 | 13 | "dev_lat" => 33.132675170898, |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | "strUpdateType" => "ANY_FILE" |
17 | 17 | ); |
18 | 18 | |
19 | -$url = $url . '?' . http_build_query(array_merge( |
|
20 | - array( 'api_key' => '11111111111111111111111111111111'), $query |
|
19 | +$url = $url.'?'.http_build_query(array_merge( |
|
20 | + array('api_key' => '11111111111111111111111111111111'), $query |
|
21 | 21 | )); |
22 | 22 | ?> |
23 | 23 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
4 | + $vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | 5 | |
6 | 6 | require $vdir.'/../vendor/autoload.php'; |
7 | 7 | |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | } |
35 | 35 | //-------------------------------------------------------- |
36 | 36 | */ |
37 | - $route_id="6EC2759FD551516356AB2C9B335CAC16"; |
|
38 | - $route_destination_id="152555738"; |
|
37 | + $route_id = "6EC2759FD551516356AB2C9B335CAC16"; |
|
38 | + $route_destination_id = "152555738"; |
|
39 | 39 | |
40 | - $noteParameters=array( |
|
40 | + $noteParameters = array( |
|
41 | 41 | "route_id" => $route_id, |
42 | 42 | "address_id" => $route_destination_id, |
43 | 43 | "dev_lat" => 33.132675170898, |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
5 | 5 | |
6 | - require $vdir.'/../vendor/autoload.php'; |
|
6 | + require $vdir.'/../vendor/autoload.php'; |
|
7 | 7 | |
8 | 8 | use Route4Me\Route4Me; |
9 | 9 | use Route4Me\Route; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
4 | + $vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | 5 | |
6 | 6 | require $vdir.'/../vendor/autoload.php'; |
7 | 7 | |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | |
14 | 14 | // Get random route from test routes |
15 | 15 | //-------------------------------------------------------- |
16 | - $route=new Route(); |
|
16 | + $route = new Route(); |
|
17 | 17 | |
18 | - $route_id=$route->getRandomRouteId(0, 10); |
|
18 | + $route_id = $route->getRandomRouteId(0, 10); |
|
19 | 19 | |
20 | 20 | if (is_null($route_id)) { |
21 | 21 | echo "can't retrieve random route_id!.. Try again."; |
@@ -25,24 +25,24 @@ discard block |
||
25 | 25 | |
26 | 26 | // Get random address's id from selected route above |
27 | 27 | //-------------------------------------------------------- |
28 | - $addressRand=(array)$route->GetRandomAddressFromRoute($route_id); |
|
29 | - $route_destination_id=$addressRand['route_destination_id']; |
|
28 | + $addressRand = (array)$route->GetRandomAddressFromRoute($route_id); |
|
29 | + $route_destination_id = $addressRand['route_destination_id']; |
|
30 | 30 | |
31 | 31 | if (is_null($route_destination_id)) { |
32 | 32 | echo "can't retrieve random address!.. Try again."; |
33 | 33 | return; |
34 | 34 | } |
35 | 35 | //-------------------------------------------------------- |
36 | - $route_id='6EC2759FD551516356AB2C9B335CAC16'; |
|
37 | - $route_destination_id='152555738'; |
|
38 | - $noteParameters=array( |
|
36 | + $route_id = '6EC2759FD551516356AB2C9B335CAC16'; |
|
37 | + $route_destination_id = '152555738'; |
|
38 | + $noteParameters = array( |
|
39 | 39 | "route_id" => $route_id, |
40 | 40 | "route_destination_id" => $route_destination_id |
41 | 41 | ); |
42 | 42 | |
43 | - $address=new Address(); |
|
43 | + $address = new Address(); |
|
44 | 44 | |
45 | - $notes=$address->GetAddressesNotes($noteParameters); |
|
45 | + $notes = $address->GetAddressesNotes($noteParameters); |
|
46 | 46 | |
47 | 47 | echo "destination_note_count --> ".$notes['destination_note_count']."<br>"; |
48 | 48 | foreach ($notes['notes'] as $note) { |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
5 | 5 | |
6 | - require $vdir.'/../vendor/autoload.php'; |
|
6 | + require $vdir.'/../vendor/autoload.php'; |
|
7 | 7 | |
8 | 8 | use Route4Me\Route4Me; |
9 | 9 | use Route4Me\Route; |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | foreach ($notes['notes'] as $note) { |
49 | 49 | echo "========== Notes ==================<br>"; |
50 | 50 | echo "note_id --> ".$note['note_id']."<br>"; |
51 | - $content = isset($note['contents']) ? $note['contents'] : ""; |
|
52 | - if (strlen($content)>0) echo "contents --> $content"."<br>"; |
|
51 | + $content = isset($note['contents']) ? $note['contents'] : ""; |
|
52 | + if (strlen($content)>0) echo "contents --> $content"."<br>"; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | //var_dump($notes); |
@@ -49,7 +49,9 @@ |
||
49 | 49 | echo "========== Notes ==================<br>"; |
50 | 50 | echo "note_id --> ".$note['note_id']."<br>"; |
51 | 51 | $content = isset($note['contents']) ? $note['contents'] : ""; |
52 | - if (strlen($content)>0) echo "contents --> $content"."<br>"; |
|
52 | + if (strlen($content)>0) { |
|
53 | + echo "contents --> $content"."<br>"; |
|
54 | + } |
|
53 | 55 | } |
54 | 56 | |
55 | 57 | //var_dump($notes); |
@@ -23,22 +23,22 @@ |
||
23 | 23 | |
24 | 24 | $addresses = array(); |
25 | 25 | foreach($json as $address) { |
26 | - $addresses[] = Address::fromArray($address); |
|
26 | + $addresses[] = Address::fromArray($address); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $parameters = RouteParameters::fromArray(array( |
30 | - "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
31 | - "route_name" => "Multiple Depot, Multiple Driver with 24 Stops, Time Window", |
|
32 | - "route_date" => time() + 24*60*60, |
|
33 | - "route_time" => 60 * 60 * 7, |
|
34 | - "distance_unit" => DistanceUnit::MILES, |
|
35 | - "device_type" => DeviceType::WEB, |
|
36 | - "optimize" => OptimizationType::DISTANCE, |
|
37 | - "metric" => Metric::GEODESIC, |
|
38 | - "route_max_duration" => 86400, |
|
39 | - "travel_mode" => TravelMode::DRIVING, |
|
40 | - "vehicle_capacity" => 1, |
|
41 | - "vehicle_max_distance_mi" => 10000 |
|
30 | + "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
31 | + "route_name" => "Multiple Depot, Multiple Driver with 24 Stops, Time Window", |
|
32 | + "route_date" => time() + 24*60*60, |
|
33 | + "route_time" => 60 * 60 * 7, |
|
34 | + "distance_unit" => DistanceUnit::MILES, |
|
35 | + "device_type" => DeviceType::WEB, |
|
36 | + "optimize" => OptimizationType::DISTANCE, |
|
37 | + "metric" => Metric::GEODESIC, |
|
38 | + "route_max_duration" => 86400, |
|
39 | + "travel_mode" => TravelMode::DRIVING, |
|
40 | + "vehicle_capacity" => 1, |
|
41 | + "vehicle_max_distance_mi" => 10000 |
|
42 | 42 | )); |
43 | 43 | |
44 | 44 | $optimizationParams = new OptimizationProblemParams; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | -require __DIR__.'/../vendor/autoload.php';; |
|
3 | +require __DIR__.'/../vendor/autoload.php'; ; |
|
4 | 4 | //See video tutorial here: http://support.route4me.com/route-planning-help.php?id=manual0:tutorial2:chapter2:subchapter2 |
5 | 5 | |
6 | 6 | use Route4Me\Route4Me; |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | $json = json_decode(file_get_contents('./addresses.json'), true); |
23 | 23 | |
24 | 24 | $addresses = array(); |
25 | -foreach($json as $address) { |
|
25 | +foreach ($json as $address) { |
|
26 | 26 | $addresses[] = Address::fromArray($address); |
27 | 27 | } |
28 | 28 | |
29 | 29 | $parameters = RouteParameters::fromArray(array( |
30 | 30 | "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
31 | 31 | "route_name" => "Multiple Depot, Multiple Driver with 24 Stops, Time Window", |
32 | - "route_date" => time() + 24*60*60, |
|
32 | + "route_date" => time() + 24 * 60 * 60, |
|
33 | 33 | "route_time" => 60 * 60 * 7, |
34 | 34 | "distance_unit" => DistanceUnit::MILES, |
35 | 35 | "device_type" => DeviceType::WEB, |
@@ -6,14 +6,12 @@ |
||
6 | 6 | use Route4Me\Enum\OptimizationType; |
7 | 7 | use Route4Me\OptimizationProblem; |
8 | 8 | use Route4Me\OptimizationProblemParams; |
9 | -use Route4Me\Enum\AlgorithmType; |
|
10 | 9 | use Route4Me\Enum\DistanceUnit; |
11 | 10 | use Route4Me\Enum\DeviceType; |
12 | 11 | use Route4Me\Enum\TravelMode; |
13 | 12 | use Route4Me\Enum\Metric; |
14 | 13 | use Route4Me\RouteParameters; |
15 | 14 | use Route4Me\Address; |
16 | -use Route4Me\Route; |
|
17 | 15 | |
18 | 16 | Route4Me::setApiKey('11111111111111111111111111111111'); |
19 | 17 |
@@ -51,8 +51,7 @@ |
||
51 | 51 | if (is_string($value)) |
52 | 52 | { |
53 | 53 | echo $key." --> ".$value."<br>"; |
54 | - } |
|
55 | - else |
|
54 | + } else |
|
56 | 55 | { |
57 | 56 | echo "************ $key ************* <br>"; |
58 | 57 | Route4Me::simplePrint((array)$value); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
4 | + $vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | 5 | |
6 | 6 | require $vdir.'/../vendor/autoload.php'; |
7 | 7 | |
@@ -14,23 +14,23 @@ discard block |
||
14 | 14 | // Territory and get territory_id |
15 | 15 | //--------------------------------------------------------- |
16 | 16 | $territory = new Territory(); |
17 | - $territory->type = TerritoryTypes::CIRCLE; |
|
18 | - $territory->data = array ( |
|
17 | + $territory->type = TerritoryTypes::CIRCLE; |
|
18 | + $territory->data = array( |
|
19 | 19 | "37.569752822786455,-77.47833251953125", |
20 | 20 | "5000" |
21 | 21 | ); |
22 | 22 | |
23 | - $TerritoryParameters=Territory::fromArray(array( |
|
24 | - "territory_name" => "Test Territory ".strval(rand(10000,99999)), |
|
23 | + $TerritoryParameters = Territory::fromArray(array( |
|
24 | + "territory_name" => "Test Territory ".strval(rand(10000, 99999)), |
|
25 | 25 | "territory_color" => "ff7700", |
26 | 26 | "territory" => $territory |
27 | 27 | )); |
28 | 28 | |
29 | - $territory=new Territory(); |
|
29 | + $territory = new Territory(); |
|
30 | 30 | |
31 | 31 | $result = (array)$territory->addTerritory($TerritoryParameters); |
32 | 32 | |
33 | - $territory_id=""; |
|
33 | + $territory_id = ""; |
|
34 | 34 | if (isset($result)) { |
35 | 35 | $territory_id = $result["territory_id"]; |
36 | 36 | } else { |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
5 | 5 | |
6 | - require $vdir.'/../vendor/autoload.php'; |
|
6 | + require $vdir.'/../vendor/autoload.php'; |
|
7 | 7 | |
8 | 8 | use Route4Me\Route4Me; |
9 | 9 | use Route4Me\Enum\TerritoryTypes; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
4 | + $vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | 5 | |
6 | 6 | require $vdir.'/../vendor/autoload.php'; |
7 | 7 | |
@@ -13,23 +13,23 @@ discard block |
||
13 | 13 | // Add Territory and get territory_id |
14 | 14 | //--------------------------------------------------------- |
15 | 15 | $territory = new Territory(); |
16 | - $territory->type = TerritoryTypes::CIRCLE; |
|
17 | - $territory->data = array ( |
|
16 | + $territory->type = TerritoryTypes::CIRCLE; |
|
17 | + $territory->data = array( |
|
18 | 18 | "37.569752822786455,-77.47833251953125", |
19 | 19 | "5000" |
20 | 20 | ); |
21 | 21 | |
22 | - $TerritoryParameters=Territory::fromArray(array( |
|
23 | - "territory_name" => "Test Territory ".strval(rand(10000,99999)), |
|
22 | + $TerritoryParameters = Territory::fromArray(array( |
|
23 | + "territory_name" => "Test Territory ".strval(rand(10000, 99999)), |
|
24 | 24 | "territory_color" => "ff7700", |
25 | 25 | "territory" => $territory |
26 | 26 | )); |
27 | 27 | |
28 | - $territory=new Territory(); |
|
28 | + $territory = new Territory(); |
|
29 | 29 | |
30 | 30 | $result = (array)$territory->addTerritory($TerritoryParameters); |
31 | 31 | |
32 | - $territory_id=""; |
|
32 | + $territory_id = ""; |
|
33 | 33 | if (isset($result)) { |
34 | 34 | $territory_id = $result["territory_id"]; |
35 | 35 | } else { |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
5 | 5 | |
6 | - require $vdir.'/../vendor/autoload.php'; |
|
6 | + require $vdir.'/../vendor/autoload.php'; |
|
7 | 7 | |
8 | 8 | use Route4Me\Route4Me; |
9 | 9 | use Route4Me\Enum\TerritoryTypes; |