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 @@