@@ -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 | } |
@@ -326,62 +326,62 @@ |
||
| 326 | 326 | |
| 327 | 327 | if ($mode!='daily') { |
| 328 | 328 | switch ($mode) { |
| 329 | - case 'weekly': |
|
| 330 | - if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 331 | - if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 332 | - $schedule.='"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
| 333 | - } |
|
| 334 | - else {array_push($results['fail'],"$iRow --> Wrong weekdays"); $schedule="";} |
|
| 329 | + case 'weekly': |
|
| 330 | + if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 331 | + if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 332 | + $schedule.='"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
| 335 | 333 | } |
| 336 | - else {array_push($results['fail'],"$iRow --> The parameters sched_weekdays is not set"); $schedule="";} |
|
| 337 | - break; |
|
| 338 | - case 'monthly': |
|
| 339 | - $monthlyMode=""; |
|
| 340 | - if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 341 | - if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 342 | - $monthlyMode=$rows[$locationsFieldsMapping['monthly_mode']]; |
|
| 343 | - $schedule.='"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
| 344 | - } |
|
| 345 | - else {array_push($results['fail'],"$iRow --> Wrong monthly mode"); $schedule="";} |
|
| 334 | + else {array_push($results['fail'],"$iRow --> Wrong weekdays"); $schedule="";} |
|
| 335 | + } |
|
| 336 | + else {array_push($results['fail'],"$iRow --> The parameters sched_weekdays is not set"); $schedule="";} |
|
| 337 | + break; |
|
| 338 | + case 'monthly': |
|
| 339 | + $monthlyMode=""; |
|
| 340 | + if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 341 | + if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 342 | + $monthlyMode=$rows[$locationsFieldsMapping['monthly_mode']]; |
|
| 343 | + $schedule.='"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
| 346 | 344 | } |
| 347 | - else {array_push($results['fail'],"$iRow --> The parameter sched_monthly_mode is not set"); $schedule="";} |
|
| 345 | + else {array_push($results['fail'],"$iRow --> Wrong monthly mode"); $schedule="";} |
|
| 346 | + } |
|
| 347 | + else {array_push($results['fail'],"$iRow --> The parameter sched_monthly_mode is not set"); $schedule="";} |
|
| 348 | 348 | |
| 349 | - if ($monthlyMode!="") { |
|
| 350 | - switch ($monthlyMode) { |
|
| 351 | - case 'dates': |
|
| 352 | - if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 353 | - if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 354 | - $schedule.='"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
| 355 | - } |
|
| 356 | - else {array_push($results['fail'],"$iRow --> Wrong monthly dates"); $schedule="";} |
|
| 357 | - } |
|
| 358 | - break; |
|
| 359 | - case 'nth': |
|
| 360 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 361 | - if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 362 | - $schedule.='"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
| 363 | - } |
|
| 364 | - else {array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_n"); $schedule="";} |
|
| 365 | - } |
|
| 366 | - else {array_push($results['fail'],"$iRow --> The parameter sched_nth_n is not set"); $schedule="";} |
|
| 367 | - |
|
| 368 | - if ($schedule!="") { |
|
| 369 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 370 | - if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 371 | - $schedule.='"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
| 372 | - } |
|
| 373 | - else {array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_what"); $schedule="";} |
|
| 374 | - } |
|
| 375 | - else {array_push($results['fail'],"$iRow --> The parameter sched_nth_what is not set"); $schedule="";} |
|
| 376 | - } |
|
| 349 | + if ($monthlyMode!="") { |
|
| 350 | + switch ($monthlyMode) { |
|
| 351 | + case 'dates': |
|
| 352 | + if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 353 | + if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 354 | + $schedule.='"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
| 355 | + } |
|
| 356 | + else {array_push($results['fail'],"$iRow --> Wrong monthly dates"); $schedule="";} |
|
| 357 | + } |
|
| 358 | + break; |
|
| 359 | + case 'nth': |
|
| 360 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 361 | + if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 362 | + $schedule.='"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
| 363 | + } |
|
| 364 | + else {array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_n"); $schedule="";} |
|
| 365 | + } |
|
| 366 | + else {array_push($results['fail'],"$iRow --> The parameter sched_nth_n is not set"); $schedule="";} |
|
| 377 | 367 | |
| 378 | - break; |
|
| 368 | + if ($schedule!="") { |
|
| 369 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 370 | + if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 371 | + $schedule.='"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
| 379 | 372 | } |
| 373 | + else {array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_what"); $schedule="";} |
|
| 374 | + } |
|
| 375 | + else {array_push($results['fail'],"$iRow --> The parameter sched_nth_what is not set"); $schedule="";} |
|
| 380 | 376 | } |
| 377 | + |
|
| 381 | 378 | break; |
| 382 | - default: |
|
| 383 | - $schedule==""; |
|
| 379 | + } |
|
| 380 | + } |
|
| 384 | 381 | break; |
| 382 | + default: |
|
| 383 | + $schedule==""; |
|
| 384 | + break; |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | } |