@@ -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\Member; |
@@ -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\Member; |
@@ -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\Member; |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
3 | - require $vdir.'/../vendor/autoload.php'; |
|
3 | + require $vdir.'/../vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | use Route4Me\MyQ; |
6 | 6 |
@@ -68,60 +68,60 @@ discard block |
||
68 | 68 | |
69 | 69 | public static function fromArray(array $params) { |
70 | 70 | $member= new Member(); |
71 | - foreach($params as $key => $value) { |
|
72 | - if (property_exists($member, $key)) { |
|
73 | - $member->{$key} = $value; |
|
74 | - } |
|
71 | + foreach($params as $key => $value) { |
|
72 | + if (property_exists($member, $key)) { |
|
73 | + $member->{$key} = $value; |
|
74 | + } |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | return $member; |
78 | 78 | } |
79 | 79 | |
80 | 80 | public static function getUsers() |
81 | - { |
|
82 | - $response = Route4Me::makeRequst(array( |
|
83 | - 'url' => self::$apiUrl, |
|
84 | - 'method' => 'GET' |
|
85 | - )); |
|
81 | + { |
|
82 | + $response = Route4Me::makeRequst(array( |
|
83 | + 'url' => self::$apiUrl, |
|
84 | + 'method' => 'GET' |
|
85 | + )); |
|
86 | 86 | //var_dump($response); die(""); |
87 | 87 | return $response; |
88 | 88 | } |
89 | 89 | |
90 | 90 | public static function getUser($params) |
91 | - { |
|
92 | - $response = Route4Me::makeRequst(array( |
|
93 | - 'url' => self::$apiUrl, |
|
94 | - 'method' => 'GET', |
|
95 | - 'query' => array( |
|
96 | - 'member_id' => isset($params['member_id']) ? $params['member_id'] : null |
|
91 | + { |
|
92 | + $response = Route4Me::makeRequst(array( |
|
93 | + 'url' => self::$apiUrl, |
|
94 | + 'method' => 'GET', |
|
95 | + 'query' => array( |
|
96 | + 'member_id' => isset($params['member_id']) ? $params['member_id'] : null |
|
97 | 97 | ) |
98 | - )); |
|
98 | + )); |
|
99 | 99 | //var_dump($response); die(""); |
100 | 100 | return $response; |
101 | 101 | } |
102 | 102 | |
103 | 103 | public static function getUserLocations($param) |
104 | - { |
|
105 | - $response = Route4Me::makeRequst(array( |
|
106 | - 'url' => self::$apiUserLocations, |
|
107 | - 'method' => 'GET', |
|
108 | - 'query' => array( |
|
109 | - 'query' => $param |
|
104 | + { |
|
105 | + $response = Route4Me::makeRequst(array( |
|
106 | + 'url' => self::$apiUserLocations, |
|
107 | + 'method' => 'GET', |
|
108 | + 'query' => array( |
|
109 | + 'query' => $param |
|
110 | 110 | ) |
111 | - )); |
|
111 | + )); |
|
112 | 112 | //var_dump($response); die(""); |
113 | 113 | return $response; |
114 | 114 | } |
115 | 115 | |
116 | 116 | public static function addDeviceRecord($body) |
117 | - { |
|
118 | - $response = Route4Me::makeRequst(array( |
|
119 | - 'url' => self::$apiUrlDevice, |
|
120 | - 'method' => 'POST', |
|
121 | - 'body' => array( |
|
117 | + { |
|
118 | + $response = Route4Me::makeRequst(array( |
|
119 | + 'url' => self::$apiUrlDevice, |
|
120 | + 'method' => 'POST', |
|
121 | + 'body' => array( |
|
122 | 122 | 'device_id' => isset($body->device_id) ? $body->device_id: null, |
123 | - 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
124 | - 'format' => isset($body->format) ? $body->format : null |
|
123 | + 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
124 | + 'format' => isset($body->format) ? $body->format : null |
|
125 | 125 | ) |
126 | 126 | |
127 | 127 | )); |
@@ -129,25 +129,25 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | public static function createMember($body) |
132 | - { |
|
133 | - $response = Route4Me::makeRequst(array( |
|
134 | - 'url' => self::$apiUrl, |
|
135 | - 'method' => 'POST', |
|
136 | - 'body' => array( |
|
132 | + { |
|
133 | + $response = Route4Me::makeRequst(array( |
|
134 | + 'url' => self::$apiUrl, |
|
135 | + 'method' => 'POST', |
|
136 | + 'body' => array( |
|
137 | 137 | 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES: null, |
138 | - 'member_phone' => isset($body->member_phone) ? $body->member_phone : null, |
|
139 | - 'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null, |
|
140 | - 'route_count' => isset($body->route_count) ? $body->route_count : null, |
|
141 | - 'member_email' => isset($body->member_email) ? $body->member_email : null, |
|
142 | - 'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null, |
|
143 | - 'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null, |
|
144 | - 'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null, |
|
145 | - 'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null, |
|
146 | - 'member_password' => isset($body->member_password) ? $body->member_password : null, |
|
147 | - 'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null, |
|
148 | - 'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null, |
|
149 | - 'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null, |
|
150 | - 'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null |
|
138 | + 'member_phone' => isset($body->member_phone) ? $body->member_phone : null, |
|
139 | + 'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null, |
|
140 | + 'route_count' => isset($body->route_count) ? $body->route_count : null, |
|
141 | + 'member_email' => isset($body->member_email) ? $body->member_email : null, |
|
142 | + 'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null, |
|
143 | + 'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null, |
|
144 | + 'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null, |
|
145 | + 'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null, |
|
146 | + 'member_password' => isset($body->member_password) ? $body->member_password : null, |
|
147 | + 'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null, |
|
148 | + 'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null, |
|
149 | + 'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null, |
|
150 | + 'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null |
|
151 | 151 | ) |
152 | 152 | |
153 | 153 | )); |
@@ -155,26 +155,26 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | public static function updateMember($body) |
158 | - { |
|
159 | - $response = Route4Me::makeRequst(array( |
|
160 | - 'url' => self::$apiUrl, |
|
161 | - 'method' => 'PUT', |
|
162 | - 'body' => array( |
|
158 | + { |
|
159 | + $response = Route4Me::makeRequst(array( |
|
160 | + 'url' => self::$apiUrl, |
|
161 | + 'method' => 'PUT', |
|
162 | + 'body' => array( |
|
163 | 163 | 'member_id' => isset($body->member_id) ? $body->member_id: null, |
164 | - 'member_phone' => isset($body->member_phone) ? $body->member_phone : null, |
|
165 | - 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES: null, |
|
166 | - 'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null, |
|
167 | - 'route_count' => isset($body->route_count) ? $body->route_count : null, |
|
168 | - 'member_email' => isset($body->member_email) ? $body->member_email : null, |
|
169 | - 'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null, |
|
170 | - 'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null, |
|
171 | - 'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null, |
|
172 | - 'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null, |
|
173 | - 'member_password' => isset($body->member_password) ? $body->member_password : null, |
|
174 | - 'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null, |
|
175 | - 'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null, |
|
176 | - 'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null, |
|
177 | - 'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null |
|
164 | + 'member_phone' => isset($body->member_phone) ? $body->member_phone : null, |
|
165 | + 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES: null, |
|
166 | + 'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null, |
|
167 | + 'route_count' => isset($body->route_count) ? $body->route_count : null, |
|
168 | + 'member_email' => isset($body->member_email) ? $body->member_email : null, |
|
169 | + 'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null, |
|
170 | + 'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null, |
|
171 | + 'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null, |
|
172 | + 'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null, |
|
173 | + 'member_password' => isset($body->member_password) ? $body->member_password : null, |
|
174 | + 'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null, |
|
175 | + 'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null, |
|
176 | + 'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null, |
|
177 | + 'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null |
|
178 | 178 | ) |
179 | 179 | |
180 | 180 | )); |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | public static function deleteMember($body) |
185 | - { |
|
186 | - $response = Route4Me::makeRequst(array( |
|
187 | - 'url' => self::$apiUrl, |
|
188 | - 'method' => 'DELETE', |
|
189 | - 'body' => array( |
|
185 | + { |
|
186 | + $response = Route4Me::makeRequst(array( |
|
187 | + 'url' => self::$apiUrl, |
|
188 | + 'method' => 'DELETE', |
|
189 | + 'body' => array( |
|
190 | 190 | 'member_id' => isset($body->member_id) ? $body->member_id: null |
191 | 191 | ) |
192 | 192 | |
@@ -195,50 +195,50 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | public static function newAccountRegistration($body) |
198 | - { |
|
199 | - $response = Route4Me::makeRequst(array( |
|
200 | - 'url' => self::$apiUrlRegistr, |
|
201 | - 'method' => 'POST', |
|
202 | - 'body' => array( |
|
198 | + { |
|
199 | + $response = Route4Me::makeRequst(array( |
|
200 | + 'url' => self::$apiUrlRegistr, |
|
201 | + 'method' => 'POST', |
|
202 | + 'body' => array( |
|
203 | 203 | 'strEmail' => isset($body->strEmail) ? $body->strEmail: null, |
204 | - 'strPassword_1' => isset($body->strPassword_1) ? $body->strPassword_1 : null, |
|
205 | - 'strPassword_2' => isset($body->strPassword_2) ? $body->strPassword_2 : null, |
|
206 | - 'strFirstName' => isset($body->strFirstName) ? $body->strFirstName: null, |
|
207 | - 'strLastName' => isset($body->strLastName) ? $body->strLastName: null, |
|
208 | - 'strIndustry' => isset($body->strIndustry) ? $body->strIndustry: null, |
|
209 | - 'chkTerms' => isset($body->chkTerms) ? $body->chkTerms: null, |
|
210 | - 'plan' => isset($body->plan) ? $body->plan: null, |
|
211 | - 'strSubAccountType' => isset($body->strSubAccountType) ? $body->strSubAccountType: null, |
|
212 | - 'blDisableMarketing' => isset($body->blDisableMarketing) ? $body->blDisableMarketing: false, |
|
213 | - 'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) ? $body->blDisableAccountActivationEmail: false |
|
204 | + 'strPassword_1' => isset($body->strPassword_1) ? $body->strPassword_1 : null, |
|
205 | + 'strPassword_2' => isset($body->strPassword_2) ? $body->strPassword_2 : null, |
|
206 | + 'strFirstName' => isset($body->strFirstName) ? $body->strFirstName: null, |
|
207 | + 'strLastName' => isset($body->strLastName) ? $body->strLastName: null, |
|
208 | + 'strIndustry' => isset($body->strIndustry) ? $body->strIndustry: null, |
|
209 | + 'chkTerms' => isset($body->chkTerms) ? $body->chkTerms: null, |
|
210 | + 'plan' => isset($body->plan) ? $body->plan: null, |
|
211 | + 'strSubAccountType' => isset($body->strSubAccountType) ? $body->strSubAccountType: null, |
|
212 | + 'blDisableMarketing' => isset($body->blDisableMarketing) ? $body->blDisableMarketing: false, |
|
213 | + 'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) ? $body->blDisableAccountActivationEmail: false |
|
214 | 214 | ) |
215 | 215 | )); |
216 | 216 | return $response; |
217 | 217 | } |
218 | 218 | |
219 | 219 | public static function validateSession($params) |
220 | - { |
|
221 | - $response = Route4Me::makeRequst(array( |
|
222 | - 'url' => self::$apiUrlSessValid, |
|
223 | - 'method' => 'GET', |
|
224 | - 'query' => array( |
|
220 | + { |
|
221 | + $response = Route4Me::makeRequst(array( |
|
222 | + 'url' => self::$apiUrlSessValid, |
|
223 | + 'method' => 'GET', |
|
224 | + 'query' => array( |
|
225 | 225 | 'session_guid' => isset($params->session_guid) ? $params->session_guid: null, |
226 | - 'member_id' => isset($params->member_id) ? $params->member_id : null, |
|
227 | - 'format' => isset($params->format) ? $params->format : null |
|
226 | + 'member_id' => isset($params->member_id) ? $params->member_id : null, |
|
227 | + 'format' => isset($params->format) ? $params->format : null |
|
228 | 228 | ) |
229 | 229 | )); |
230 | 230 | return $response; |
231 | 231 | } |
232 | 232 | |
233 | 233 | public static function memberAuthentication($body) |
234 | - { |
|
235 | - $response = Route4Me::makeRequst(array( |
|
236 | - 'url' => self::$apiUrlAuthen, |
|
237 | - 'method' => 'POST', |
|
238 | - 'body' => array( |
|
234 | + { |
|
235 | + $response = Route4Me::makeRequst(array( |
|
236 | + 'url' => self::$apiUrlAuthen, |
|
237 | + 'method' => 'POST', |
|
238 | + 'body' => array( |
|
239 | 239 | 'strEmail' => isset($body->strEmail) ? $body->strEmail: null, |
240 | - 'strPassword' => isset($body->strPassword) ? $body->strPassword : null, |
|
241 | - 'format' => isset($body->format) ? $body->format : null |
|
240 | + 'strPassword' => isset($body->strPassword) ? $body->strPassword : null, |
|
241 | + 'format' => isset($body->format) ? $body->format : null |
|
242 | 242 | ) |
243 | 243 | |
244 | 244 | )); |
@@ -246,18 +246,18 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | public static function webinarRegistration($body) |
249 | - { |
|
250 | - $response = Route4Me::makeRequst(array( |
|
251 | - 'url' => self::$apiUrlWebinar, |
|
252 | - 'method' => 'POST', |
|
253 | - 'body' => array( |
|
249 | + { |
|
250 | + $response = Route4Me::makeRequst(array( |
|
251 | + 'url' => self::$apiUrlWebinar, |
|
252 | + 'method' => 'POST', |
|
253 | + 'body' => array( |
|
254 | 254 | 'email_address' => isset($body->email_address) ? $body->email_address: null, |
255 | - 'first_name' => isset($body->first_name) ? $body->first_name : null, |
|
256 | - 'last_name' => isset($body->last_name) ? $body->last_name : null, |
|
257 | - 'phone_number' => isset($body->phone_number) ? $body->phone_number : null, |
|
258 | - 'phone_number' => isset($body->phone_number) ? $body->phone_number : null, |
|
259 | - 'member_id' => isset($body->member_id) ? $body->member_id : null, |
|
260 | - 'webiinar_date' => isset($body->webiinar_date) ? $body->webiinar_date : null, |
|
255 | + 'first_name' => isset($body->first_name) ? $body->first_name : null, |
|
256 | + 'last_name' => isset($body->last_name) ? $body->last_name : null, |
|
257 | + 'phone_number' => isset($body->phone_number) ? $body->phone_number : null, |
|
258 | + 'phone_number' => isset($body->phone_number) ? $body->phone_number : null, |
|
259 | + 'member_id' => isset($body->member_id) ? $body->member_id : null, |
|
260 | + 'webiinar_date' => isset($body->webiinar_date) ? $body->webiinar_date : null, |
|
261 | 261 | ) |
262 | 262 | |
263 | 263 | )); |
@@ -265,19 +265,19 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | public static function purchaseUserLicense($body) |
268 | - { |
|
269 | - $response = Route4Me::makeRequst(array( |
|
270 | - 'url' => self::$apiUrlLicense, |
|
271 | - 'method' => 'POST', |
|
272 | - 'body' => array( |
|
268 | + { |
|
269 | + $response = Route4Me::makeRequst(array( |
|
270 | + 'url' => self::$apiUrlLicense, |
|
271 | + 'method' => 'POST', |
|
272 | + 'body' => array( |
|
273 | 273 | 'member_id' => isset($body->member_id) ? $body->member_id: null, |
274 | - 'session_guid' => isset($body->session_guid) ? $body->session_guid : null, |
|
275 | - 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
276 | - 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
277 | - 'subscription_name' => isset($body->subscription_name) ? $body->subscription_name : null, |
|
278 | - 'token' => isset($body->token) ? $body->token : null, |
|
279 | - 'payload' => isset($body->payload) ? $body->payload : null, |
|
280 | - 'format' => isset($body->format) ? $body->format : null, |
|
274 | + 'session_guid' => isset($body->session_guid) ? $body->session_guid : null, |
|
275 | + 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
276 | + 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
277 | + 'subscription_name' => isset($body->subscription_name) ? $body->subscription_name : null, |
|
278 | + 'token' => isset($body->token) ? $body->token : null, |
|
279 | + 'payload' => isset($body->payload) ? $body->payload : null, |
|
280 | + 'format' => isset($body->format) ? $body->format : null, |
|
281 | 281 | ) |
282 | 282 | |
283 | 283 | )); |
@@ -285,24 +285,24 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | public static function newMemberConfigKey($body) |
288 | - { |
|
289 | - $response = Route4Me::makeRequst(array( |
|
290 | - 'url' => self::$apiMemberConfig, |
|
291 | - 'method' => 'POST', |
|
292 | - 'body' => array( |
|
288 | + { |
|
289 | + $response = Route4Me::makeRequst(array( |
|
290 | + 'url' => self::$apiMemberConfig, |
|
291 | + 'method' => 'POST', |
|
292 | + 'body' => array( |
|
293 | 293 | 'config_key' => isset($body->config_key) ? $body->config_key: null, |
294 | - 'config_value' => isset($body->config_value) ? $body->config_value : null |
|
294 | + 'config_value' => isset($body->config_value) ? $body->config_value : null |
|
295 | 295 | ) |
296 | 296 | )); |
297 | 297 | return $response; |
298 | 298 | } |
299 | 299 | |
300 | 300 | public static function removeMemberConfigKey($body) |
301 | - { |
|
302 | - $response = Route4Me::makeRequst(array( |
|
303 | - 'url' => self::$apiMemberConfig, |
|
304 | - 'method' => 'DELETE', |
|
305 | - 'body' => array( |
|
301 | + { |
|
302 | + $response = Route4Me::makeRequst(array( |
|
303 | + 'url' => self::$apiMemberConfig, |
|
304 | + 'method' => 'DELETE', |
|
305 | + 'body' => array( |
|
306 | 306 | 'config_key' => isset($body->config_key) ? $body->config_key: null |
307 | 307 | ) |
308 | 308 | )); |
@@ -310,11 +310,11 @@ discard block |
||
310 | 310 | } |
311 | 311 | |
312 | 312 | public static function getMemberConfigData($body) |
313 | - { |
|
314 | - $response = Route4Me::makeRequst(array( |
|
315 | - 'url' => self::$apiMemberConfig, |
|
316 | - 'method' => 'GET', |
|
317 | - 'query' => array( |
|
313 | + { |
|
314 | + $response = Route4Me::makeRequst(array( |
|
315 | + 'url' => self::$apiMemberConfig, |
|
316 | + 'method' => 'GET', |
|
317 | + 'query' => array( |
|
318 | 318 | 'config_key' => isset($body->config_key) ? $body->config_key: null |
319 | 319 | ) |
320 | 320 | )); |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | } |
323 | 323 | |
324 | 324 | public static function updateMemberConfigKey($body) |
325 | - { |
|
326 | - $response = Route4Me::makeRequst(array( |
|
327 | - 'url' => self::$apiMemberConfig, |
|
328 | - 'method' => 'PUT', |
|
329 | - 'body' => array( |
|
325 | + { |
|
326 | + $response = Route4Me::makeRequst(array( |
|
327 | + 'url' => self::$apiMemberConfig, |
|
328 | + 'method' => 'PUT', |
|
329 | + 'body' => array( |
|
330 | 330 | 'config_key' => isset($body->config_key) ? $body->config_key: null, |
331 | - 'config_value' => isset($body->config_value) ? $body->config_value : null |
|
331 | + 'config_value' => isset($body->config_value) ? $body->config_value : null |
|
332 | 332 | ) |
333 | 333 | )); |
334 | 334 | return $response; |
@@ -43,21 +43,21 @@ discard block |
||
43 | 43 | $locationsFieldsMapping['monthly_nth_wwhat']=17; |
44 | 44 | |
45 | 45 | if (($handle = fopen("$source_file", "r")) !== FALSE) { |
46 | - $oAbook = new AddressBookLocation(); |
|
46 | + $oAbook = new AddressBookLocation(); |
|
47 | 47 | |
48 | - $results=$oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping); //Temporarry |
|
48 | + $results=$oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping); //Temporarry |
|
49 | 49 | |
50 | - echo "Errors: <br><br>"; |
|
51 | - foreach ($results['fail'] as $evalue) { |
|
52 | - echo $evalue."<br>"; |
|
53 | - } |
|
50 | + echo "Errors: <br><br>"; |
|
51 | + foreach ($results['fail'] as $evalue) { |
|
52 | + echo $evalue."<br>"; |
|
53 | + } |
|
54 | 54 | |
55 | - echo "Successes: <br><br>"; |
|
56 | - foreach ($results['success'] as $svalue) { |
|
57 | - echo $svalue."<br>"; |
|
58 | - } |
|
55 | + echo "Successes: <br><br>"; |
|
56 | + foreach ($results['success'] as $svalue) { |
|
57 | + echo $svalue."<br>"; |
|
58 | + } |
|
59 | 59 | |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | 62 | /* Add orders with schedules from a CSV file */ |
63 | 63 | |
@@ -76,91 +76,91 @@ discard block |
||
76 | 76 | $ordersFieldsMapping['day_scheduled_for_YYMMDD']=8; |
77 | 77 | |
78 | 78 | if (($handle = fopen("$orders_file", "r")) !== FALSE) { |
79 | - $order = new Order(); |
|
80 | - $results=$order->addOrdersFromCsvFile($handle, $ordersFieldsMapping); |
|
79 | + $order = new Order(); |
|
80 | + $results=$order->addOrdersFromCsvFile($handle, $ordersFieldsMapping); |
|
81 | 81 | |
82 | - echo "Errors: <br><br>"; |
|
83 | - foreach ($results['fail'] as $evalue) { |
|
84 | - echo $evalue."<br>"; |
|
85 | - } |
|
82 | + echo "Errors: <br><br>"; |
|
83 | + foreach ($results['fail'] as $evalue) { |
|
84 | + echo $evalue."<br>"; |
|
85 | + } |
|
86 | 86 | |
87 | - echo "Successes: <br><br>"; |
|
88 | - foreach ($results['success'] as $svalue) { |
|
89 | - echo $svalue."<br>"; |
|
90 | - } |
|
87 | + echo "Successes: <br><br>"; |
|
88 | + foreach ($results['success'] as $svalue) { |
|
89 | + echo $svalue."<br>"; |
|
90 | + } |
|
91 | 91 | |
92 | - } |
|
92 | + } |
|
93 | 93 | |
94 | 94 | /* Get Hybrid Optimization */ |
95 | 95 | |
96 | - $ep = time()+604800; |
|
97 | - $sched_date = date("Y-m-d", $ep); |
|
96 | + $ep = time()+604800; |
|
97 | + $sched_date = date("Y-m-d", $ep); |
|
98 | 98 | |
99 | - $hybridParams = array( |
|
100 | - "target_date_string" => $sched_date, |
|
101 | - "timezone_offset_minutes" => 480 |
|
102 | - ); |
|
99 | + $hybridParams = array( |
|
100 | + "target_date_string" => $sched_date, |
|
101 | + "timezone_offset_minutes" => 480 |
|
102 | + ); |
|
103 | 103 | |
104 | - $optimization = new OptimizationProblem(); |
|
105 | - $hybridOptimization = $optimization->getHybridOptimization($hybridParams); |
|
104 | + $optimization = new OptimizationProblem(); |
|
105 | + $hybridOptimization = $optimization->getHybridOptimization($hybridParams); |
|
106 | 106 | |
107 | - if ($hybridOptimization!=null) { |
|
107 | + if ($hybridOptimization!=null) { |
|
108 | 108 | |
109 | - if (isset($hybridOptimization['optimization_problem_id'])) { |
|
110 | - $optid = $hybridOptimization['optimization_problem_id']; |
|
109 | + if (isset($hybridOptimization['optimization_problem_id'])) { |
|
110 | + $optid = $hybridOptimization['optimization_problem_id']; |
|
111 | 111 | |
112 | - echo "Hibrid optimization with optimization_problem_id=$optid <br><br>"; |
|
112 | + echo "Hibrid optimization with optimization_problem_id=$optid <br><br>"; |
|
113 | 113 | |
114 | - /* Add depots to the Hybrid Optimization */ |
|
115 | - $depotfile = "depots.csv"; |
|
114 | + /* Add depots to the Hybrid Optimization */ |
|
115 | + $depotfile = "depots.csv"; |
|
116 | 116 | |
117 | - if (($handle = fopen("$depotfile", "r")) !== FALSE) { |
|
117 | + if (($handle = fopen("$depotfile", "r")) !== FALSE) { |
|
118 | 118 | |
119 | - $columns = fgetcsv($handle, $max_line_length, $delemietr); |
|
119 | + $columns = fgetcsv($handle, $max_line_length, $delemietr); |
|
120 | 120 | |
121 | - if (!$columns) { |
|
122 | - $error['message'] = 'Empty'; |
|
123 | - return ($error); |
|
124 | - } |
|
121 | + if (!$columns) { |
|
122 | + $error['message'] = 'Empty'; |
|
123 | + return ($error); |
|
124 | + } |
|
125 | 125 | |
126 | - $depotsParams = array( |
|
127 | - 'optimization_problem_id' => $optid, |
|
128 | - 'delete_old_depots' => true, |
|
129 | - ); |
|
126 | + $depotsParams = array( |
|
127 | + 'optimization_problem_id' => $optid, |
|
128 | + 'delete_old_depots' => true, |
|
129 | + ); |
|
130 | 130 | |
131 | - $iRow=1; |
|
132 | - $depotAddresses = array(); |
|
131 | + $iRow=1; |
|
132 | + $depotAddresses = array(); |
|
133 | 133 | |
134 | - while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) { |
|
135 | - if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) { |
|
136 | - $depotAddress['lat']= $rows[0]; |
|
137 | - $depotAddress['lng']= $rows[1]; |
|
138 | - $depotAddress['address']= $rows[3]; |
|
139 | - array_push($depotAddresses,$depotAddress); |
|
140 | - } |
|
141 | - } |
|
134 | + while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) { |
|
135 | + if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) { |
|
136 | + $depotAddress['lat']= $rows[0]; |
|
137 | + $depotAddress['lng']= $rows[1]; |
|
138 | + $depotAddress['address']= $rows[3]; |
|
139 | + array_push($depotAddresses,$depotAddress); |
|
140 | + } |
|
141 | + } |
|
142 | 142 | |
143 | - $depotsParams['new_depots'] = $depotAddresses; |
|
143 | + $depotsParams['new_depots'] = $depotAddresses; |
|
144 | 144 | |
145 | - $optProblem = new OptimizationProblem(); |
|
145 | + $optProblem = new OptimizationProblem(); |
|
146 | 146 | |
147 | - $resultDepots = $optProblem->addDepotsToHybrid($depotsParams); |
|
147 | + $resultDepots = $optProblem->addDepotsToHybrid($depotsParams); |
|
148 | 148 | |
149 | - var_dump($resultDepots); |
|
149 | + var_dump($resultDepots); |
|
150 | 150 | |
151 | - /* Reoptimize hybrid optimization */ |
|
151 | + /* Reoptimize hybrid optimization */ |
|
152 | 152 | |
153 | - if ($resultDepots!=null) { |
|
154 | - $problemParams = array( |
|
155 | - 'optimization_problem_id' => $optid |
|
156 | - ); |
|
157 | - $problem = OptimizationProblem::reoptimize($problemParams); |
|
153 | + if ($resultDepots!=null) { |
|
154 | + $problemParams = array( |
|
155 | + 'optimization_problem_id' => $optid |
|
156 | + ); |
|
157 | + $problem = OptimizationProblem::reoptimize($problemParams); |
|
158 | 158 | |
159 | - Route4Me::simplePrint($problem); |
|
160 | - } |
|
161 | - } |
|
159 | + Route4Me::simplePrint($problem); |
|
160 | + } |
|
161 | + } |
|
162 | 162 | |
163 | - } |
|
163 | + } |
|
164 | 164 | |
165 | - } |
|
165 | + } |
|
166 | 166 | ?> |
167 | 167 | \ No newline at end of file |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | static public $apiUrlOpt = '/api.v4/optimization_problem.php'; |
11 | 11 | |
12 | 12 | public $address_1; |
13 | - public $address_2; |
|
13 | + public $address_2; |
|
14 | 14 | public $cached_lat; |
15 | 15 | public $cached_lng; |
16 | - public $curbside_lat; |
|
17 | - public $curbside_lng; |
|
16 | + public $curbside_lat; |
|
17 | + public $curbside_lng; |
|
18 | 18 | public $address_alias; |
19 | 19 | public $address_city; |
20 | 20 | public $EXT_FIELD_first_name; |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | public $EXT_FIELD_phone; |
24 | 24 | public $EXT_FIELD_custom_data; |
25 | 25 | |
26 | - public $color; |
|
27 | - public $order_icon; |
|
28 | - public $local_time_window_start; |
|
29 | - public $local_time_window_end; |
|
30 | - public $local_time_window_start_2; |
|
31 | - public $local_time_window_end_2; |
|
32 | - public $service_time; |
|
26 | + public $color; |
|
27 | + public $order_icon; |
|
28 | + public $local_time_window_start; |
|
29 | + public $local_time_window_end; |
|
30 | + public $local_time_window_start_2; |
|
31 | + public $local_time_window_end_2; |
|
32 | + public $service_time; |
|
33 | 33 | |
34 | - public $day_scheduled_for_YYMMDD; |
|
34 | + public $day_scheduled_for_YYMMDD; |
|
35 | 35 | |
36 | 36 | public $route_id; |
37 | 37 | public $redirect; |
@@ -50,56 +50,56 @@ discard block |
||
50 | 50 | |
51 | 51 | public static function fromArray(array $params) { |
52 | 52 | $order= new Order(); |
53 | - foreach($params as $key => $value) { |
|
54 | - if (property_exists($order, $key)) { |
|
55 | - $order->{$key} = $value; |
|
56 | - } |
|
53 | + foreach($params as $key => $value) { |
|
54 | + if (property_exists($order, $key)) { |
|
55 | + $order->{$key} = $value; |
|
56 | + } |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $order; |
60 | 60 | } |
61 | 61 | |
62 | 62 | public static function addOrder($params) |
63 | - { |
|
64 | - $response = Route4Me::makeRequst(array( |
|
65 | - 'url' => self::$apiUrl, |
|
66 | - 'method' => 'POST', |
|
67 | - 'body' => array( |
|
63 | + { |
|
64 | + $response = Route4Me::makeRequst(array( |
|
65 | + 'url' => self::$apiUrl, |
|
66 | + 'method' => 'POST', |
|
67 | + 'body' => array( |
|
68 | 68 | 'address_1' => isset($params->address_1) ? $params->address_1: null, |
69 | 69 | 'address_2' => isset($params->address_2) ? $params->address_2: null, |
70 | - 'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null, |
|
71 | - 'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null, |
|
72 | - 'curbside_lat' => isset($params->curbside_lat) ? $params->curbside_lat : null, |
|
73 | - 'curbside_lng' => isset($params->curbside_lng) ? $params->curbside_lng : null, |
|
74 | - 'color' => isset($params->color) ? $params->color : null, |
|
75 | - 'order_icon' => isset($params->order_icon) ? $params->order_icon : null, |
|
76 | - 'day_scheduled_for_YYMMDD' => isset($params->day_scheduled_for_YYMMDD) ? $params->day_scheduled_for_YYMMDD : null, |
|
77 | - 'address_alias' => isset($params->address_alias) ? $params->address_alias : null, |
|
78 | - 'address_city' => isset($params->address_city) ? $params->address_city: null, |
|
79 | - 'local_time_window_start' => isset($params->local_time_window_start) ? $params->local_time_window_start: null, |
|
80 | - 'local_time_window_end' => isset($params->local_time_window_end) ? $params->local_time_window_end: null, |
|
81 | - 'local_time_window_start_2' => isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null, |
|
82 | - 'local_time_window_end_2' => isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null, |
|
83 | - 'service_time' => isset($params->service_time) ? $params->service_time: null, |
|
84 | - 'EXT_FIELD_first_name' => isset($params->EXT_FIELD_first_name) ? $params->EXT_FIELD_first_name: null, |
|
85 | - 'EXT_FIELD_last_name' => isset($params->EXT_FIELD_last_name) ? $params->EXT_FIELD_last_name: null, |
|
86 | - 'EXT_FIELD_email' => isset($params->EXT_FIELD_email) ? $params->EXT_FIELD_email: null, |
|
87 | - 'EXT_FIELD_phone' => isset($params->EXT_FIELD_phone) ? $params->EXT_FIELD_phone: null, |
|
88 | - 'EXT_FIELD_custom_data' => isset($params->EXT_FIELD_custom_data) ? $params->EXT_FIELD_custom_data: null, |
|
70 | + 'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null, |
|
71 | + 'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null, |
|
72 | + 'curbside_lat' => isset($params->curbside_lat) ? $params->curbside_lat : null, |
|
73 | + 'curbside_lng' => isset($params->curbside_lng) ? $params->curbside_lng : null, |
|
74 | + 'color' => isset($params->color) ? $params->color : null, |
|
75 | + 'order_icon' => isset($params->order_icon) ? $params->order_icon : null, |
|
76 | + 'day_scheduled_for_YYMMDD' => isset($params->day_scheduled_for_YYMMDD) ? $params->day_scheduled_for_YYMMDD : null, |
|
77 | + 'address_alias' => isset($params->address_alias) ? $params->address_alias : null, |
|
78 | + 'address_city' => isset($params->address_city) ? $params->address_city: null, |
|
79 | + 'local_time_window_start' => isset($params->local_time_window_start) ? $params->local_time_window_start: null, |
|
80 | + 'local_time_window_end' => isset($params->local_time_window_end) ? $params->local_time_window_end: null, |
|
81 | + 'local_time_window_start_2' => isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null, |
|
82 | + 'local_time_window_end_2' => isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null, |
|
83 | + 'service_time' => isset($params->service_time) ? $params->service_time: null, |
|
84 | + 'EXT_FIELD_first_name' => isset($params->EXT_FIELD_first_name) ? $params->EXT_FIELD_first_name: null, |
|
85 | + 'EXT_FIELD_last_name' => isset($params->EXT_FIELD_last_name) ? $params->EXT_FIELD_last_name: null, |
|
86 | + 'EXT_FIELD_email' => isset($params->EXT_FIELD_email) ? $params->EXT_FIELD_email: null, |
|
87 | + 'EXT_FIELD_phone' => isset($params->EXT_FIELD_phone) ? $params->EXT_FIELD_phone: null, |
|
88 | + 'EXT_FIELD_custom_data' => isset($params->EXT_FIELD_custom_data) ? $params->EXT_FIELD_custom_data: null, |
|
89 | 89 | ) |
90 | - )); |
|
90 | + )); |
|
91 | 91 | |
92 | 92 | return $response; |
93 | 93 | } |
94 | 94 | |
95 | 95 | public static function addOrder2Route($params,$body) |
96 | - { |
|
97 | - $response = Route4Me::makeRequst(array( |
|
98 | - 'url' => self::$apiUrlRoute, |
|
99 | - 'method' => 'PUT', |
|
100 | - 'query' => array( |
|
96 | + { |
|
97 | + $response = Route4Me::makeRequst(array( |
|
98 | + 'url' => self::$apiUrlRoute, |
|
99 | + 'method' => 'PUT', |
|
100 | + 'query' => array( |
|
101 | 101 | 'route_id' => isset($params->route_id) ? $params->route_id: null, |
102 | - 'redirect' => isset($params->redirect) ? $params->redirect : null |
|
102 | + 'redirect' => isset($params->redirect) ? $params->redirect : null |
|
103 | 103 | ), |
104 | 104 | 'body' => (array)$body |
105 | 105 | )); |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | public static function addOrder2Destination($params,$body) |
111 | - { |
|
112 | - $response = Route4Me::makeRequst(array( |
|
113 | - 'url' => self::$apiUrlOpt, |
|
114 | - 'method' => 'PUT', |
|
115 | - 'query' => array( |
|
111 | + { |
|
112 | + $response = Route4Me::makeRequst(array( |
|
113 | + 'url' => self::$apiUrlOpt, |
|
114 | + 'method' => 'PUT', |
|
115 | + 'query' => array( |
|
116 | 116 | 'optimization_problem_id' => isset($params->optimization_problem_id) ? $params->optimization_problem_id: null, |
117 | - 'redirect' => isset($params->redirect) ? $params->redirect : null |
|
117 | + 'redirect' => isset($params->redirect) ? $params->redirect : null |
|
118 | 118 | ), |
119 | 119 | 'body' => (array)$body |
120 | 120 | )); |
@@ -123,58 +123,58 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | public static function getOrder($params) |
126 | - { |
|
127 | - $response = Route4Me::makeRequst(array( |
|
128 | - 'url' => self::$apiUrl, |
|
129 | - 'method' => 'GET', |
|
130 | - 'query' => array( |
|
126 | + { |
|
127 | + $response = Route4Me::makeRequst(array( |
|
128 | + 'url' => self::$apiUrl, |
|
129 | + 'method' => 'GET', |
|
130 | + 'query' => array( |
|
131 | 131 | 'order_id' => isset($params->order_id) ? $params->order_id: null, |
132 | 132 | ) |
133 | - )); |
|
133 | + )); |
|
134 | 134 | |
135 | 135 | return $response; |
136 | 136 | } |
137 | 137 | |
138 | 138 | public static function getOrders() |
139 | - { |
|
140 | - $response = Route4Me::makeRequst(array( |
|
141 | - 'url' => self::$apiUrl, |
|
142 | - 'method' => 'GET' |
|
143 | - )); |
|
139 | + { |
|
140 | + $response = Route4Me::makeRequst(array( |
|
141 | + 'url' => self::$apiUrl, |
|
142 | + 'method' => 'GET' |
|
143 | + )); |
|
144 | 144 | |
145 | 145 | return $response; |
146 | 146 | } |
147 | 147 | |
148 | 148 | public static function removeOrder($params) |
149 | - { |
|
150 | - $response = Route4Me::makeRequst(array( |
|
151 | - 'url' => self::$apiUrl, |
|
152 | - 'method' => 'DELETE', |
|
153 | - 'body' => array( |
|
149 | + { |
|
150 | + $response = Route4Me::makeRequst(array( |
|
151 | + 'url' => self::$apiUrl, |
|
152 | + 'method' => 'DELETE', |
|
153 | + 'body' => array( |
|
154 | 154 | 'order_ids' => isset($params->order_ids) ? $params->order_ids: null |
155 | 155 | ) |
156 | - )); |
|
156 | + )); |
|
157 | 157 | |
158 | 158 | return $response; |
159 | 159 | } |
160 | 160 | |
161 | 161 | public static function updateOrder($body) |
162 | - { |
|
163 | - $response = Route4Me::makeRequst(array( |
|
164 | - 'url' => self::$apiUrl, |
|
165 | - 'method' => 'PUT', |
|
166 | - 'body' => (array)$body |
|
167 | - )); |
|
162 | + { |
|
163 | + $response = Route4Me::makeRequst(array( |
|
164 | + 'url' => self::$apiUrl, |
|
165 | + 'method' => 'PUT', |
|
166 | + 'body' => (array)$body |
|
167 | + )); |
|
168 | 168 | |
169 | 169 | return $response; |
170 | 170 | } |
171 | 171 | |
172 | 172 | public static function searchOrder($params) |
173 | - { |
|
174 | - $response = Route4Me::makeRequst(array( |
|
175 | - 'url' => self::$apiUrl, |
|
176 | - 'method' => 'GET', |
|
177 | - 'query' => array( |
|
173 | + { |
|
174 | + $response = Route4Me::makeRequst(array( |
|
175 | + 'url' => self::$apiUrl, |
|
176 | + 'method' => 'GET', |
|
177 | + 'query' => array( |
|
178 | 178 | 'day_added_YYMMDD' => isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD: null, |
179 | 179 | 'scheduled_for_YYMMDD' => isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD: null, |
180 | 180 | 'fields' => isset($params->fields) ? $params->fields: null, |
@@ -182,129 +182,129 @@ discard block |
||
182 | 182 | 'limit' => isset($params->limit) ? $params->limit: null, |
183 | 183 | 'query' => isset($params->query) ? $params->query: null, |
184 | 184 | ) |
185 | - )); |
|
185 | + )); |
|
186 | 186 | |
187 | 187 | return $response; |
188 | 188 | } |
189 | 189 | |
190 | - public static function validateLatitude($lat) |
|
191 | - { |
|
192 | - if (!is_numeric($lat)) return false; |
|
190 | + public static function validateLatitude($lat) |
|
191 | + { |
|
192 | + if (!is_numeric($lat)) return false; |
|
193 | 193 | |
194 | - if ($lat>90 || $lat<-90) return false; |
|
194 | + if ($lat>90 || $lat<-90) return false; |
|
195 | 195 | |
196 | - return true; |
|
197 | - } |
|
196 | + return true; |
|
197 | + } |
|
198 | 198 | |
199 | - public static function validateLongitude($lng) |
|
200 | - { |
|
201 | - if (!is_numeric($lng)) return false; |
|
199 | + public static function validateLongitude($lng) |
|
200 | + { |
|
201 | + if (!is_numeric($lng)) return false; |
|
202 | 202 | |
203 | - if ($lng>180 || $lng<-180) return false; |
|
203 | + if ($lng>180 || $lng<-180) return false; |
|
204 | 204 | |
205 | - return true; |
|
206 | - } |
|
205 | + return true; |
|
206 | + } |
|
207 | 207 | |
208 | - public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping) |
|
209 | - { |
|
210 | - $max_line_length = 512; |
|
211 | - $delemietr=','; |
|
208 | + public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping) |
|
209 | + { |
|
210 | + $max_line_length = 512; |
|
211 | + $delemietr=','; |
|
212 | 212 | |
213 | - $results=array(); |
|
214 | - $results['fail']=array(); |
|
215 | - $results['success']=array(); |
|
213 | + $results=array(); |
|
214 | + $results['fail']=array(); |
|
215 | + $results['success']=array(); |
|
216 | 216 | |
217 | - $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
|
217 | + $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
|
218 | 218 | |
219 | - if (!empty($columns)) { |
|
220 | - array_push($results['fail'],'Empty CSV table'); |
|
221 | - return ($results); |
|
222 | - } |
|
219 | + if (!empty($columns)) { |
|
220 | + array_push($results['fail'],'Empty CSV table'); |
|
221 | + return ($results); |
|
222 | + } |
|
223 | 223 | |
224 | - $iRow=1; |
|
224 | + $iRow=1; |
|
225 | 225 | |
226 | - while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) { |
|
227 | - if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null) !== $rows) { |
|
226 | + while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) { |
|
227 | + if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null) !== $rows) { |
|
228 | 228 | |
229 | - $cached_lat=0.000; |
|
229 | + $cached_lat=0.000; |
|
230 | 230 | |
231 | - if (!$this->validateLatitude($rows[$ordersFieldsMapping['cached_lat']])) { |
|
232 | - array_push($results['fail'],"$iRow --> Wrong cached_lat"); |
|
233 | - $iRow++; |
|
234 | - continue; |
|
235 | - } |
|
236 | - else $cached_lat=doubleval($rows[$ordersFieldsMapping['cached_lat']]); |
|
231 | + if (!$this->validateLatitude($rows[$ordersFieldsMapping['cached_lat']])) { |
|
232 | + array_push($results['fail'],"$iRow --> Wrong cached_lat"); |
|
233 | + $iRow++; |
|
234 | + continue; |
|
235 | + } |
|
236 | + else $cached_lat=doubleval($rows[$ordersFieldsMapping['cached_lat']]); |
|
237 | 237 | |
238 | - $cached_lng=0.000; |
|
238 | + $cached_lng=0.000; |
|
239 | 239 | |
240 | - if (!$this->validateLongitude($rows[$ordersFieldsMapping['cached_lng']])) { |
|
241 | - array_push($results['fail'],"$iRow --> Wrong cached_lng"); |
|
242 | - $iRow++; |
|
243 | - continue; |
|
244 | - } |
|
245 | - else $cached_lng=doubleval($rows[$ordersFieldsMapping['cached_lng']]); |
|
240 | + if (!$this->validateLongitude($rows[$ordersFieldsMapping['cached_lng']])) { |
|
241 | + array_push($results['fail'],"$iRow --> Wrong cached_lng"); |
|
242 | + $iRow++; |
|
243 | + continue; |
|
244 | + } |
|
245 | + else $cached_lng=doubleval($rows[$ordersFieldsMapping['cached_lng']]); |
|
246 | 246 | |
247 | - if (isset($ordersFieldsMapping['curbside_lat'])) { |
|
248 | - if (!$this->validateLatitude($rows[$ordersFieldsMapping['curbside_lat']])) { |
|
249 | - array_push($results['fail'],"$iRow --> Wrong curbside_lat"); |
|
250 | - $iRow++; |
|
251 | - continue; |
|
252 | - } |
|
253 | - } |
|
247 | + if (isset($ordersFieldsMapping['curbside_lat'])) { |
|
248 | + if (!$this->validateLatitude($rows[$ordersFieldsMapping['curbside_lat']])) { |
|
249 | + array_push($results['fail'],"$iRow --> Wrong curbside_lat"); |
|
250 | + $iRow++; |
|
251 | + continue; |
|
252 | + } |
|
253 | + } |
|
254 | 254 | |
255 | - if (isset($ordersFieldsMapping['curbside_lng'])) { |
|
256 | - if (!$this->validateLongitude($rows[$ordersFieldsMapping['curbside_lng']])) { |
|
257 | - array_push($results['fail'],"$iRow --> Wrong curbside_lng"); |
|
258 | - $iRow++; |
|
259 | - continue; |
|
260 | - } |
|
261 | - } |
|
255 | + if (isset($ordersFieldsMapping['curbside_lng'])) { |
|
256 | + if (!$this->validateLongitude($rows[$ordersFieldsMapping['curbside_lng']])) { |
|
257 | + array_push($results['fail'],"$iRow --> Wrong curbside_lng"); |
|
258 | + $iRow++; |
|
259 | + continue; |
|
260 | + } |
|
261 | + } |
|
262 | 262 | |
263 | - $address=$rows[$ordersFieldsMapping['address_1']]; |
|
263 | + $address=$rows[$ordersFieldsMapping['address_1']]; |
|
264 | 264 | |
265 | - if (isset($ordersFieldsMapping['order_city'])) $address.=', '.$rows[$ordersFieldsMapping['order_city']]; |
|
266 | - if (isset($ordersFieldsMapping['order_state_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_state_id']]; |
|
267 | - if (isset($ordersFieldsMapping['order_zip_code'])) $address.=', '.$rows[$ordersFieldsMapping['order_zip_code']]; |
|
268 | - if (isset($ordersFieldsMapping['order_country_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_country_id']]; |
|
265 | + if (isset($ordersFieldsMapping['order_city'])) $address.=', '.$rows[$ordersFieldsMapping['order_city']]; |
|
266 | + if (isset($ordersFieldsMapping['order_state_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_state_id']]; |
|
267 | + if (isset($ordersFieldsMapping['order_zip_code'])) $address.=', '.$rows[$ordersFieldsMapping['order_zip_code']]; |
|
268 | + if (isset($ordersFieldsMapping['order_country_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_country_id']]; |
|
269 | 269 | |
270 | - echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>"; |
|
270 | + echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>"; |
|
271 | 271 | |
272 | - $orderParameters = Order::fromArray(array( |
|
273 | - "cached_lat" => $cached_lat, |
|
274 | - "cached_lng" => $cached_lng, |
|
275 | - "curbside_lat" => isset($ordersFieldsMapping['curbside_lat']) ? $rows[$ordersFieldsMapping['curbside_lat']] : null, |
|
276 | - "curbside_lng" => isset($ordersFieldsMapping['curbside_lng']) ? $rows[$ordersFieldsMapping['curbside_lng']] : null, |
|
277 | - "color" => isset($ordersFieldsMapping['color']) ? $rows[$ordersFieldsMapping['color']] : null, |
|
278 | - "day_scheduled_for_YYMMDD" => isset($ordersFieldsMapping['day_scheduled_for_YYMMDD']) ? $rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']] : null, |
|
279 | - "address_alias" => isset($ordersFieldsMapping['address_alias']) ? $rows[$ordersFieldsMapping['address_alias']] : null, |
|
280 | - "address_1" => $address, |
|
281 | - "address_2" => isset($ordersFieldsMapping['address_2']) ? $rows[$ordersFieldsMapping['address_2']] : null, |
|
282 | - "local_time_window_start" => isset($ordersFieldsMapping['local_time_window_start']) ? $rows[$ordersFieldsMapping['local_time_window_start']] : null, |
|
283 | - "local_time_window_end" => isset($ordersFieldsMapping['local_time_window_end']) ? $rows[$ordersFieldsMapping['local_time_window_end']] : null, |
|
284 | - "local_time_window_start_2" => isset($ordersFieldsMapping['local_time_window_start_2']) ? $rows[$ordersFieldsMapping['local_time_window_start_2']] : null, |
|
285 | - "local_time_window_end_2" => isset($ordersFieldsMapping['local_time_window_end_2']) ? $rows[$ordersFieldsMapping['local_time_window_end_2']] : null, |
|
286 | - "service_time" => isset($ordersFieldsMapping['service_time']) ? $rows[$ordersFieldsMapping['service_time']] : null, |
|
287 | - "EXT_FIELD_first_name" => isset($ordersFieldsMapping['EXT_FIELD_first_name']) ? $rows[$ordersFieldsMapping['EXT_FIELD_first_name']] : null, |
|
288 | - "EXT_FIELD_last_name" => isset($ordersFieldsMapping['EXT_FIELD_last_name']) ? $rows[$ordersFieldsMapping['EXT_FIELD_last_name']] : null, |
|
289 | - "EXT_FIELD_email" => isset($ordersFieldsMapping['EXT_FIELD_email']) ? $rows[$ordersFieldsMapping['EXT_FIELD_email']] : null, |
|
290 | - "EXT_FIELD_phone" => isset($ordersFieldsMapping['EXT_FIELD_phone']) ? $rows[$ordersFieldsMapping['EXT_FIELD_phone']] : null, |
|
291 | - "EXT_FIELD_custom_data" => isset($ordersFieldsMapping['EXT_FIELD_custom_data']) ? $rows[$ordersFieldsMapping['EXT_FIELD_custom_data']] : null, |
|
292 | - "order_icon" => isset($ordersFieldsMapping['order_icon']) ? $rows[$ordersFieldsMapping['order_icon']] : null, |
|
293 | - )); |
|
272 | + $orderParameters = Order::fromArray(array( |
|
273 | + "cached_lat" => $cached_lat, |
|
274 | + "cached_lng" => $cached_lng, |
|
275 | + "curbside_lat" => isset($ordersFieldsMapping['curbside_lat']) ? $rows[$ordersFieldsMapping['curbside_lat']] : null, |
|
276 | + "curbside_lng" => isset($ordersFieldsMapping['curbside_lng']) ? $rows[$ordersFieldsMapping['curbside_lng']] : null, |
|
277 | + "color" => isset($ordersFieldsMapping['color']) ? $rows[$ordersFieldsMapping['color']] : null, |
|
278 | + "day_scheduled_for_YYMMDD" => isset($ordersFieldsMapping['day_scheduled_for_YYMMDD']) ? $rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']] : null, |
|
279 | + "address_alias" => isset($ordersFieldsMapping['address_alias']) ? $rows[$ordersFieldsMapping['address_alias']] : null, |
|
280 | + "address_1" => $address, |
|
281 | + "address_2" => isset($ordersFieldsMapping['address_2']) ? $rows[$ordersFieldsMapping['address_2']] : null, |
|
282 | + "local_time_window_start" => isset($ordersFieldsMapping['local_time_window_start']) ? $rows[$ordersFieldsMapping['local_time_window_start']] : null, |
|
283 | + "local_time_window_end" => isset($ordersFieldsMapping['local_time_window_end']) ? $rows[$ordersFieldsMapping['local_time_window_end']] : null, |
|
284 | + "local_time_window_start_2" => isset($ordersFieldsMapping['local_time_window_start_2']) ? $rows[$ordersFieldsMapping['local_time_window_start_2']] : null, |
|
285 | + "local_time_window_end_2" => isset($ordersFieldsMapping['local_time_window_end_2']) ? $rows[$ordersFieldsMapping['local_time_window_end_2']] : null, |
|
286 | + "service_time" => isset($ordersFieldsMapping['service_time']) ? $rows[$ordersFieldsMapping['service_time']] : null, |
|
287 | + "EXT_FIELD_first_name" => isset($ordersFieldsMapping['EXT_FIELD_first_name']) ? $rows[$ordersFieldsMapping['EXT_FIELD_first_name']] : null, |
|
288 | + "EXT_FIELD_last_name" => isset($ordersFieldsMapping['EXT_FIELD_last_name']) ? $rows[$ordersFieldsMapping['EXT_FIELD_last_name']] : null, |
|
289 | + "EXT_FIELD_email" => isset($ordersFieldsMapping['EXT_FIELD_email']) ? $rows[$ordersFieldsMapping['EXT_FIELD_email']] : null, |
|
290 | + "EXT_FIELD_phone" => isset($ordersFieldsMapping['EXT_FIELD_phone']) ? $rows[$ordersFieldsMapping['EXT_FIELD_phone']] : null, |
|
291 | + "EXT_FIELD_custom_data" => isset($ordersFieldsMapping['EXT_FIELD_custom_data']) ? $rows[$ordersFieldsMapping['EXT_FIELD_custom_data']] : null, |
|
292 | + "order_icon" => isset($ordersFieldsMapping['order_icon']) ? $rows[$ordersFieldsMapping['order_icon']] : null, |
|
293 | + )); |
|
294 | 294 | |
295 | - $order = new Order(); |
|
295 | + $order = new Order(); |
|
296 | 296 | |
297 | - $orderResults = $order->addOrder($orderParameters); |
|
297 | + $orderResults = $order->addOrder($orderParameters); |
|
298 | 298 | |
299 | - array_push($results['success'],"The order with order_id = ".strval($orderResults["order_id"])." added successfuly."); |
|
300 | - } |
|
301 | - else { |
|
302 | - array_push($results['fail'],"$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); |
|
303 | - } |
|
299 | + array_push($results['success'],"The order with order_id = ".strval($orderResults["order_id"])." added successfuly."); |
|
300 | + } |
|
301 | + else { |
|
302 | + array_push($results['fail'],"$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); |
|
303 | + } |
|
304 | 304 | |
305 | - $iRow++; |
|
306 | - } |
|
307 | - } |
|
305 | + $iRow++; |
|
306 | + } |
|
307 | + } |
|
308 | 308 | |
309 | 309 | } |
310 | 310 |
@@ -1,42 +1,42 @@ |
||
1 | 1 | <?php |
2 | - namespace Route4Me; |
|
3 | - |
|
4 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | - |
|
6 | - require $vdir.'/../vendor/autoload.php'; |
|
7 | - |
|
8 | - use Route4Me\Route4Me; |
|
9 | - use Route4Me\Order; |
|
10 | - |
|
11 | - // Set the api key in the Route4me class |
|
12 | - Route4Me::setApiKey('11111111111111111111111111111111'); |
|
13 | - |
|
14 | - $orderParameters=Order::fromArray(array( |
|
15 | - "address_1" => "318 S 39th St, Louisville, KY 40212, USA", |
|
16 | - "cached_lat" => 38.259326, |
|
17 | - "cached_lng" => -85.814979, |
|
18 | - "curbside_lat" => 38.259326, |
|
19 | - "curbside_lng" => -85.814979, |
|
20 | - "address_alias" => "318 S 39th St 40212", |
|
21 | - "address_city" => "Louisville", |
|
22 | - "EXT_FIELD_first_name" => "Lui", |
|
23 | - "EXT_FIELD_last_name" => "Carol", |
|
24 | - "EXT_FIELD_email" => "[email protected]", |
|
25 | - "EXT_FIELD_phone" => "897946541", |
|
26 | - "EXT_FIELD_custom_data" => array("order_type" => "scheduled order"), |
|
27 | - "day_scheduled_for_YYMMDD" => "2017-12-20", |
|
28 | - "local_time_window_end" => 39000, |
|
29 | - "local_time_window_end_2" => 46200, |
|
30 | - "local_time_window_start" => 37800, |
|
31 | - "local_time_window_start_2" => 45000, |
|
32 | - "local_timezone_string" => "America/New_York", |
|
33 | - "order_icon" => "emoji/emoji-bank" |
|
34 | - )); |
|
35 | - |
|
36 | - $order = new Order(); |
|
37 | - |
|
38 | - $response = $order->addOrder($orderParameters); |
|
39 | - |
|
40 | - Route4Me::simplePrint($response); |
|
2 | + namespace Route4Me; |
|
3 | + |
|
4 | + $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | + |
|
6 | + require $vdir.'/../vendor/autoload.php'; |
|
7 | + |
|
8 | + use Route4Me\Route4Me; |
|
9 | + use Route4Me\Order; |
|
10 | + |
|
11 | + // Set the api key in the Route4me class |
|
12 | + Route4Me::setApiKey('11111111111111111111111111111111'); |
|
13 | + |
|
14 | + $orderParameters=Order::fromArray(array( |
|
15 | + "address_1" => "318 S 39th St, Louisville, KY 40212, USA", |
|
16 | + "cached_lat" => 38.259326, |
|
17 | + "cached_lng" => -85.814979, |
|
18 | + "curbside_lat" => 38.259326, |
|
19 | + "curbside_lng" => -85.814979, |
|
20 | + "address_alias" => "318 S 39th St 40212", |
|
21 | + "address_city" => "Louisville", |
|
22 | + "EXT_FIELD_first_name" => "Lui", |
|
23 | + "EXT_FIELD_last_name" => "Carol", |
|
24 | + "EXT_FIELD_email" => "[email protected]", |
|
25 | + "EXT_FIELD_phone" => "897946541", |
|
26 | + "EXT_FIELD_custom_data" => array("order_type" => "scheduled order"), |
|
27 | + "day_scheduled_for_YYMMDD" => "2017-12-20", |
|
28 | + "local_time_window_end" => 39000, |
|
29 | + "local_time_window_end_2" => 46200, |
|
30 | + "local_time_window_start" => 37800, |
|
31 | + "local_time_window_start_2" => 45000, |
|
32 | + "local_timezone_string" => "America/New_York", |
|
33 | + "order_icon" => "emoji/emoji-bank" |
|
34 | + )); |
|
35 | + |
|
36 | + $order = new Order(); |
|
37 | + |
|
38 | + $response = $order->addOrder($orderParameters); |
|
39 | + |
|
40 | + Route4Me::simplePrint($response); |
|
41 | 41 | |
42 | 42 |
@@ -1,198 +1,198 @@ |
||
1 | 1 | <?php |
2 | - namespace Route4Me; |
|
2 | + namespace Route4Me; |
|
3 | 3 | |
4 | - $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
4 | + $vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/'; |
|
5 | 5 | |
6 | - require $vdir.'/../vendor/autoload.php'; |
|
6 | + require $vdir.'/../vendor/autoload.php'; |
|
7 | 7 | |
8 | - use Route4Me\Route4Me; |
|
9 | - use Route4Me\Route; |
|
8 | + use Route4Me\Route4Me; |
|
9 | + use Route4Me\Route; |
|
10 | 10 | |
11 | - // Set the api key in the Route4me class |
|
12 | - Route4Me::setApiKey('11111111111111111111111111111111'); |
|
11 | + // Set the api key in the Route4me class |
|
12 | + Route4Me::setApiKey('11111111111111111111111111111111'); |
|
13 | 13 | |
14 | - #region // Add a location, scheduled daily with custom data. |
|
15 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
16 | - "address_1" => "1604 PARKRIDGE PKWY, Louisville, KY, 40214", |
|
17 | - "address_alias" => "1604 PARKRIDGE PKWY 40214", |
|
18 | - "address_group" => "Scheduled daily", |
|
19 | - "first_name" => "Peter", |
|
20 | - "last_name" => "Newman", |
|
21 | - "address_email" => "[email protected]", |
|
22 | - "address_phone_number" => "65432178", |
|
23 | - "cached_lat" => 38.141598, |
|
24 | - "cached_lng" => -85.793846, |
|
25 | - "address_city" => "Louisville", |
|
26 | - "address_custom_data" => array("scheduled" => "yes", "serice type" => "publishing"), |
|
27 | - "schedule" => array(array( |
|
28 | - "enabled" => true, |
|
29 | - "mode" => "daily", |
|
30 | - "daily" => array("every" => 1) |
|
31 | - )), |
|
32 | - "service_time" => 900 |
|
33 | - )); |
|
14 | + #region // Add a location, scheduled daily with custom data. |
|
15 | + $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
16 | + "address_1" => "1604 PARKRIDGE PKWY, Louisville, KY, 40214", |
|
17 | + "address_alias" => "1604 PARKRIDGE PKWY 40214", |
|
18 | + "address_group" => "Scheduled daily", |
|
19 | + "first_name" => "Peter", |
|
20 | + "last_name" => "Newman", |
|
21 | + "address_email" => "[email protected]", |
|
22 | + "address_phone_number" => "65432178", |
|
23 | + "cached_lat" => 38.141598, |
|
24 | + "cached_lng" => -85.793846, |
|
25 | + "address_city" => "Louisville", |
|
26 | + "address_custom_data" => array("scheduled" => "yes", "serice type" => "publishing"), |
|
27 | + "schedule" => array(array( |
|
28 | + "enabled" => true, |
|
29 | + "mode" => "daily", |
|
30 | + "daily" => array("every" => 1) |
|
31 | + )), |
|
32 | + "service_time" => 900 |
|
33 | + )); |
|
34 | 34 | |
35 | - $abContacts1=new AddressBookLocation(); |
|
35 | + $abContacts1=new AddressBookLocation(); |
|
36 | 36 | |
37 | - $abcResults1=$abContacts1->addAdressBookLocation($AdressBookLocationParameters); |
|
37 | + $abcResults1=$abContacts1->addAdressBookLocation($AdressBookLocationParameters); |
|
38 | 38 | |
39 | - echo "address_id = ".strval($abcResults1["address_id"])."<br>"; |
|
39 | + echo "address_id = ".strval($abcResults1["address_id"])."<br>"; |
|
40 | 40 | |
41 | - Route4Me::simplePrint($abcResults1); |
|
42 | - #endregion |
|
43 | - |
|
44 | - #region // Add a location, scheduled weekly. |
|
45 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
46 | - "address_1" => "1407 MCCOY, Louisville, KY, 40215", |
|
47 | - "address_alias" => "1407 MCCOY 40215", |
|
48 | - "address_group" => "Scheduled weekly", |
|
49 | - "first_name" => "Bart", |
|
50 | - "last_name" => "Douglas", |
|
51 | - "address_email" => "[email protected]", |
|
52 | - "address_phone_number" => "95487454", |
|
53 | - "cached_lat" => 38.202496, |
|
54 | - "cached_lng" => -85.786514, |
|
55 | - "curbside_lat" => 38.202496, |
|
56 | - "curbside_lng" => -85.786514, |
|
57 | - "address_city" => "Louisville", |
|
58 | - "schedule" => array(array( |
|
59 | - "enabled" => true, |
|
60 | - "mode" => "weekly", |
|
61 | - "weekly" => array( |
|
62 | - "every" => 1, |
|
63 | - "weekdays" => array(1,2,3,4,5) |
|
64 | - ) |
|
65 | - )), |
|
66 | - "service_time" => 600 |
|
67 | - )); |
|
68 | - |
|
69 | - $abContacts2=new AddressBookLocation(); |
|
70 | - |
|
71 | - $abcResults2=$abContacts2->addAdressBookLocation($AdressBookLocationParameters); |
|
72 | - |
|
73 | - echo "address_id = ".strval($abcResults2["address_id"])."<br>"; |
|
74 | - |
|
75 | - Route4Me::simplePrint($abcResults2); |
|
76 | - #endregion |
|
77 | - |
|
78 | - #region // Add a location, scheduled monthly (dates mode). |
|
79 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
80 | - "address_1" => "4805 BELLEVUE AVE, Louisville, KY, 40215", |
|
81 | - "address_2" => "4806 BELLEVUE AVE, Louisville, KY, 40215", |
|
82 | - "address_alias" => "4805 BELLEVUE AVE 40215", |
|
83 | - "address_group" => "Scheduled monthly", |
|
84 | - "first_name" => "Bart", |
|
85 | - "last_name" => "Douglas", |
|
86 | - "address_email" => "[email protected]", |
|
87 | - "address_phone_number" => "95487454", |
|
88 | - "cached_lat" => 38.178844, |
|
89 | - "cached_lng" => -85.774864, |
|
90 | - "curbside_lat" => 38.178844, |
|
91 | - "curbside_lng" => -85.774864, |
|
92 | - "address_city" => "Louisville", |
|
93 | - "address_country_id" => "US", |
|
94 | - "address_state_id" => "KY", |
|
95 | - "address_zip" => "40215", |
|
96 | - "schedule" => array(array( |
|
97 | - "enabled" => true, |
|
98 | - "mode" => "monthly", |
|
99 | - "monthly" => array( |
|
100 | - "every" => 1, |
|
101 | - "mode" => "dates", |
|
102 | - "dates" => array(20,22,23,24,25) |
|
103 | - ) |
|
104 | - )), |
|
105 | - "service_time" => 750, |
|
106 | - "color" => "red" |
|
107 | - )); |
|
108 | - |
|
109 | - $abContacts3=new AddressBookLocation(); |
|
110 | - |
|
111 | - $abcResults3=$abContacts3->addAdressBookLocation($AdressBookLocationParameters); |
|
112 | - |
|
113 | - echo "address_id = ".strval($abcResults3["address_id"])."<br>"; |
|
114 | - |
|
115 | - Route4Me::simplePrint($abcResults3); |
|
116 | - |
|
117 | - #endregion |
|
118 | - |
|
119 | - #region // AAdd a location, scheduled monthly (nth mode). |
|
120 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
121 | - "address_1" => "730 CECIL AVENUE, Louisville, KY, 40211", |
|
122 | - "address_alias" => "730 CECIL AVENUE 40211", |
|
123 | - "address_group" => "Scheduled monthly", |
|
124 | - "first_name" => "David", |
|
125 | - "last_name" => "Silvester", |
|
126 | - "address_email" => "[email protected]", |
|
127 | - "address_phone_number" => "36985214", |
|
128 | - "cached_lat" => 38.248684, |
|
129 | - "cached_lng" => -85.821121, |
|
130 | - "curbside_lat" => 38.248684, |
|
131 | - "curbside_lng" => -85.821121, |
|
132 | - "address_city" => "Louisville", |
|
133 | - "address_custom_data" => array( |
|
134 | - "scheduled" => "yes", |
|
135 | - "service type" => "library" |
|
136 | - ), |
|
137 | - "schedule" => array(array( |
|
138 | - "enabled" => true, |
|
139 | - "mode" => "monthly", |
|
140 | - "monthly" => array( |
|
141 | - "every" => 1, |
|
142 | - "mode" => "nth", |
|
143 | - "nth" => array( |
|
144 | - "n" => 1, |
|
145 | - "what" => 4 |
|
146 | - ) |
|
147 | - ) |
|
148 | - )), |
|
149 | - "service_time" => 450, |
|
150 | - "address_icon" => "emoji/emoji-bus" |
|
151 | - )); |
|
152 | - |
|
153 | - $abContacts4=new AddressBookLocation(); |
|
154 | - |
|
155 | - $abcResults4=$abContacts4->addAdressBookLocation($AdressBookLocationParameters); |
|
156 | - |
|
157 | - echo "address_id = ".strval($abcResults4["address_id"])."<br>"; |
|
158 | - |
|
159 | - Route4Me::simplePrint($abcResults4); |
|
160 | - #endregion |
|
161 | - |
|
162 | - #region // Add a location with the daily scheduling and blacklist. |
|
163 | - $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
164 | - |
|
165 | - "address_1" => "4629 HILLSIDE DRIVE, Louisville, KY, 40216", |
|
166 | - "address_alias" => "4629 HILLSIDE DRIVE 40216", |
|
167 | - "address_group" => "Scheduled daily", |
|
168 | - "first_name" => "Kim", |
|
169 | - "last_name" => "Shandor", |
|
170 | - "address_email" => "[email protected]", |
|
171 | - "address_phone_number" => "9874152", |
|
172 | - "cached_lat" => 38.176067, |
|
173 | - "cached_lng" => -85.824638, |
|
174 | - "curbside_lat" => 38.176067, |
|
175 | - "curbside_lng" => -85.824638, |
|
176 | - "address_city" => "Louisville", |
|
177 | - "address_custom_data" => array( |
|
178 | - "scheduled" => "yes", |
|
179 | - "serice type" => "appliance" |
|
180 | - ), |
|
181 | - "schedule" => array( |
|
182 | - "enabled" => true, |
|
183 | - "mode" => "daily", |
|
184 | - "daily" => array("every" => 1) |
|
185 | - ), |
|
186 | - "schedule_blacklist" => array("2017-02-24","2017-02-25"), |
|
187 | - "service_time" => 300 |
|
188 | - )); |
|
189 | - |
|
190 | - $abContacts5=new AddressBookLocation(); |
|
191 | - |
|
192 | - $abcResults5=$abContacts5->addAdressBookLocation($AdressBookLocationParameters); |
|
193 | - |
|
194 | - echo "address_id = ".strval($abcResults5["address_id"])."<br>"; |
|
195 | - |
|
196 | - Route4Me::simplePrint($abcResults5); |
|
197 | - #endregion |
|
41 | + Route4Me::simplePrint($abcResults1); |
|
42 | + #endregion |
|
43 | + |
|
44 | + #region // Add a location, scheduled weekly. |
|
45 | + $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
46 | + "address_1" => "1407 MCCOY, Louisville, KY, 40215", |
|
47 | + "address_alias" => "1407 MCCOY 40215", |
|
48 | + "address_group" => "Scheduled weekly", |
|
49 | + "first_name" => "Bart", |
|
50 | + "last_name" => "Douglas", |
|
51 | + "address_email" => "[email protected]", |
|
52 | + "address_phone_number" => "95487454", |
|
53 | + "cached_lat" => 38.202496, |
|
54 | + "cached_lng" => -85.786514, |
|
55 | + "curbside_lat" => 38.202496, |
|
56 | + "curbside_lng" => -85.786514, |
|
57 | + "address_city" => "Louisville", |
|
58 | + "schedule" => array(array( |
|
59 | + "enabled" => true, |
|
60 | + "mode" => "weekly", |
|
61 | + "weekly" => array( |
|
62 | + "every" => 1, |
|
63 | + "weekdays" => array(1,2,3,4,5) |
|
64 | + ) |
|
65 | + )), |
|
66 | + "service_time" => 600 |
|
67 | + )); |
|
68 | + |
|
69 | + $abContacts2=new AddressBookLocation(); |
|
70 | + |
|
71 | + $abcResults2=$abContacts2->addAdressBookLocation($AdressBookLocationParameters); |
|
72 | + |
|
73 | + echo "address_id = ".strval($abcResults2["address_id"])."<br>"; |
|
74 | + |
|
75 | + Route4Me::simplePrint($abcResults2); |
|
76 | + #endregion |
|
77 | + |
|
78 | + #region // Add a location, scheduled monthly (dates mode). |
|
79 | + $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
80 | + "address_1" => "4805 BELLEVUE AVE, Louisville, KY, 40215", |
|
81 | + "address_2" => "4806 BELLEVUE AVE, Louisville, KY, 40215", |
|
82 | + "address_alias" => "4805 BELLEVUE AVE 40215", |
|
83 | + "address_group" => "Scheduled monthly", |
|
84 | + "first_name" => "Bart", |
|
85 | + "last_name" => "Douglas", |
|
86 | + "address_email" => "[email protected]", |
|
87 | + "address_phone_number" => "95487454", |
|
88 | + "cached_lat" => 38.178844, |
|
89 | + "cached_lng" => -85.774864, |
|
90 | + "curbside_lat" => 38.178844, |
|
91 | + "curbside_lng" => -85.774864, |
|
92 | + "address_city" => "Louisville", |
|
93 | + "address_country_id" => "US", |
|
94 | + "address_state_id" => "KY", |
|
95 | + "address_zip" => "40215", |
|
96 | + "schedule" => array(array( |
|
97 | + "enabled" => true, |
|
98 | + "mode" => "monthly", |
|
99 | + "monthly" => array( |
|
100 | + "every" => 1, |
|
101 | + "mode" => "dates", |
|
102 | + "dates" => array(20,22,23,24,25) |
|
103 | + ) |
|
104 | + )), |
|
105 | + "service_time" => 750, |
|
106 | + "color" => "red" |
|
107 | + )); |
|
108 | + |
|
109 | + $abContacts3=new AddressBookLocation(); |
|
110 | + |
|
111 | + $abcResults3=$abContacts3->addAdressBookLocation($AdressBookLocationParameters); |
|
112 | + |
|
113 | + echo "address_id = ".strval($abcResults3["address_id"])."<br>"; |
|
114 | + |
|
115 | + Route4Me::simplePrint($abcResults3); |
|
116 | + |
|
117 | + #endregion |
|
118 | + |
|
119 | + #region // AAdd a location, scheduled monthly (nth mode). |
|
120 | + $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
121 | + "address_1" => "730 CECIL AVENUE, Louisville, KY, 40211", |
|
122 | + "address_alias" => "730 CECIL AVENUE 40211", |
|
123 | + "address_group" => "Scheduled monthly", |
|
124 | + "first_name" => "David", |
|
125 | + "last_name" => "Silvester", |
|
126 | + "address_email" => "[email protected]", |
|
127 | + "address_phone_number" => "36985214", |
|
128 | + "cached_lat" => 38.248684, |
|
129 | + "cached_lng" => -85.821121, |
|
130 | + "curbside_lat" => 38.248684, |
|
131 | + "curbside_lng" => -85.821121, |
|
132 | + "address_city" => "Louisville", |
|
133 | + "address_custom_data" => array( |
|
134 | + "scheduled" => "yes", |
|
135 | + "service type" => "library" |
|
136 | + ), |
|
137 | + "schedule" => array(array( |
|
138 | + "enabled" => true, |
|
139 | + "mode" => "monthly", |
|
140 | + "monthly" => array( |
|
141 | + "every" => 1, |
|
142 | + "mode" => "nth", |
|
143 | + "nth" => array( |
|
144 | + "n" => 1, |
|
145 | + "what" => 4 |
|
146 | + ) |
|
147 | + ) |
|
148 | + )), |
|
149 | + "service_time" => 450, |
|
150 | + "address_icon" => "emoji/emoji-bus" |
|
151 | + )); |
|
152 | + |
|
153 | + $abContacts4=new AddressBookLocation(); |
|
154 | + |
|
155 | + $abcResults4=$abContacts4->addAdressBookLocation($AdressBookLocationParameters); |
|
156 | + |
|
157 | + echo "address_id = ".strval($abcResults4["address_id"])."<br>"; |
|
158 | + |
|
159 | + Route4Me::simplePrint($abcResults4); |
|
160 | + #endregion |
|
161 | + |
|
162 | + #region // Add a location with the daily scheduling and blacklist. |
|
163 | + $AdressBookLocationParameters=AddressBookLocation::fromArray(array( |
|
164 | + |
|
165 | + "address_1" => "4629 HILLSIDE DRIVE, Louisville, KY, 40216", |
|
166 | + "address_alias" => "4629 HILLSIDE DRIVE 40216", |
|
167 | + "address_group" => "Scheduled daily", |
|
168 | + "first_name" => "Kim", |
|
169 | + "last_name" => "Shandor", |
|
170 | + "address_email" => "[email protected]", |
|
171 | + "address_phone_number" => "9874152", |
|
172 | + "cached_lat" => 38.176067, |
|
173 | + "cached_lng" => -85.824638, |
|
174 | + "curbside_lat" => 38.176067, |
|
175 | + "curbside_lng" => -85.824638, |
|
176 | + "address_city" => "Louisville", |
|
177 | + "address_custom_data" => array( |
|
178 | + "scheduled" => "yes", |
|
179 | + "serice type" => "appliance" |
|
180 | + ), |
|
181 | + "schedule" => array( |
|
182 | + "enabled" => true, |
|
183 | + "mode" => "daily", |
|
184 | + "daily" => array("every" => 1) |
|
185 | + ), |
|
186 | + "schedule_blacklist" => array("2017-02-24","2017-02-25"), |
|
187 | + "service_time" => 300 |
|
188 | + )); |
|
189 | + |
|
190 | + $abContacts5=new AddressBookLocation(); |
|
191 | + |
|
192 | + $abcResults5=$abContacts5->addAdressBookLocation($AdressBookLocationParameters); |
|
193 | + |
|
194 | + echo "address_id = ".strval($abcResults5["address_id"])."<br>"; |
|
195 | + |
|
196 | + Route4Me::simplePrint($abcResults5); |
|
197 | + #endregion |
|
198 | 198 |