From 1e464e6e536f67430f09437f24cd4476789ef67f Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Fri, 25 Oct 2019 18:48:48 +0200 Subject: [PATCH] OTA PART 2 Setting Page --- app/class/UserManager.php | 2 +- app/templates/js/setting.js | 20 +++++++++++++++++++- app/templates/setting.phtml | 19 +++++++++++-------- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/app/class/UserManager.php b/app/class/UserManager.php index 4211ce1..0b1e4ed 100644 --- a/app/class/UserManager.php +++ b/app/class/UserManager.php @@ -3,7 +3,7 @@ class UserManager { public function getUsers () { try { - $allUsers = Db::loadAll ("SELECT user_id, username, at_home FROM users"); + $allUsers = Db::loadAll ("SELECT user_id, username, at_home, ota FROM users"); return $allUsers; } catch(PDOException $error) { echo $error->getMessage(); diff --git a/app/templates/js/setting.js b/app/templates/js/setting.js index 16614c8..664069a 100644 --- a/app/templates/js/setting.js +++ b/app/templates/js/setting.js @@ -37,4 +37,22 @@ function sendTestNotification(){ console.log("ERROR ", request, error); } }); -} \ No newline at end of file +} + +$( "button[name='deactivateOta']" ).click(function(){ + console.log("Didabling ota"); + $.ajax({ + url: 'ajax', + type: 'POST', + data: { + "ota" : 'X', + "action": 'disable' + }, + success: function(data){ + console.log(data); + }, + error: function (request, status, error) { + console.log("ERROR ", request, error); + } + }); +}) diff --git a/app/templates/setting.phtml b/app/templates/setting.phtml index 859b6a5..442e701 100644 --- a/app/templates/setting.phtml +++ b/app/templates/setting.phtml @@ -77,11 +77,12 @@
-

- -
- -
+

echo('t_ota') ?>

+ + + + +

echo('t_createuser') ?>

@@ -89,6 +90,7 @@ echo('t_userName');?> + echo('t_ota');?> echo('t_action');?> @@ -96,6 +98,7 @@ $user) { ?> + ' : ''); ?> @@ -116,14 +119,14 @@
- - + + - render(); ?> +