mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
Simple Home (Google Oauth 2.0) Flow type - code
This commit is contained in:
1 parent
135dfcb666
commit
541ea0002f
13 files changed
+243
-42
No files matched your search
@@ -66,6 +66,20 @@ class SubDeviceManager
|
||||
}
|
||||
}
|
||||
|
||||
public static function edit($subDeviceId, $values)
|
||||
{
|
||||
$record = [];
|
||||
foreach ($values as $key => $value) {
|
||||
$record[$key] = $value;
|
||||
}
|
||||
try {
|
||||
Db::edit('subdevices', $record, 'WHERE subdevice_id = ?', array ($subDeviceId));
|
||||
} catch (PDOException $error) {
|
||||
echo $error->getMessage();
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
public static function remove($subDeviceId)
|
||||
{
|
||||
RecordManager::cleanSubdeviceRecords($subDeviceId);
|
||||
@@ -78,7 +92,7 @@ class SubDeviceManager
|
||||
|
||||
//TODO: @Patrik Check line 89
|
||||
$rows = Db::loadAll("
|
||||
SELECT d.room_id, d.sleep_time, sd.subdevice_id, sd.device_id, d.icon, d.name, sd.type, sd.unit, r.value, r.time FROM subdevices sd
|
||||
SELECT d.room_id, d.sleep_time, sd.subdevice_id, sd.device_id, COALESCE(sd.icon, d.icon) AS icon, COALESCE(sd.name, d.name) AS name, sd.type, sd.unit, r.value, r.time FROM subdevices sd
|
||||
JOIN devices d ON sd.device_id = d.device_id
|
||||
JOIN records r ON r.subdevice_id = sd.subdevice_id
|
||||
WHERE d.room_id IN (" . str_repeat("?,", count($roomIds) - 1) . "?)
|
||||
|
||||
Reference in new issue
Block a user