Plugin system modification
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
class RoomsApi extends ApiController{
|
||||
|
||||
public function default(){
|
||||
$this->requireAuth();
|
||||
//$this->requireAuth();
|
||||
$response = [];
|
||||
$roomIds = [];
|
||||
$roomsData = RoomManager::getRoomsDefault();
|
||||
@@ -12,8 +12,29 @@ class RoomsApi extends ApiController{
|
||||
$roomIds[] = $room['room_id'];
|
||||
}
|
||||
|
||||
//Translation Of Numeric Walues
|
||||
$subDevicesData = SubDeviceManager::getSubdevicesByRoomIds($roomIds);
|
||||
|
||||
foreach ($subDevicesData as $subDeviceKey => $subDevice) {
|
||||
foreach ($subDevice as $key => $value) {
|
||||
if (strpos($subDevicesData[$subDeviceKey][$key]['type'], '-') !== false) {
|
||||
$type = "";
|
||||
foreach(explode('-', $subDevicesData[$subDeviceKey][$key]['type']) as $word){
|
||||
$type .= ucfirst($word);
|
||||
}
|
||||
if(class_exists($type)){
|
||||
$deviceClass = new $type;
|
||||
if (method_exists($deviceClass,'translate')){
|
||||
$subDevicesData[$subDeviceKey][$key]['value'] = $deviceClass->translate($subDevicesData[$subDeviceKey][$key]['value']);
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($roomsData as $roomKey => $roomData) {
|
||||
if ($roomData['device_count'] == 0) continue;
|
||||
$response[] = [
|
||||
|
Reference in New Issue
Block a user