@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | $locationsFieldsMapping['monthly_nth_wwhat'] = 17; |
45 | 45 | |
46 | 46 | if (($handle = fopen("$source_file", "r"))!==FALSE) { |
47 | - $oAbook = new AddressBookLocation(); |
|
47 | + $oAbook = new AddressBookLocation(); |
|
48 | 48 | |
49 | - $results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping); |
|
49 | + $results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping); |
|
50 | 50 | |
51 | - echo "Errors: <br><br>"; |
|
51 | + echo "Errors: <br><br>"; |
|
52 | 52 | |
53 | - foreach ($results['fail'] as $evalue) { |
|
54 | - echo $evalue."<br>"; |
|
55 | - } |
|
53 | + foreach ($results['fail'] as $evalue) { |
|
54 | + echo $evalue."<br>"; |
|
55 | + } |
|
56 | 56 | |
57 | - echo "Successes: <br><br>"; |
|
57 | + echo "Successes: <br><br>"; |
|
58 | 58 | |
59 | - foreach ($results['success'] as $svalue) { |
|
60 | - echo $svalue."<br>"; |
|
61 | - } |
|
59 | + foreach ($results['success'] as $svalue) { |
|
60 | + echo $svalue."<br>"; |
|
61 | + } |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /* Add orders with schedules from a CSV file */ |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | $ordersFieldsMapping['day_scheduled_for_YYMMDD'] = 8; |
79 | 79 | |
80 | 80 | if (($handle = fopen("$orders_file", "r"))!==FALSE) { |
81 | - $order = new Order(); |
|
82 | - $results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping); |
|
81 | + $order = new Order(); |
|
82 | + $results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping); |
|
83 | 83 | |
84 | - echo "Errors: <br><br>"; |
|
84 | + echo "Errors: <br><br>"; |
|
85 | 85 | |
86 | - foreach ($results['fail'] as $evalue) { |
|
87 | - echo $evalue."<br>"; |
|
88 | - } |
|
86 | + foreach ($results['fail'] as $evalue) { |
|
87 | + echo $evalue."<br>"; |
|
88 | + } |
|
89 | 89 | |
90 | - echo "Successes: <br><br>"; |
|
90 | + echo "Successes: <br><br>"; |
|
91 | 91 | |
92 | - foreach ($results['success'] as $svalue) { |
|
93 | - echo $svalue."<br>"; |
|
94 | - } |
|
92 | + foreach ($results['success'] as $svalue) { |
|
93 | + echo $svalue."<br>"; |
|
94 | + } |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /* Get Hybrid Optimization */ |
@@ -100,63 +100,63 @@ discard block |
||
100 | 100 | $sched_date = date("Y-m-d", $ep); |
101 | 101 | |
102 | 102 | $hybridParams = array( |
103 | - "target_date_string" => $sched_date, |
|
104 | - "timezone_offset_minutes" => 480 |
|
103 | + "target_date_string" => $sched_date, |
|
104 | + "timezone_offset_minutes" => 480 |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | $optimization = new OptimizationProblem(); |
108 | 108 | $hybridOptimization = $optimization->getHybridOptimization($hybridParams); |
109 | 109 | |
110 | 110 | if ($hybridOptimization!=null) { |
111 | - if (isset($hybridOptimization['optimization_problem_id'])) { |
|
112 | - $optid = $hybridOptimization['optimization_problem_id']; |
|
111 | + if (isset($hybridOptimization['optimization_problem_id'])) { |
|
112 | + $optid = $hybridOptimization['optimization_problem_id']; |
|
113 | 113 | |
114 | - echo "Hibrid optimization with optimization_problem_id = $optid <br><br>"; |
|
114 | + echo "Hibrid optimization with optimization_problem_id = $optid <br><br>"; |
|
115 | 115 | |
116 | - /* Add depots to the Hybrid Optimization */ |
|
117 | - $depotfile = "depots.csv"; |
|
116 | + /* Add depots to the Hybrid Optimization */ |
|
117 | + $depotfile = "depots.csv"; |
|
118 | 118 | |
119 | - if (($handle = fopen("$depotfile", "r"))!==FALSE) { |
|
120 | - $columns = fgetcsv($handle, $max_line_length, $delemietr); |
|
119 | + if (($handle = fopen("$depotfile", "r"))!==FALSE) { |
|
120 | + $columns = fgetcsv($handle, $max_line_length, $delemietr); |
|
121 | 121 | |
122 | - if (empty($columns)) { |
|
123 | - $error['message'] = 'Empty'; |
|
124 | - return ($error); |
|
125 | - } |
|
122 | + if (empty($columns)) { |
|
123 | + $error['message'] = 'Empty'; |
|
124 | + return ($error); |
|
125 | + } |
|
126 | 126 | |
127 | - $depotsParams = array( |
|
128 | - 'optimization_problem_id' => $optid, |
|
129 | - 'delete_old_depots' => true, |
|
130 | - ); |
|
127 | + $depotsParams = array( |
|
128 | + 'optimization_problem_id' => $optid, |
|
129 | + 'delete_old_depots' => true, |
|
130 | + ); |
|
131 | 131 | |
132 | - $iRow = 1; |
|
133 | - $depotAddresses = array(); |
|
132 | + $iRow = 1; |
|
133 | + $depotAddresses = array(); |
|
134 | 134 | |
135 | - while (($rows = fgetcsv($handle, $max_line_length, $delemietr))!==false) { |
|
136 | - if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) { |
|
137 | - $depotAddress['lat'] = $rows[0]; |
|
138 | - $depotAddress['lng'] = $rows[1]; |
|
139 | - $depotAddress['address'] = $rows[3]; |
|
140 | - array_push($depotAddresses, $depotAddress); |
|
141 | - } |
|
142 | - } |
|
135 | + while (($rows = fgetcsv($handle, $max_line_length, $delemietr))!==false) { |
|
136 | + if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) { |
|
137 | + $depotAddress['lat'] = $rows[0]; |
|
138 | + $depotAddress['lng'] = $rows[1]; |
|
139 | + $depotAddress['address'] = $rows[3]; |
|
140 | + array_push($depotAddresses, $depotAddress); |
|
141 | + } |
|
142 | + } |
|
143 | 143 | |
144 | - $depotsParams['new_depots'] = $depotAddresses; |
|
144 | + $depotsParams['new_depots'] = $depotAddresses; |
|
145 | 145 | |
146 | - $optProblem = new OptimizationProblem(); |
|
146 | + $optProblem = new OptimizationProblem(); |
|
147 | 147 | |
148 | - $resultDepots = $optProblem->addDepotsToHybrid($depotsParams); |
|
148 | + $resultDepots = $optProblem->addDepotsToHybrid($depotsParams); |
|
149 | 149 | |
150 | - /* Reoptimize hybrid optimization */ |
|
150 | + /* Reoptimize hybrid optimization */ |
|
151 | 151 | |
152 | - if ($resultDepots!=null) { |
|
153 | - $problemParams = array( |
|
154 | - 'optimization_problem_id' => $optid |
|
155 | - ); |
|
156 | - $problem = OptimizationProblem::reoptimize($problemParams); |
|
152 | + if ($resultDepots!=null) { |
|
153 | + $problemParams = array( |
|
154 | + 'optimization_problem_id' => $optid |
|
155 | + ); |
|
156 | + $problem = OptimizationProblem::reoptimize($problemParams); |
|
157 | 157 | |
158 | - Route4Me::simplePrint($problem); |
|
159 | - } |
|
160 | - } |
|
161 | - } |
|
158 | + Route4Me::simplePrint($problem); |
|
159 | + } |
|
160 | + } |
|
161 | + } |
|
162 | 162 | } |
@@ -15,14 +15,14 @@ |
||
15 | 15 | $vehicle = new Vehicle(); |
16 | 16 | |
17 | 17 | $vehicleParameters = array( |
18 | - "with_pagination" => true, |
|
19 | - "page" => 2, |
|
20 | - "perPage" => 10 |
|
21 | - ); |
|
18 | + "with_pagination" => true, |
|
19 | + "page" => 2, |
|
20 | + "perPage" => 10 |
|
21 | + ); |
|
22 | 22 | |
23 | 23 | $response = $vehicle->getVehicles($vehicleParameters); |
24 | 24 | |
25 | 25 | foreach ($response['data'] as $key => $vehicle) { |
26 | - Route4Me::simplePrint($vehicle); |
|
27 | - echo "<br>"; |
|
26 | + Route4Me::simplePrint($vehicle); |
|
27 | + echo "<br>"; |
|
28 | 28 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | // Delete member from the user's account |
26 | 26 | $params = Member::fromArray(array ( |
27 | - "member_id" => $randomMemberID |
|
27 | + "member_id" => $randomMemberID |
|
28 | 28 | )); |
29 | 29 | |
30 | 30 | $response = $member->deleteMember($params); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | assert(!is_null($randomMemberID), "There is no member of the type SUB_ACCOUNT_DRIVER in the user's account"); |
24 | 24 | |
25 | 25 | // Delete member from the user's account |
26 | -$params = Member::fromArray(array ( |
|
26 | +$params = Member::fromArray(array( |
|
27 | 27 | "member_id" => $randomMemberID |
28 | 28 | )); |
29 | 29 |
@@ -17,9 +17,9 @@ |
||
17 | 17 | // Example refers to the process of searching for the routed locations |
18 | 18 | |
19 | 19 | $params = array( |
20 | - 'offset' => 0, |
|
21 | - 'limit' => 5, |
|
22 | - 'display' => 'routed' |
|
20 | + 'offset' => 0, |
|
21 | + 'limit' => 5, |
|
22 | + 'display' => 'routed' |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | $abcResult = $ablocation->searchAddressBookLocations($params); |
@@ -14,10 +14,10 @@ |
||
14 | 14 | $ablocation = new AddressBookLocation(); |
15 | 15 | |
16 | 16 | $params = array( |
17 | - "query" => "David", |
|
18 | - "fields" => "first_name,last_name,address_email, address_alias, address_1", |
|
19 | - "offset" => 0, |
|
20 | - "limit" => 20, |
|
17 | + "query" => "David", |
|
18 | + "fields" => "first_name,last_name,address_email, address_alias, address_1", |
|
19 | + "offset" => 0, |
|
20 | + "limit" => 20, |
|
21 | 21 | ); |
22 | 22 | |
23 | 23 | $abcResult = $ablocation->searchAddressBookLocations($params); |
@@ -27,13 +27,13 @@ |
||
27 | 27 | |
28 | 28 | // Add a file note |
29 | 29 | $noteParameters = array( |
30 | - "strFilename" => "notes.csv", |
|
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" => "ANY_FILE" |
|
30 | + "strFilename" => "notes.csv", |
|
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" => "ANY_FILE" |
|
37 | 37 | ); |
38 | 38 | |
39 | 39 | $address = new Address(); |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | Route4Me::setApiKey('11111111111111111111111111111111'); |
14 | 14 | |
15 | 15 | $gcParameters = (array)Geocoding::fromArray(array( |
16 | - "offset" => 0, |
|
17 | - "limit" => 5 |
|
16 | + "offset" => 0, |
|
17 | + "limit" => 5 |
|
18 | 18 | )); |
19 | 19 | |
20 | 20 | $geocoding = new Geocoding(); |
@@ -22,6 +22,6 @@ discard block |
||
22 | 22 | $response = $geocoding->getStreetData($gcParameters); |
23 | 23 | |
24 | 24 | foreach ($response as $gcode) { |
25 | - Route4Me::simplePrint($gcode); |
|
26 | - echo "<br>"; |
|
25 | + Route4Me::simplePrint($gcode); |
|
26 | + echo "<br>"; |
|
27 | 27 | } |
@@ -16,13 +16,13 @@ |
||
16 | 16 | $order = new Order(); |
17 | 17 | |
18 | 18 | $orderParameters = Order::fromArray(array( |
19 | - "offset" => 0, |
|
20 | - 'limit' => 5, |
|
19 | + "offset" => 0, |
|
20 | + 'limit' => 5, |
|
21 | 21 | )); |
22 | 22 | |
23 | 23 | $response = $order->getOrders($orderParameters); |
24 | 24 | |
25 | 25 | foreach ($response['results'] as $key => $order) { |
26 | - Route4Me::simplePrint($order); |
|
27 | - echo "<br>"; |
|
26 | + Route4Me::simplePrint($order); |
|
27 | + echo "<br>"; |
|
28 | 28 | } |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
15 | 15 | |
16 | 16 | $orderParameters = Order::fromArray(array( |
17 | - "fields" => "order_id,member_id", |
|
18 | - "offset" => 0, |
|
19 | - "limit" => 5 |
|
17 | + "fields" => "order_id,member_id", |
|
18 | + "offset" => 0, |
|
19 | + "limit" => 5 |
|
20 | 20 | )); |
21 | 21 | |
22 | 22 | $order = new Order(); |
@@ -24,5 +24,5 @@ discard block |
||
24 | 24 | $response = $order->getOrder($orderParameters); |
25 | 25 | |
26 | 26 | foreach ($response as $key => $order) { |
27 | - Route4Me::simplePrint($order); |
|
27 | + Route4Me::simplePrint($order); |
|
28 | 28 | } |