PHP_SMART_HOME_V3/app/views/templates/setting.phtml

240 lines
9.2 KiB
PHTML
Raw Normal View History

2020-05-16 15:18:27 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<?php
2020-11-18 20:40:52 +00:00
$partial = new Partial('head');
2020-05-16 15:18:27 +00:00
$partial->prepare('baseDir', $BASEDIR);
2020-11-18 20:40:52 +00:00
$partial->prepare('baseUrl', $BASEURL);
2020-05-16 15:18:27 +00:00
$partial->render();
?>
<title><?php echo $TITLE ?></title>
</head>
<body class="no-transitions">
<div class="row no-gutters main">
<div class="col-md-3 d-sm-none"></div>
<div class="col-md-3 nav-container">
<?php
$partial = new Partial('menu');
$partial->prepare('item', 'setting');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('debugMod',$DEBUGMOD);
$partial->render();
?>
</div>
<div class="col-md-9 main-body">
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4">
<?php $LANGMNG->echo('t_pageAfterLogIn') ?>
</h4>
<form method="post" enctype="multipart/form-data">
<div class="">
<div class="field">
<select class="input" name="loadPage">
<option value="0" <?php echo (UserManager::getUserData("startPage") == 0 ? "selected" : ""); ?>>Default</option>
<option value="1" <?php echo (UserManager::getUserData("startPage") == 1 ? "selected" : ""); ?>>Dashboard</option>
</select>
</div>
<input type="submit" name="submit" class="button" value="<?php $LANGMNG->echo('b_save') ?>"/>
</div>
</div>
</form>
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4"><?php $LANGMNG->echo('t_profile') ?></h4>
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_userAvatar') ?>:</div>
<img src="<?php echo $USERAVATARURL; ?>" />
<div class="label">* providet by Gavatar</div>
</div>
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_userName') ?>:</div>
<input class="input" value="<?php echo $USERNAME; ?>" disabled>
</div>
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_userEmail') ?>:</div>
<input class="input" value="<?php echo $USEREMAIL; ?>" disabled>
</div>
<div class="field">
<a href="logout" class="button is-primary"><?php $LANGMNG->echo('b_logOut') ?></a>
</div>
</div>
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4"><?php $LANGMNG->echo('t_notification') ?></h4>
<input id="notifications" type="checkbox" onChange="toggleNotificationPermissions(this);" />
<div class="label"><?php $LANGMNG->echo('l_notificationStatus') ?></div>
<div class="field">
<a onClick="sendTestNotification();" class="button"><?php $LANGMNG->echo('b_sendTestNotification');?></a>
</div>
</div>
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4"><?php $LANGMNG->echo('t_experimental') ?></h4>
<div class="field">
<a href="rooms" class="button"><?php $LANGMNG->echo('b_rooms') ?></a>
</div>
</div>
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4"><?php $LANGMNG->echo('t_changePassword') ?></h4>
<form method="post">
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_oldPassword') ?>:</div>
<input type="password" class="input" name="oldPassword" value="" data-cip-id="cIPJQ342845639">
</div>
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_newPassword') ?>:</div>
<input type="password" class="input" name="newPassword1" value="">
</div>
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_newPassword') ?>:</div>
<input type="password" class="input" name="newPassword2" value="">
</div>
<div class="field">
<input type="submit" name="submitPasswordChange" class="button" value="Uložit">
</div>
</form>
</div>
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4"><?php $LANGMNG->echo('t_ota') ?></h4>
<?php if (!empty($QRURL)) {?>
<img src="<?php echo $QRURL;?>" />
<form method="post" action="setting">
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_gooleAutenticatorOtaCode') ?>:</div>
<input type="text" class="input" name="otaCode" value="" required>
<input type="hidden" class="input" name="otaSecret" value="<?php echo $OTASECRET;?>" required>
</div>
<div class="field">
<input type="submit" name="submitEnableOta" class="button" value="Uložit">
</div>
</form>
<?php } else {?>
<button name="deactivateOta" type="button" class="button is-danger fa"><?php $LANGMNG->echo('b_disable');?> <?php $LANGMNG->echo('b_ota'); ?></button>
<?php }?>
</div>
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4"><?php $LANGMNG->echo('t_listUsers') ?></h4>
<table class="table is-fluid">
<thead>
<tr>
<th><?php $LANGMNG->echo('t_avatar');?></th>
<th><?php $LANGMNG->echo('t_userName');?></th>
<th><?php $LANGMNG->echo('t_ota');?></th>
<th><?php $LANGMNG->echo('t_permission');?></th>
2020-05-16 15:18:27 +00:00
<th><?php $LANGMNG->echo('t_action');?></th>
</tr>
</thead>
<tbody>
<?php foreach ($USERS as $key => $user) { ?>
<tr>
<td><img src="<?php echo $user['gavatar_url']; ?>" /></td>
<td><?php echo $user['username']; ?></td>
<td><?php echo ($user['ota'] ? '<span class="fa">&#xf00c;</span>' : ''); ?></td>
<td>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="userID" value="<?php echo $user['user_id']; ?>"/>
<select class="input" name="userPermission" onchange="this.form.submit();">
<option value="0"<?php echo (empty ($user['permission']) ? " selected" : "") ?>><?php $LANGMNG->echo('t_permission_user'); ?></option>
<option value="1"<?php echo (!empty ($user['permission']) ? " selected" : "") ?>><?php $LANGMNG->echo('t_permission_admin'); ?></option>
</select>
</form>
</td>
2020-05-16 15:18:27 +00:00
<td><button name="deleteUser" type="button" class="button is-danger fa">&#xf1f8;</button></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4"><?php $LANGMNG->echo('t_createuser') ?></h4>
<form method="post">
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_userName') ?>:</div>
<input type="text" class="input" name="userName" value="">
</div>
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_password') ?>:</div>
<input type="password" class="input" name="userPassword" value="">
</div>
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_email') ?>:</div>
<input type="email" class="input" name="userEmail" value="">
</div>
2020-05-16 15:18:27 +00:00
<div class="field">
<input type="submit" name="submitCreateUser" class="button" value="Uložit">
</div>
</form>
</div>
<!--Room Managment-->
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4"><?php $LANGMNG->echo('t_listRooms') ?></h4>
<table class="table is-fluid">
<thead>
<tr>
<th><?php $LANGMNG->echo('t_roomName');?></th>
<th><?php $LANGMNG->echo('t_action');?></th>
</tr>
</thead>
<tbody>
<?php foreach ($ROOMS as $key => $room) { ?>
<tr>
<td>
<form method="post" action="">
<input type="hidden" name="roomId" value="<?php echo (!empty($room['room_id']) ? $room['room_id'] : ""); ?>">
<input class="input" type="text" onchange="this.form.submit();" name="roomName" value="<?php echo (!empty($room['name']) ? $room['name'] : ""); ?>">
</form>
</td>
2020-05-16 15:18:27 +00:00
<td>
<button name="deleteRoom" type="button" class="button is-danger fa">&#xf1f8;</button>
<button name="defaultRoom" type="button" class="button fa" <?php echo ($room['default'] ? 'disabled' : ''); ?>>&#xf140;</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<!--Room Creation-->
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4"><?php $LANGMNG->echo('t_createRoom') ?></h4>
<form method="post">
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_roomName') ?>:</div>
<input type="text" class="input" name="roomName" value="">
</div>
<div class="field">
<input type="submit" name="submitCreateUser" class="button" value="<?php $LANGMNG->echo('b_create') ?>">
</div>
</form>
</div>
2020-12-17 18:17:02 +00:00
<!--Plugins Settings-->
2020-12-17 18:41:59 +00:00
<?php foreach ($PLUGINSSETTINGS as $key => $pluginSeting) { ?>
<div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4"><?php echo $pluginSeting['name'] ?></h4>
<form method="post">
<?php foreach ($pluginSeting['settings'] as $key => $pluginSetingField) { ?>
<div class="field">
<div class="label"><?php echo $pluginSetingField['name'] ?>:</div>
2020-12-23 14:57:12 +00:00
<input type="text" class="input" name="<?php echo $pluginSetingField['name'] ?>" value="<?php echo $pluginSetingField['value'] ?>">
2020-12-17 18:41:59 +00:00
</div>
<?php } ?>
<div class="field">
<input type="submit" name="submitPlugins<?php echo $pluginSeting['name'] ?>Settings" class="button" value="<?php $LANGMNG->echo('b_save') ?>">
</div>
</form>
</div>
<?php } ?>
2020-05-16 15:18:27 +00:00
</div>
</div>
<?php
$partial = new Partial('footer');
2020-06-26 14:58:08 +00:00
$partial->prepare('baseDir', BASEDIR);
2020-05-16 15:18:27 +00:00
$partial->render();
?>
<script src="./app/templates/js/setting.js"></script>
</script>
</body>
</html>