@@ -167,16 +167,16 @@ |
||
167 | 167 | $this->_deviceId = $device->MyQDeviceId; |
168 | 168 | foreach ($device->Attributes as $attr) { |
169 | 169 | switch ($attr->AttributeDisplayName) { |
170 | - case 'desc': |
|
171 | - $this->_doorName = $attr->Value; |
|
172 | - break; |
|
173 | - case 'doorstate': |
|
174 | - $this->_doorState = $attr->Value; |
|
175 | - // UpdatedTime is a timestamp in ms, so we truncate |
|
176 | - $this->_doorStateTime = (int)$attr->UpdatedTime / 1000; |
|
177 | - break; |
|
178 | - default: |
|
179 | - continue; |
|
170 | + case 'desc': |
|
171 | + $this->_doorName = $attr->Value; |
|
172 | + break; |
|
173 | + case 'doorstate': |
|
174 | + $this->_doorState = $attr->Value; |
|
175 | + // UpdatedTime is a timestamp in ms, so we truncate |
|
176 | + $this->_doorStateTime = (int)$attr->UpdatedTime / 1000; |
|
177 | + break; |
|
178 | + default: |
|
179 | + continue; |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |
@@ -204,6 +204,9 @@ |
||
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | + /** |
|
208 | + * @param string $url |
|
209 | + */ |
|
207 | 210 | public static function makeUrlRequst($url, $options) { |
208 | 211 | $method = isset($options['method']) ? $options['method'] : 'GET'; |
209 | 212 | $query = isset($options['query']) ? |
@@ -103,6 +103,9 @@ |
||
103 | 103 | return $ablocations; |
104 | 104 | } |
105 | 105 | |
106 | + /** |
|
107 | + * @param AddressBookLocation $params |
|
108 | + */ |
|
106 | 109 | public static function addAdressBookLocation($params) |
107 | 110 | { |
108 | 111 | $ablocations = Route4Me::makeRequst(array( |
@@ -327,62 +327,62 @@ |
||
327 | 327 | |
328 | 328 | if ($mode!='daily') { |
329 | 329 | switch ($mode) { |
330 | - case 'weekly': |
|
331 | - if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
332 | - if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
333 | - $curSchedule.='"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
334 | - } |
|
335 | - else {array_push($results['fail'],"$iRow --> Wrong weekdays"); $curSchedule="";} |
|
330 | + case 'weekly': |
|
331 | + if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
332 | + if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
333 | + $curSchedule.='"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
336 | 334 | } |
337 | - else {array_push($results['fail'],"$iRow --> The parameters sched_weekdays is not set"); $curSchedule="";} |
|
338 | - break; |
|
339 | - case 'monthly': |
|
340 | - $monthlyMode=""; |
|
341 | - if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
342 | - if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
343 | - $monthlyMode=$rows[$locationsFieldsMapping['monthly_mode']]; |
|
344 | - $curSchedule.='"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
345 | - } |
|
346 | - else {array_push($results['fail'],"$iRow --> Wrong monthly mode"); $curSchedule="";} |
|
335 | + else {array_push($results['fail'],"$iRow --> Wrong weekdays"); $curSchedule="";} |
|
336 | + } |
|
337 | + else {array_push($results['fail'],"$iRow --> The parameters sched_weekdays is not set"); $curSchedule="";} |
|
338 | + break; |
|
339 | + case 'monthly': |
|
340 | + $monthlyMode=""; |
|
341 | + if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
342 | + if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
343 | + $monthlyMode=$rows[$locationsFieldsMapping['monthly_mode']]; |
|
344 | + $curSchedule.='"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
347 | 345 | } |
348 | - else {array_push($results['fail'],"$iRow --> The parameter sched_monthly_mode is not set"); $curSchedule="";} |
|
346 | + else {array_push($results['fail'],"$iRow --> Wrong monthly mode"); $curSchedule="";} |
|
347 | + } |
|
348 | + else {array_push($results['fail'],"$iRow --> The parameter sched_monthly_mode is not set"); $curSchedule="";} |
|
349 | 349 | |
350 | - if ($monthlyMode!="") { |
|
351 | - switch ($monthlyMode) { |
|
352 | - case 'dates': |
|
353 | - if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
354 | - if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
355 | - $curSchedule.='"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
356 | - } |
|
357 | - else {array_push($results['fail'],"$iRow --> Wrong monthly dates"); $curSchedule="";} |
|
358 | - } |
|
359 | - break; |
|
360 | - case 'nth': |
|
361 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
362 | - if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
363 | - $curSchedule.='"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
364 | - } |
|
365 | - else {array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_n"); $curSchedule="";} |
|
366 | - } |
|
367 | - else {array_push($results['fail'],"$iRow --> The parameter sched_nth_n is not set"); $curSchedule="";} |
|
368 | - |
|
369 | - if ($curSchedule!="") { |
|
370 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
371 | - if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
372 | - $curSchedule.='"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
373 | - } |
|
374 | - else {array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_what"); $curSchedule="";} |
|
375 | - } |
|
376 | - else {array_push($results['fail'],"$iRow --> The parameter sched_nth_what is not set"); $curSchedule="";} |
|
377 | - } |
|
350 | + if ($monthlyMode!="") { |
|
351 | + switch ($monthlyMode) { |
|
352 | + case 'dates': |
|
353 | + if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
354 | + if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
355 | + $curSchedule.='"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
356 | + } |
|
357 | + else {array_push($results['fail'],"$iRow --> Wrong monthly dates"); $curSchedule="";} |
|
358 | + } |
|
359 | + break; |
|
360 | + case 'nth': |
|
361 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
362 | + if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
363 | + $curSchedule.='"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
364 | + } |
|
365 | + else {array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_n"); $curSchedule="";} |
|
366 | + } |
|
367 | + else {array_push($results['fail'],"$iRow --> The parameter sched_nth_n is not set"); $curSchedule="";} |
|
378 | 368 | |
379 | - break; |
|
369 | + if ($curSchedule!="") { |
|
370 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
371 | + if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
372 | + $curSchedule.='"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
380 | 373 | } |
374 | + else {array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_what"); $curSchedule="";} |
|
375 | + } |
|
376 | + else {array_push($results['fail'],"$iRow --> The parameter sched_nth_what is not set"); $curSchedule="";} |
|
381 | 377 | } |
378 | + |
|
382 | 379 | break; |
383 | - default: |
|
384 | - $curSchedule==""; |
|
380 | + } |
|
381 | + } |
|
385 | 382 | break; |
383 | + default: |
|
384 | + $curSchedule==""; |
|
385 | + break; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | } |
@@ -59,6 +59,9 @@ |
||
59 | 59 | return $order; |
60 | 60 | } |
61 | 61 | |
62 | + /** |
|
63 | + * @param Order $params |
|
64 | + */ |
|
62 | 65 | public static function addOrder($params) |
63 | 66 | { |
64 | 67 | $response = Route4Me::makeRequst(array( |