@@ -384,79 +384,79 @@ |
||
| 384 | 384 | |
| 385 | 385 | if ($mode!='daily') { |
| 386 | 386 | switch ($mode) { |
| 387 | - case 'weekly': |
|
| 388 | - if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 389 | - if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 390 | - $curSchedule.='"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
| 391 | - } else { |
|
| 392 | - array_push($results['fail'],"$iRow --> Wrong weekdays"); |
|
| 393 | - $curSchedule = ""; |
|
| 394 | - } |
|
| 387 | + case 'weekly': |
|
| 388 | + if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 389 | + if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 390 | + $curSchedule.='"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
| 391 | + } else { |
|
| 392 | + array_push($results['fail'],"$iRow --> Wrong weekdays"); |
|
| 393 | + $curSchedule = ""; |
|
| 394 | + } |
|
| 395 | + } else { |
|
| 396 | + array_push($results['fail'],"$iRow --> The parameters sched_weekdays is not set"); |
|
| 397 | + $curSchedule = ""; |
|
| 398 | + } |
|
| 399 | + break; |
|
| 400 | + case 'monthly': |
|
| 401 | + $monthlyMode = ""; |
|
| 402 | + if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 403 | + if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 404 | + $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
| 405 | + $curSchedule.='"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
| 395 | 406 | } else { |
| 396 | - array_push($results['fail'],"$iRow --> The parameters sched_weekdays is not set"); |
|
| 407 | + array_push($results['fail'],"$iRow --> Wrong monthly mode"); |
|
| 397 | 408 | $curSchedule = ""; |
| 398 | 409 | } |
| 410 | + } else { |
|
| 411 | + array_push($results['fail'],"$iRow --> The parameter sched_monthly_mode is not set"); |
|
| 412 | + $curSchedule = ""; |
|
| 413 | + } |
|
| 414 | + |
|
| 415 | + if ($monthlyMode != "") { |
|
| 416 | + switch ($monthlyMode) { |
|
| 417 | + case 'dates': |
|
| 418 | + if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 419 | + if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 420 | + $curSchedule.='"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
| 421 | + } else { |
|
| 422 | + array_push($results['fail'],"$iRow --> Wrong monthly dates"); |
|
| 423 | + $curSchedule = ""; |
|
| 424 | + } |
|
| 425 | + } |
|
| 399 | 426 | break; |
| 400 | - case 'monthly': |
|
| 401 | - $monthlyMode = ""; |
|
| 402 | - if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 403 | - if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 404 | - $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
| 405 | - $curSchedule.='"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
| 427 | + case 'nth': |
|
| 428 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 429 | + if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 430 | + $curSchedule.='"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
| 431 | + } else { |
|
| 432 | + array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_n"); |
|
| 433 | + $curSchedule = ""; |
|
| 434 | + } |
|
| 435 | + } else { |
|
| 436 | + array_push($results['fail'],"$iRow --> The parameter sched_nth_n is not set"); |
|
| 437 | + $curSchedule = ""; |
|
| 438 | + } |
|
| 439 | + |
|
| 440 | + if ($curSchedule != "") { |
|
| 441 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 442 | + if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 443 | + $curSchedule.='"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
| 406 | 444 | } else { |
| 407 | - array_push($results['fail'],"$iRow --> Wrong monthly mode"); |
|
| 445 | + array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_what"); |
|
| 408 | 446 | $curSchedule = ""; |
| 409 | 447 | } |
| 410 | 448 | } else { |
| 411 | - array_push($results['fail'],"$iRow --> The parameter sched_monthly_mode is not set"); |
|
| 449 | + array_push($results['fail'],"$iRow --> The parameter sched_nth_what is not set"); |
|
| 412 | 450 | $curSchedule = ""; |
| 413 | 451 | } |
| 414 | - |
|
| 415 | - if ($monthlyMode != "") { |
|
| 416 | - switch ($monthlyMode) { |
|
| 417 | - case 'dates': |
|
| 418 | - if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 419 | - if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 420 | - $curSchedule.='"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
| 421 | - } else { |
|
| 422 | - array_push($results['fail'],"$iRow --> Wrong monthly dates"); |
|
| 423 | - $curSchedule = ""; |
|
| 424 | - } |
|
| 425 | - } |
|
| 426 | - break; |
|
| 427 | - case 'nth': |
|
| 428 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 429 | - if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 430 | - $curSchedule.='"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
| 431 | - } else { |
|
| 432 | - array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_n"); |
|
| 433 | - $curSchedule = ""; |
|
| 434 | - } |
|
| 435 | - } else { |
|
| 436 | - array_push($results['fail'],"$iRow --> The parameter sched_nth_n is not set"); |
|
| 437 | - $curSchedule = ""; |
|
| 438 | - } |
|
| 439 | - |
|
| 440 | - if ($curSchedule != "") { |
|
| 441 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 442 | - if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 443 | - $curSchedule.='"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
| 444 | - } else { |
|
| 445 | - array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_what"); |
|
| 446 | - $curSchedule = ""; |
|
| 447 | - } |
|
| 448 | - } else { |
|
| 449 | - array_push($results['fail'],"$iRow --> The parameter sched_nth_what is not set"); |
|
| 450 | - $curSchedule = ""; |
|
| 451 | - } |
|
| 452 | - } |
|
| 453 | - break; |
|
| 454 | - } |
|
| 455 | 452 | } |
| 456 | 453 | break; |
| 457 | - default: |
|
| 458 | - $curSchedule = ""; |
|
| 454 | + } |
|
| 455 | + } |
|
| 459 | 456 | break; |
| 457 | + default: |
|
| 458 | + $curSchedule = ""; |
|
| 459 | + break; |
|
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | |
@@ -206,16 +206,16 @@ |
||
| 206 | 206 | |
| 207 | 207 | foreach ($device->Attributes as $attr) { |
| 208 | 208 | switch ($attr->AttributeDisplayName) { |
| 209 | - case 'desc': |
|
| 210 | - $this->_doorName = $attr->Value; |
|
| 211 | - break; |
|
| 212 | - case 'doorstate': |
|
| 213 | - $this->_doorState = $attr->Value; |
|
| 214 | - // UpdatedTime is a timestamp in ms, so we truncate |
|
| 215 | - $this->_doorStateTime = (int)$attr->UpdatedTime / 1000; |
|
| 216 | - break; |
|
| 217 | - default: |
|
| 218 | - continue; |
|
| 209 | + case 'desc': |
|
| 210 | + $this->_doorName = $attr->Value; |
|
| 211 | + break; |
|
| 212 | + case 'doorstate': |
|
| 213 | + $this->_doorState = $attr->Value; |
|
| 214 | + // UpdatedTime is a timestamp in ms, so we truncate |
|
| 215 | + $this->_doorStateTime = (int)$attr->UpdatedTime / 1000; |
|
| 216 | + break; |
|
| 217 | + default: |
|
| 218 | + continue; |
|
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | } |