@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | { |
14 | 14 | static public $apiUrl = '/api.v4/route.php'; |
15 | 15 | static public $apiUrlAddress = '/api.v4/address.php'; |
16 | - static public $apiUrlDuplicate='/actions/duplicate_route.php'; |
|
17 | - static public $apiUrlDelete='/actions/delete_routes.php'; |
|
18 | - static public $apiUrlReseq='/api.v3/route/reoptimize_2.php'; |
|
19 | - static public $apiUrlMerge='/actions/merge_routes.php'; |
|
20 | - static public $apiUrlShare='/actions/route/share_route.php'; |
|
21 | - static public $apiUrlNoteFile='/actions/addRouteNotes.php'; |
|
22 | - static public $apiUrlAsset='/api.v4/status.php'; |
|
23 | - static public $apiUrlDeviceLocation='/api/track/get_device_location.php'; |
|
16 | + static public $apiUrlDuplicate = '/actions/duplicate_route.php'; |
|
17 | + static public $apiUrlDelete = '/actions/delete_routes.php'; |
|
18 | + static public $apiUrlReseq = '/api.v3/route/reoptimize_2.php'; |
|
19 | + static public $apiUrlMerge = '/actions/merge_routes.php'; |
|
20 | + static public $apiUrlShare = '/actions/route/share_route.php'; |
|
21 | + static public $apiUrlNoteFile = '/actions/addRouteNotes.php'; |
|
22 | + static public $apiUrlAsset = '/api.v4/status.php'; |
|
23 | + static public $apiUrlDeviceLocation = '/api/track/get_device_location.php'; |
|
24 | 24 | //static public $apiUrlMove='/actions/route/move_route_destination.php'; |
25 | 25 | public $route_id; |
26 | 26 | public $route_destination_id; |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | return $route; |
80 | 80 | } |
81 | 81 | |
82 | - public static function getRoutes($routeId=null, $params=null) |
|
82 | + public static function getRoutes($routeId = null, $params = null) |
|
83 | 83 | { |
84 | 84 | $query = array( |
85 | 85 | 'api_key' => Route4Me::getApiKey() |
86 | 86 | ); |
87 | 87 | |
88 | 88 | if ($routeId) { |
89 | - $query['route_id'] = implode(',', (array) $routeId); |
|
89 | + $query['route_id'] = implode(',', (array)$routeId); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | if ($params) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | return Route::fromArray($json); die(""); |
121 | 121 | } else { |
122 | 122 | $routes = array(); |
123 | - foreach($json as $route) { |
|
123 | + foreach ($json as $route) { |
|
124 | 124 | $routes[] = Route::fromArray($route); |
125 | 125 | } |
126 | 126 | return $routes; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | // Getting random route_id from existing routes between $offset and $offset+$limit |
232 | - public function getRandomRouteId($offset,$limit) |
|
232 | + public function getRandomRouteId($offset, $limit) |
|
233 | 233 | { |
234 | 234 | $query['limit'] = isset($params['limit']) ? $params['limit'] : 30; |
235 | 235 | $query['offset'] = isset($params['offset']) ? $params['offset'] : 0; |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | |
243 | 243 | if (sizeof($json)>0) { |
244 | 244 | $routes = array(); |
245 | - foreach($json as $route) { |
|
245 | + foreach ($json as $route) { |
|
246 | 246 | $routes[] = Route::fromArray($route); |
247 | 247 | } |
248 | 248 | |
249 | - $num=rand(0,sizeof($routes)-1); |
|
250 | - $rRoute=(array)$routes[$num]; |
|
249 | + $num = rand(0, sizeof($routes) - 1); |
|
250 | + $rRoute = (array)$routes[$num]; |
|
251 | 251 | |
252 | 252 | if (is_array($rRoute)) |
253 | 253 | { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | 'route_id' => isset($this->route_id) ? $this->route_id : null, |
269 | 269 | 'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null, |
270 | 270 | ), |
271 | - 'body' => array ( |
|
271 | + 'body' => array( |
|
272 | 272 | 'parameters' => $this->parameters, |
273 | 273 | ), |
274 | 274 | 'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null, |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $fname = isset($params['strFilename']) ? $params['strFilename'] : null; |
332 | 332 | $rpath = realpath($fname); |
333 | 333 | //echo $rpath;die(""); |
334 | - $result= Route4Me::makeRequst(array( |
|
334 | + $result = Route4Me::makeRequst(array( |
|
335 | 335 | 'url' => self::$apiUrlNoteFile, |
336 | 336 | 'method' => 'POST', |
337 | 337 | 'query' => array( |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $result = Route4Me::makeRequst(array( |
364 | 364 | 'url' => self::$apiUrl, |
365 | 365 | 'method' => 'DELETE', |
366 | - 'query' => array( 'route_id' => $route_id ) |
|
366 | + 'query' => array('route_id' => $route_id) |
|
367 | 367 | )); |
368 | 368 | |
369 | 369 | // The code below doesn't work, altough this method is described as workable in REST API |
@@ -382,24 +382,24 @@ discard block |
||
382 | 382 | |
383 | 383 | public function GetAddressesFromRoute($route_id) |
384 | 384 | { |
385 | - $route1=Route::getRoutes($route_id,null); |
|
385 | + $route1 = Route::getRoutes($route_id, null); |
|
386 | 386 | if (isset($route1)) { |
387 | 387 | return $route1->addresses(); |
388 | - } else { return null;} |
|
388 | + } else { return null; } |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | public function GetRandomAddressFromRoute($route_id) |
392 | 392 | { |
393 | - $route1=Route::getRoutes($route_id,null); |
|
393 | + $route1 = Route::getRoutes($route_id, null); |
|
394 | 394 | |
395 | 395 | if (isset($route1)) { |
396 | - $addresses=$route1->addresses; |
|
396 | + $addresses = $route1->addresses; |
|
397 | 397 | |
398 | - $rnd=rand(0,sizeof($addresses)-1); |
|
398 | + $rnd = rand(0, sizeof($addresses) - 1); |
|
399 | 399 | |
400 | 400 | return $addresses[$rnd]; |
401 | 401 | |
402 | - } else { return null;} |
|
402 | + } else { return null; } |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | public function getRouteId() |