From aa8235c1bfbb05c0ffbe449203c1a842a8a76ed3 Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Sat, 24 Aug 2019 13:13:04 +0200 Subject: [PATCH] FTP to GIT sync --- class/DeviceManager.php | 4 +- class/RecordManager.php | 6 ++ class/SubDeviceManager.php | 94 ++++++++++++++------------- templates/css/main.css | 15 +++++ templates/dashboard.phtml | 7 +- templates/part/automationButton.phtml | 54 +++++++++++++++ templates/part/dashboardButton.phtml | 3 +- templates/part/sceneButton.phtml | 22 +++++++ templates/scene.phtml | 37 ++++------- templates/setting.phtml | 6 +- views/Home.php | 4 +- views/Scene.php | 2 +- 12 files changed, 169 insertions(+), 85 deletions(-) create mode 100644 templates/part/automationButton.phtml create mode 100644 templates/part/sceneButton.phtml diff --git a/class/DeviceManager.php b/class/DeviceManager.php index 4d529e7..8a620c6 100644 --- a/class/DeviceManager.php +++ b/class/DeviceManager.php @@ -3,11 +3,11 @@ class DeviceManager{ public static $devices; function getAllDevices () { - return Db::loadAll ("SELECT * FROM devices"); + return Db::loadAll ("SELECT * FROM devices WHERE approved != ?", Array(2)); } function getAllDevicesInRoom ($roomId = "") { - return Db::loadAll ("SELECT * FROM devices WHERE room_id = ?", Array($roomId)); + return Db::loadAll ("SELECT * FROM devices WHERE room_id = ? AND approved != ?", Array($roomId, 2)); } function getOtherDevices(){ diff --git a/class/RecordManager.php b/class/RecordManager.php index 553d0c9..e98eda6 100644 --- a/class/RecordManager.php +++ b/class/RecordManager.php @@ -70,5 +70,11 @@ class RecordManager{ Db::command ('DELETE FROM records WHERE time < ADDDATE(NOW(), INTERVAL -? DAY);', array($day)); } } + + + //TODO: zkontrolovat jestli neco nezbilo po smazaní + public static function cleanSubdeviceRecords ($subDeviceId) { + Db::command ('DELETE FROM records WHERE subdevice_id = ?);', array($subDeviceId)); + } } ?> diff --git a/class/SubDeviceManager.php b/class/SubDeviceManager.php index 69cc7d4..966db44 100644 --- a/class/SubDeviceManager.php +++ b/class/SubDeviceManager.php @@ -1,55 +1,61 @@ $deviceId, - 'type' => $type, - 'unit' => $unit, - ); - try { - Db::add('subdevices', $record); - } catch (PDOException $error) { - echo $error->getMessage(); - die(); - } - } + public function create($deviceId, $type, $unit) + { + $record = array( + 'device_id' => $deviceId, + 'type' => $type, + 'unit' => $unit, + ); + try { + Db::add('subdevices', $record); + } catch (PDOException $error) { + echo $error->getMessage(); + die(); + } + } + + public function remove($subDeviceId) + { + RecordManager::cleanSubdeviceRecords($subDeviceId); + return Db::loadAll("DELETE FROM subdevices WHERE subdevice_id = ?", array($subDeviceId)); + } } diff --git a/templates/css/main.css b/templates/css/main.css index a2eb8d4..5837b03 100644 --- a/templates/css/main.css +++ b/templates/css/main.css @@ -2953,4 +2953,19 @@ h6 { .is-inactive { opacity: .4; } + +.noselect { + -webkit-touch-callout: none; /* iOS Safari */ + -webkit-user-select: none; /* Safari */ + -khtml-user-select: none; /* Konqueror HTML */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; /* Non-prefixed version, currently + supported by Chrome and Opera */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* Internet Explorer */ + -khtml-user-select: none; /* KHTML browsers (e.g. Konqueror) */ + -webkit-user-select: none; /* Chrome, Safari, and Opera */ + -webkit-touch-callout: none; /* Disable Android and iOS callouts*/ +} /*# sourceMappingURL=main.css.map */ \ No newline at end of file diff --git a/templates/dashboard.phtml b/templates/dashboard.phtml index 19e22fb..0ab0229 100644 --- a/templates/dashboard.phtml +++ b/templates/dashboard.phtml @@ -30,8 +30,7 @@
- Add Device - + Add Device
$dashboardItemData) { $partialDeviceButton = new Partial('dashboardButton'); @@ -45,7 +44,9 @@