@@ -7,20 +7,20 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Track extends Common |
| 9 | 9 | { |
| 10 | - public static $apiUrl = '/track/set.php'; |
|
| 10 | + public static $apiUrl = '/track/set.php'; |
|
| 11 | 11 | |
| 12 | - public static function set(TrackSetParams $param) |
|
| 13 | - { |
|
| 14 | - $query = array_merge($param->toArray(), array( |
|
| 15 | - 'api_key' => Route4Me::getApiKey() |
|
| 16 | - )); |
|
| 12 | + public static function set(TrackSetParams $param) |
|
| 13 | + { |
|
| 14 | + $query = array_merge($param->toArray(), array( |
|
| 15 | + 'api_key' => Route4Me::getApiKey() |
|
| 16 | + )); |
|
| 17 | 17 | |
| 18 | - $json = Route4Me::makeRequst(array( |
|
| 19 | - 'url' => self::$apiUrl, |
|
| 20 | - 'method' => 'GET', |
|
| 21 | - 'query' => $query |
|
| 22 | - )); |
|
| 18 | + $json = Route4Me::makeRequst(array( |
|
| 19 | + 'url' => self::$apiUrl, |
|
| 20 | + 'method' => 'GET', |
|
| 21 | + 'query' => $query |
|
| 22 | + )); |
|
| 23 | 23 | |
| 24 | - return $json['status']; |
|
| 25 | - } |
|
| 24 | + return $json['status']; |
|
| 25 | + } |
|
| 26 | 26 | } |
@@ -12,154 +12,154 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class OptimizationProblem extends Common |
| 14 | 14 | { |
| 15 | - static public $apiUrl = '/api.v4/optimization_problem.php'; |
|
| 15 | + static public $apiUrl = '/api.v4/optimization_problem.php'; |
|
| 16 | 16 | static public $apiUrl_addr = '/api.v4/address.php'; |
| 17 | 17 | |
| 18 | - public $optimization_problem_id; |
|
| 19 | - public $user_errors = array(); |
|
| 20 | - public $state; |
|
| 21 | - public $parameters; |
|
| 22 | - public $sent_to_background; |
|
| 23 | - public $addresses = array(); |
|
| 24 | - public $routes = array(); |
|
| 25 | - public $links = array(); |
|
| 26 | - |
|
| 27 | - function __construct() |
|
| 28 | - { |
|
| 29 | - $this->parameters = new RouteParameters; |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - public static function fromArray(array $params) |
|
| 33 | - { |
|
| 34 | - $problem = new OptimizationProblem; |
|
| 35 | - $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id'); |
|
| 36 | - $problem->user_errors = Common::getValue($params, 'user_errors', array()); |
|
| 37 | - $problem->state = Common::getValue($params, 'state', array()); |
|
| 38 | - $problem->sent_to_background = Common::getValue($params, 'sent_to_background', array()); |
|
| 39 | - $problem->links = Common::getValue($params, 'links', array()); |
|
| 40 | - |
|
| 41 | - if (isset($params['parameters'])) { |
|
| 42 | - $problem->parameters = RouteParameters::fromArray($params['parameters']); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if (isset($params['addresses'])) { |
|
| 46 | - $addresses = array(); |
|
| 47 | - foreach ($params['addresses'] as $address) { |
|
| 48 | - $addresses[] = Address::fromArray($address); |
|
| 49 | - } |
|
| 50 | - $problem->addresses = $addresses; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - if (isset($params['routes'])) { |
|
| 54 | - $routes = array(); |
|
| 55 | - foreach ($params['routes'] as $route) { |
|
| 56 | - $routes[] = Route::fromArray($address); |
|
| 57 | - } |
|
| 58 | - $problem->routes = $routes; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - return $problem; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - public static function optimize(OptimizationProblemParams $params) |
|
| 65 | - { |
|
| 66 | - $optimize = Route4Me::makeRequst(array( |
|
| 67 | - 'url' => self::$apiUrl, |
|
| 68 | - 'method' => 'POST', |
|
| 69 | - 'query' => array( |
|
| 70 | - 'directions' => $params->directions, |
|
| 71 | - 'format' => $params->format, |
|
| 72 | - 'route_path_output' => $params->route_path_output, |
|
| 73 | - 'optimized_callback_url' => $params->optimized_callback_url |
|
| 74 | - ), |
|
| 75 | - 'body' => array( |
|
| 76 | - 'addresses' => $params->getAddressesArray(), |
|
| 77 | - 'parameters' => $params->getParametersArray() |
|
| 78 | - ) |
|
| 79 | - )); |
|
| 80 | - |
|
| 81 | - return OptimizationProblem::fromArray($optimize); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - public static function get($params) |
|
| 85 | - { |
|
| 86 | - $optimize = Route4Me::makeRequst(array( |
|
| 87 | - 'url' => self::$apiUrl, |
|
| 88 | - 'method' => 'GET', |
|
| 89 | - 'query' => array( |
|
| 90 | - 'state' => isset($params['state']) ? $params['state'] : null, |
|
| 91 | - 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
| 92 | - 'offset' => isset($params['offset']) ? $params['offset'] : null, |
|
| 93 | - 'optimization_problem_id' => isset($params['optimization_problem_id']) |
|
| 94 | - ? $params['optimization_problem_id'] : null, |
|
| 95 | - 'wait_for_final_state' => isset($params['wait_for_final_state']) |
|
| 96 | - ? $params['wait_for_final_state'] : null, |
|
| 97 | - ) |
|
| 98 | - )); |
|
| 99 | - |
|
| 100 | - if (isset($optimize['optimizations'])) { |
|
| 101 | - $problems = array(); |
|
| 102 | - foreach($optimize['optimizations'] as $problem) { |
|
| 103 | - $problems[] = OptimizationProblem::fromArray($problem); |
|
| 104 | - } |
|
| 105 | - return $problems; |
|
| 106 | - } else { |
|
| 107 | - return OptimizationProblem::fromArray($optimize); |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - public static function reoptimize($params) |
|
| 112 | - { |
|
| 113 | - $param = new OptimizationProblemParams; |
|
| 114 | - $param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null; |
|
| 115 | - $param->reoptimize = 1; |
|
| 116 | - |
|
| 117 | - return self::update((array)$param); |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - public static function update($params) |
|
| 121 | - { |
|
| 18 | + public $optimization_problem_id; |
|
| 19 | + public $user_errors = array(); |
|
| 20 | + public $state; |
|
| 21 | + public $parameters; |
|
| 22 | + public $sent_to_background; |
|
| 23 | + public $addresses = array(); |
|
| 24 | + public $routes = array(); |
|
| 25 | + public $links = array(); |
|
| 26 | + |
|
| 27 | + function __construct() |
|
| 28 | + { |
|
| 29 | + $this->parameters = new RouteParameters; |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + public static function fromArray(array $params) |
|
| 33 | + { |
|
| 34 | + $problem = new OptimizationProblem; |
|
| 35 | + $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id'); |
|
| 36 | + $problem->user_errors = Common::getValue($params, 'user_errors', array()); |
|
| 37 | + $problem->state = Common::getValue($params, 'state', array()); |
|
| 38 | + $problem->sent_to_background = Common::getValue($params, 'sent_to_background', array()); |
|
| 39 | + $problem->links = Common::getValue($params, 'links', array()); |
|
| 40 | + |
|
| 41 | + if (isset($params['parameters'])) { |
|
| 42 | + $problem->parameters = RouteParameters::fromArray($params['parameters']); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if (isset($params['addresses'])) { |
|
| 46 | + $addresses = array(); |
|
| 47 | + foreach ($params['addresses'] as $address) { |
|
| 48 | + $addresses[] = Address::fromArray($address); |
|
| 49 | + } |
|
| 50 | + $problem->addresses = $addresses; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + if (isset($params['routes'])) { |
|
| 54 | + $routes = array(); |
|
| 55 | + foreach ($params['routes'] as $route) { |
|
| 56 | + $routes[] = Route::fromArray($address); |
|
| 57 | + } |
|
| 58 | + $problem->routes = $routes; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + return $problem; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + public static function optimize(OptimizationProblemParams $params) |
|
| 65 | + { |
|
| 122 | 66 | $optimize = Route4Me::makeRequst(array( |
| 123 | - 'url' => self::$apiUrl, |
|
| 124 | - 'method' => 'PUT', |
|
| 125 | - 'query' => array( |
|
| 126 | - 'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null, |
|
| 127 | - 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
| 128 | - 'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null, |
|
| 129 | - ) |
|
| 130 | - )); |
|
| 67 | + 'url' => self::$apiUrl, |
|
| 68 | + 'method' => 'POST', |
|
| 69 | + 'query' => array( |
|
| 70 | + 'directions' => $params->directions, |
|
| 71 | + 'format' => $params->format, |
|
| 72 | + 'route_path_output' => $params->route_path_output, |
|
| 73 | + 'optimized_callback_url' => $params->optimized_callback_url |
|
| 74 | + ), |
|
| 75 | + 'body' => array( |
|
| 76 | + 'addresses' => $params->getAddressesArray(), |
|
| 77 | + 'parameters' => $params->getParametersArray() |
|
| 78 | + ) |
|
| 79 | + )); |
|
| 80 | + |
|
| 81 | + return OptimizationProblem::fromArray($optimize); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + public static function get($params) |
|
| 85 | + { |
|
| 86 | + $optimize = Route4Me::makeRequst(array( |
|
| 87 | + 'url' => self::$apiUrl, |
|
| 88 | + 'method' => 'GET', |
|
| 89 | + 'query' => array( |
|
| 90 | + 'state' => isset($params['state']) ? $params['state'] : null, |
|
| 91 | + 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
| 92 | + 'offset' => isset($params['offset']) ? $params['offset'] : null, |
|
| 93 | + 'optimization_problem_id' => isset($params['optimization_problem_id']) |
|
| 94 | + ? $params['optimization_problem_id'] : null, |
|
| 95 | + 'wait_for_final_state' => isset($params['wait_for_final_state']) |
|
| 96 | + ? $params['wait_for_final_state'] : null, |
|
| 97 | + ) |
|
| 98 | + )); |
|
| 99 | + |
|
| 100 | + if (isset($optimize['optimizations'])) { |
|
| 101 | + $problems = array(); |
|
| 102 | + foreach($optimize['optimizations'] as $problem) { |
|
| 103 | + $problems[] = OptimizationProblem::fromArray($problem); |
|
| 104 | + } |
|
| 105 | + return $problems; |
|
| 106 | + } else { |
|
| 107 | + return OptimizationProblem::fromArray($optimize); |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + public static function reoptimize($params) |
|
| 112 | + { |
|
| 113 | + $param = new OptimizationProblemParams; |
|
| 114 | + $param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null; |
|
| 115 | + $param->reoptimize = 1; |
|
| 116 | + |
|
| 117 | + return self::update((array)$param); |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + public static function update($params) |
|
| 121 | + { |
|
| 122 | + $optimize = Route4Me::makeRequst(array( |
|
| 123 | + 'url' => self::$apiUrl, |
|
| 124 | + 'method' => 'PUT', |
|
| 125 | + 'query' => array( |
|
| 126 | + 'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null, |
|
| 127 | + 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
| 128 | + 'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null, |
|
| 129 | + ) |
|
| 130 | + )); |
|
| 131 | 131 | |
| 132 | 132 | return $optimize; |
| 133 | - } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - public function getOptimizationId() |
|
| 136 | - { |
|
| 137 | - return $this->optimization_problem_id; |
|
| 138 | - } |
|
| 135 | + public function getOptimizationId() |
|
| 136 | + { |
|
| 137 | + return $this->optimization_problem_id; |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - public function getRoutes() |
|
| 141 | - { |
|
| 142 | - return $this->routes; |
|
| 143 | - } |
|
| 140 | + public function getRoutes() |
|
| 141 | + { |
|
| 142 | + return $this->routes; |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | 145 | public function getRandomOptimizationId($offset,$limit) |
| 146 | 146 | { |
| 147 | 147 | $query['limit'] = isset($params['limit']) ? $params['limit'] : 30; |
| 148 | - $query['offset'] = isset($params['offset']) ? $params['offset'] : 0; |
|
| 148 | + $query['offset'] = isset($params['offset']) ? $params['offset'] : 0; |
|
| 149 | 149 | |
| 150 | 150 | $json = Route4Me::makeRequst(array( |
| 151 | - 'url' => self::$apiUrl, |
|
| 152 | - 'method' => 'GET', |
|
| 153 | - 'query' => $query |
|
| 154 | - )); |
|
| 151 | + 'url' => self::$apiUrl, |
|
| 152 | + 'method' => 'GET', |
|
| 153 | + 'query' => $query |
|
| 154 | + )); |
|
| 155 | 155 | |
| 156 | 156 | $optimizations = array(); |
| 157 | - foreach($json as $optimization) { |
|
| 157 | + foreach($json as $optimization) { |
|
| 158 | 158 | if (gettype($optimization)!="array") continue; |
| 159 | 159 | foreach ($optimization as $otp1) { |
| 160 | 160 | $optimizations[] = $otp1; |
| 161 | 161 | } |
| 162 | - } |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | 164 | $num=rand(0,sizeof($optimizations)-1); |
| 165 | 165 | //echo "num=$num.<br>".sizeof($optimizations)."<br>"; |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | public function removeAddress($params) |
| 200 | 200 | { |
| 201 | 201 | $response = Route4Me::makeRequst(array( |
| 202 | - 'url' => self::$apiUrl_addr, |
|
| 203 | - 'method' => 'DELETE', |
|
| 204 | - 'query' => array( |
|
| 205 | - 'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null, |
|
| 206 | - 'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null, |
|
| 207 | - ) |
|
| 208 | - )); |
|
| 202 | + 'url' => self::$apiUrl_addr, |
|
| 203 | + 'method' => 'DELETE', |
|
| 204 | + 'query' => array( |
|
| 205 | + 'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null, |
|
| 206 | + 'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null, |
|
| 207 | + ) |
|
| 208 | + )); |
|
| 209 | 209 | |
| 210 | 210 | return $response; |
| 211 | 211 | } |
@@ -213,15 +213,15 @@ discard block |
||
| 213 | 213 | public function removeOptimization($params) |
| 214 | 214 | { |
| 215 | 215 | $response = Route4Me::makeRequst(array( |
| 216 | - 'url' => self::$apiUrl, |
|
| 217 | - 'method' => 'DELETE', |
|
| 218 | - 'query' => array( |
|
| 219 | - 'redirect' => isset($params['redirect']) ? $params['redirect'] : null, |
|
| 220 | - ), |
|
| 221 | - 'body' => array( |
|
| 216 | + 'url' => self::$apiUrl, |
|
| 217 | + 'method' => 'DELETE', |
|
| 218 | + 'query' => array( |
|
| 219 | + 'redirect' => isset($params['redirect']) ? $params['redirect'] : null, |
|
| 220 | + ), |
|
| 221 | + 'body' => array( |
|
| 222 | 222 | 'optimization_problem_ids' => isset($params['optimization_problem_ids']) ? $params['optimization_problem_ids'] : null, |
| 223 | 223 | ) |
| 224 | - )); |
|
| 224 | + )); |
|
| 225 | 225 | |
| 226 | 226 | return $response; |
| 227 | 227 | } |
@@ -32,127 +32,127 @@ |
||
| 32 | 32 | |
| 33 | 33 | public static function fromArray(array $params) { |
| 34 | 34 | $addressbooklocation = new AddressBookLocation(); |
| 35 | - foreach($params as $key => $value) { |
|
| 36 | - if (property_exists($addressbooklocation, $key)) { |
|
| 37 | - $addressbooklocation->{$key} = $value; |
|
| 38 | - } |
|
| 35 | + foreach($params as $key => $value) { |
|
| 36 | + if (property_exists($addressbooklocation, $key)) { |
|
| 37 | + $addressbooklocation->{$key} = $value; |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | return $addressbooklocation; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public static function getAddressBookLocation($addressId) |
| 45 | - { |
|
| 46 | - $ablocations = Route4Me::makeRequst(array( |
|
| 47 | - 'url' => self::$apiUrl, |
|
| 48 | - 'method' => 'GET', |
|
| 49 | - 'query' => array( |
|
| 50 | - 'query' => $addressId, |
|
| 51 | - 'limit' => 30 |
|
| 52 | - ) |
|
| 53 | - )); |
|
| 45 | + { |
|
| 46 | + $ablocations = Route4Me::makeRequst(array( |
|
| 47 | + 'url' => self::$apiUrl, |
|
| 48 | + 'method' => 'GET', |
|
| 49 | + 'query' => array( |
|
| 50 | + 'query' => $addressId, |
|
| 51 | + 'limit' => 30 |
|
| 52 | + ) |
|
| 53 | + )); |
|
| 54 | 54 | |
| 55 | 55 | return $ablocations; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public static function searchRoutedLocation($params) |
| 59 | - { |
|
| 60 | - $result= Route4Me::makeRequst(array( |
|
| 61 | - 'url' => self::$apiUrl, |
|
| 62 | - 'method' => 'GET', |
|
| 63 | - 'query' => array( |
|
| 64 | - 'display' => isset($params['display']) ? $params['display']: null, |
|
| 65 | - 'query' => isset($params['query']) ? $params['query']: null, |
|
| 66 | - 'fields' => isset($params['fields']) ? $params['fields']: null, |
|
| 67 | - 'limit' => isset($params['limit']) ? $params['limit']: null, |
|
| 68 | - 'offset' => isset($params['offset']) ? $params['offset'] : null, |
|
| 69 | - ) |
|
| 70 | - )); |
|
| 59 | + { |
|
| 60 | + $result= Route4Me::makeRequst(array( |
|
| 61 | + 'url' => self::$apiUrl, |
|
| 62 | + 'method' => 'GET', |
|
| 63 | + 'query' => array( |
|
| 64 | + 'display' => isset($params['display']) ? $params['display']: null, |
|
| 65 | + 'query' => isset($params['query']) ? $params['query']: null, |
|
| 66 | + 'fields' => isset($params['fields']) ? $params['fields']: null, |
|
| 67 | + 'limit' => isset($params['limit']) ? $params['limit']: null, |
|
| 68 | + 'offset' => isset($params['offset']) ? $params['offset'] : null, |
|
| 69 | + ) |
|
| 70 | + )); |
|
| 71 | 71 | |
| 72 | 72 | return $result; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public static function getAddressBookLocations($params) |
| 76 | - { |
|
| 77 | - $ablocations = Route4Me::makeRequst(array( |
|
| 78 | - 'url' => self::$apiUrl, |
|
| 79 | - 'method' => 'GET', |
|
| 80 | - 'query' => array( |
|
| 81 | - 'limit' => isset($params->limit) ? $params->limit: null, |
|
| 82 | - 'offset' => isset($params->offset) ? $params->offset : null, |
|
| 83 | - ) |
|
| 84 | - )); |
|
| 76 | + { |
|
| 77 | + $ablocations = Route4Me::makeRequst(array( |
|
| 78 | + 'url' => self::$apiUrl, |
|
| 79 | + 'method' => 'GET', |
|
| 80 | + 'query' => array( |
|
| 81 | + 'limit' => isset($params->limit) ? $params->limit: null, |
|
| 82 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
| 83 | + ) |
|
| 84 | + )); |
|
| 85 | 85 | |
| 86 | 86 | return $ablocations; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | public static function getAddressBookLocationsByIds($ids) |
| 90 | - { |
|
| 91 | - $ablocations = Route4Me::makeRequst(array( |
|
| 92 | - 'url' => self::$apiUrl, |
|
| 93 | - 'method' => 'GET', |
|
| 94 | - 'query' => array( |
|
| 95 | - 'address_id' => $ids |
|
| 96 | - ) |
|
| 97 | - )); |
|
| 90 | + { |
|
| 91 | + $ablocations = Route4Me::makeRequst(array( |
|
| 92 | + 'url' => self::$apiUrl, |
|
| 93 | + 'method' => 'GET', |
|
| 94 | + 'query' => array( |
|
| 95 | + 'address_id' => $ids |
|
| 96 | + ) |
|
| 97 | + )); |
|
| 98 | 98 | |
| 99 | 99 | return $ablocations; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | public static function addAdressBookLocation($params) |
| 103 | - { |
|
| 104 | - $ablocations = Route4Me::makeRequst(array( |
|
| 105 | - 'url' => self::$apiUrl, |
|
| 106 | - 'method' => 'ADD', |
|
| 107 | - 'query' => array( |
|
| 108 | - 'address_1' => isset($params->address_1) ? $params->address_1: null, |
|
| 109 | - 'first_name' => isset($params->first_name) ? $params->first_name : null, |
|
| 110 | - 'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null, |
|
| 111 | - 'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null, |
|
| 112 | - ) |
|
| 113 | - )); |
|
| 103 | + { |
|
| 104 | + $ablocations = Route4Me::makeRequst(array( |
|
| 105 | + 'url' => self::$apiUrl, |
|
| 106 | + 'method' => 'ADD', |
|
| 107 | + 'query' => array( |
|
| 108 | + 'address_1' => isset($params->address_1) ? $params->address_1: null, |
|
| 109 | + 'first_name' => isset($params->first_name) ? $params->first_name : null, |
|
| 110 | + 'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null, |
|
| 111 | + 'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null, |
|
| 112 | + ) |
|
| 113 | + )); |
|
| 114 | 114 | |
| 115 | 115 | return $ablocations; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public function deleteAdressBookLocation($address_ids) |
| 119 | - { |
|
| 120 | - $address = Route4Me::makeRequst(array( |
|
| 121 | - 'url' => self::$apiUrl, |
|
| 122 | - 'method' => 'DELETEARRAY', |
|
| 123 | - 'query' => array( |
|
| 124 | - 'address_ids' => $address_ids |
|
| 125 | - ) |
|
| 126 | - )); |
|
| 119 | + { |
|
| 120 | + $address = Route4Me::makeRequst(array( |
|
| 121 | + 'url' => self::$apiUrl, |
|
| 122 | + 'method' => 'DELETEARRAY', |
|
| 123 | + 'query' => array( |
|
| 124 | + 'address_ids' => $address_ids |
|
| 125 | + ) |
|
| 126 | + )); |
|
| 127 | 127 | |
| 128 | - return $address; |
|
| 129 | - } |
|
| 128 | + return $address; |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | 131 | public function updateAdressBookLocation($params) |
| 132 | - { |
|
| 133 | - //echo "address_id --> ".$params["address_id"]."<br"; |
|
| 134 | - $address = Route4Me::makeRequst(array( |
|
| 135 | - 'url' => self::$apiUrl, |
|
| 136 | - 'method' => 'PUT', |
|
| 137 | - 'query' => $params, |
|
| 132 | + { |
|
| 133 | + //echo "address_id --> ".$params["address_id"]."<br"; |
|
| 134 | + $address = Route4Me::makeRequst(array( |
|
| 135 | + 'url' => self::$apiUrl, |
|
| 136 | + 'method' => 'PUT', |
|
| 137 | + 'query' => $params, |
|
| 138 | 138 | |
| 139 | - )); |
|
| 139 | + )); |
|
| 140 | 140 | |
| 141 | - return $address; |
|
| 142 | - } |
|
| 141 | + return $address; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | 144 | public static function get($params) |
| 145 | - { |
|
| 146 | - $ablocations = Route4Me::makeRequst(array( |
|
| 147 | - 'url' => self::$apiUrl, |
|
| 148 | - 'method' => 'ADD', |
|
| 149 | - 'query' => array( |
|
| 150 | - 'first_name' => isset($params->first_name) ? $params->first_name : null, |
|
| 151 | - 'address_1' => isset($params->address_1) ? $params->address_1: null, |
|
| 152 | - 'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null, |
|
| 153 | - 'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null, |
|
| 154 | - ) |
|
| 155 | - )); |
|
| 145 | + { |
|
| 146 | + $ablocations = Route4Me::makeRequst(array( |
|
| 147 | + 'url' => self::$apiUrl, |
|
| 148 | + 'method' => 'ADD', |
|
| 149 | + 'query' => array( |
|
| 150 | + 'first_name' => isset($params->first_name) ? $params->first_name : null, |
|
| 151 | + 'address_1' => isset($params->address_1) ? $params->address_1: null, |
|
| 152 | + 'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null, |
|
| 153 | + 'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null, |
|
| 154 | + ) |
|
| 155 | + )); |
|
| 156 | 156 | |
| 157 | 157 | return $ablocations; |
| 158 | 158 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Avoidance |
| 6 | 6 | { |
| 7 | - const HIGHWAYS = 'Highways'; |
|
| 8 | - const TOLLS = 'Tolls'; |
|
| 9 | - const MINIMIZE_HIGHWAYS = 'minimizeHighways'; |
|
| 10 | - const MINIMIZE_TOLLS = 'minimizeTolls'; |
|
| 7 | + const HIGHWAYS = 'Highways'; |
|
| 8 | + const TOLLS = 'Tolls'; |
|
| 9 | + const MINIMIZE_HIGHWAYS = 'minimizeHighways'; |
|
| 10 | + const MINIMIZE_TOLLS = 'minimizeTolls'; |
|
| 11 | 11 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | class OptimizationType |
| 6 | 6 | { |
| 7 | - const DISTANCE = 'Distance'; |
|
| 8 | - const TIME = 'Time'; |
|
| 9 | - const TIME_WITH_TRAFFIC = 'timeWithTraffic'; |
|
| 7 | + const DISTANCE = 'Distance'; |
|
| 8 | + const TIME = 'Time'; |
|
| 9 | + const TIME_WITH_TRAFFIC = 'timeWithTraffic'; |
|
| 10 | 10 | } |
@@ -4,10 +4,10 @@ |
||
| 4 | 4 | |
| 5 | 5 | class OptimizationStates |
| 6 | 6 | { |
| 7 | - const INITIAL = 1; |
|
| 8 | - const MATRIX_PROCESSING = 2; |
|
| 9 | - const OPTIMIZING = 3; |
|
| 10 | - const OPTIMIZED = 4; |
|
| 11 | - const ERROR = 5; |
|
| 12 | - const COMPUTING_DIRECTIONS = 6; |
|
| 7 | + const INITIAL = 1; |
|
| 8 | + const MATRIX_PROCESSING = 2; |
|
| 9 | + const OPTIMIZING = 3; |
|
| 10 | + const OPTIMIZED = 4; |
|
| 11 | + const ERROR = 5; |
|
| 12 | + const COMPUTING_DIRECTIONS = 6; |
|
| 13 | 13 | } |
@@ -4,9 +4,9 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Metric |
| 6 | 6 | { |
| 7 | - const EUCLIDEAN = 1; |
|
| 8 | - const MANHATTAN = 2; |
|
| 9 | - const GEODESIC = 3; |
|
| 10 | - const MATRIX = 4; |
|
| 11 | - const EXACT_2D = 5; |
|
| 7 | + const EUCLIDEAN = 1; |
|
| 8 | + const MANHATTAN = 2; |
|
| 9 | + const GEODESIC = 3; |
|
| 10 | + const MATRIX = 4; |
|
| 11 | + const EXACT_2D = 5; |
|
| 12 | 12 | } |
@@ -4,6 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | class DistanceUnit |
| 6 | 6 | { |
| 7 | - const MILES = 'mi'; |
|
| 8 | - const KILOMETERS = 'km'; |
|
| 7 | + const MILES = 'mi'; |
|
| 8 | + const KILOMETERS = 'km'; |
|
| 9 | 9 | } |
@@ -4,9 +4,9 @@ |
||
| 4 | 4 | |
| 5 | 5 | class TerritoryTypes |
| 6 | 6 | { |
| 7 | - const CIRCLE = 'circle'; |
|
| 8 | - const POLY = 'poly'; |
|
| 9 | - const RECT = 'rect'; |
|
| 7 | + const CIRCLE = 'circle'; |
|
| 8 | + const POLY = 'poly'; |
|
| 9 | + const RECT = 'rect'; |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | ?> |
| 13 | 13 | \ No newline at end of file |