From 2c6e7e2eccbeea0537812372231836d3552182de Mon Sep 17 00:00:00 2001 From: Haitem Date: Tue, 8 Sep 2020 18:00:44 +0200 Subject: [PATCH 1/3] Add function on change room --- app/controllers/deviceController.php | 5 ++++- app/views/templates/device.phtml | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/controllers/deviceController.php b/app/controllers/deviceController.php index cb47edf..bc367f3 100644 --- a/app/controllers/deviceController.php +++ b/app/controllers/deviceController.php @@ -15,12 +15,15 @@ if (!empty ($_POST)){ } if (isset ($_POST['deviceCommand']) && !empty ($_POST['deviceId'])) { $deviceManager->edit ($_POST['deviceId'], array ('command' => $_POST['deviceCommand'])); - }else if (!empty ($_POST['deviceCommand'])) { + } else if (!empty ($_POST['deviceCommand'])) { $devices = $deviceManager->getAllDevices(); foreach ($devices as $key => $device) { $deviceManager->edit ($device['device_id'], array ('command' => $_POST['deviceCommand'])); } } + if (!empty ($_POST['deviceRoomId']) && !empty ($_POST['deviceId'])) { + $deviceManager->edit ($_POST['deviceId'], array ('room_id' => $_POST['deviceRoomId'])); + } header('Location: ./device'); die(); } diff --git a/app/views/templates/device.phtml b/app/views/templates/device.phtml index 66ea919..b0396ca 100644 --- a/app/views/templates/device.phtml +++ b/app/views/templates/device.phtml @@ -44,17 +44,22 @@ &#x - +
+ "> + +
- - + From ed732e125a7f6e6b2c63545eb412d486ef7e24a8 Mon Sep 17 00:00:00 2001 From: Haitem Date: Tue, 8 Sep 2020 18:47:58 +0200 Subject: [PATCH 2/3] Add name changer and repair need icon --- app/controllers/deviceController.php | 3 +++ app/views/templates/device.phtml | 36 ++++++++++++++++------------ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/app/controllers/deviceController.php b/app/controllers/deviceController.php index bc367f3..0958618 100644 --- a/app/controllers/deviceController.php +++ b/app/controllers/deviceController.php @@ -24,6 +24,9 @@ if (!empty ($_POST)){ if (!empty ($_POST['deviceRoomId']) && !empty ($_POST['deviceId'])) { $deviceManager->edit ($_POST['deviceId'], array ('room_id' => $_POST['deviceRoomId'])); } + if (!empty ($_POST['deviceName']) && !empty ($_POST['deviceId'])) { + $deviceManager->edit ($_POST['deviceId'], array ('name' => $_POST['deviceName'])); + } header('Location: ./device'); die(); } diff --git a/app/views/templates/device.phtml b/app/views/templates/device.phtml index b0396ca..db37436 100644 --- a/app/views/templates/device.phtml +++ b/app/views/templates/device.phtml @@ -42,9 +42,14 @@ &#x - -
+ + "> + "> +
+ + +
"> "> - "> -
- - + + # + Name + Room + Firmware + + IP Address
+ (Mac)
+ Token + + Action +
+ +
+
+ + + + + + &#x +
"> - "> +
+ + +
+ "> + +
+ + + $room) { - echo ''; + $icon = "fa-circle"; + $color = "yellow"; + if (!empty($device['firmware_hash'])) { + if ($device['firmware_hash'] == "true") { + $icon = "fa-check-circle"; + $color = "green"; + } else if ($device['firmware_hash'] == "need") { + $icon = "fa-arrow-circle-up"; + $color = "#6495ED"; + } else { + $icon = "fa-times-circle"; + $color = "red"; } } ?> - - - - - - - - - -
- "> - -
- -
- -
-
- - - -
- "> - - -
-
- - - - - - + + + +
+ "> + +
+ +
+ +
+
+ + + +
+ "> + + +
+
+ + + + + @@ -117,6 +117,12 @@ $partial->render(); //TODO js do main.js ?> +