PHP_SMART_HOME_V3/app/views/templates/home.phtml

108 lines
3.0 KiB
PHTML
Raw Normal View History

2019-08-23 11:39:42 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<?php
$partial = new Partial('head');
2019-10-11 14:38:20 +00:00
$partial->prepare('baseDir', $BASEDIR);
2019-08-23 11:39:42 +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">
2019-09-19 12:48:31 +00:00
<?php
$partial = new Partial('menu');
$partial->prepare('item', 'home');
2019-10-11 12:12:05 +00:00
$partial->prepare('langMng',$LANGMNG);
2020-01-17 09:27:51 +00:00
$partial->prepare('debugMod',$DEBUGMOD);
2019-09-19 12:48:31 +00:00
$partial->render();
?>
2019-08-23 11:39:42 +00:00
</div>
2020-01-17 09:27:51 +00:00
2019-08-23 11:39:42 +00:00
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.bundle.min.js"></script>
2020-01-17 09:27:51 +00:00
2019-08-23 11:39:42 +00:00
<div class="col-md-9 main-body">
<div class="label m-1">
2020-01-17 09:27:51 +00:00
<?php
2019-09-19 12:48:31 +00:00
if ($USERSATHOME != "") {
2019-10-11 12:12:05 +00:00
$LANGMNG->echo('l_atHome');
2020-01-17 09:27:51 +00:00
echo ': ' . $USERSATHOME;
2019-09-09 19:30:35 +00:00
}
?>
2019-08-23 11:39:42 +00:00
</div>
2019-10-08 14:49:08 +00:00
<div class="m-1">
<select class="select" name="room">
<option value="all">All</option>
<?php foreach ($ROOMS as $key => $room) {
if ($room['device_count'] > 0) { ?>
<option value="<?php echo $room['room_id']?>"><?php echo $room['name'] ?></option>
<?php } ?>
2019-08-23 11:39:42 +00:00
<?php } ?>
2019-10-08 14:49:08 +00:00
</select>
</div>
2019-08-23 11:39:42 +00:00
<div class="row no-gutters">
2020-01-17 09:27:51 +00:00
<?php foreach ($DATA as $roomId => $room) { ?>
<?php foreach ($room['devices'] as $deviceId => $device) { ?>
2019-08-23 11:39:42 +00:00
<?php foreach ($device['subDevices'] as $subDeviceKey => $subDevice) {
//BUTTON
$partialDeviceButton = new Partial('deviceButton');
$partialDeviceButton->prepare('roomid',$roomId);
$partialDeviceButton->prepare('subdeviceid',$subDeviceKey);
$partialDeviceButton->prepare('subdevice',$subDevice);
$partialDeviceButton->prepare('deviceid',$deviceId);
$partialDeviceButton->prepare('device',$device);
2020-01-17 09:27:51 +00:00
2019-08-23 11:39:42 +00:00
$partialDeviceButton->render();
2020-01-17 09:27:51 +00:00
2019-08-23 11:39:42 +00:00
//DETAIL
$partialDetail = new Partial('deviceDetail');
$partialDetail->prepare('subdeviceid',$subDeviceKey);
$partialDetail->prepare('subdevice',$subDevice);
$partialDetail->prepare('device',$device);
2019-10-11 12:12:05 +00:00
$partialDetail->prepare('langMng',$LANGMNG);
2020-01-17 09:27:51 +00:00
2019-08-23 11:39:42 +00:00
$partialDetail->render();
2020-01-17 09:27:51 +00:00
2019-08-23 11:39:42 +00:00
//SETTING
$partialEdit = new Partial('deviceEdit');
$partialEdit->prepare('deviceid',$deviceId);
$partialEdit->prepare('subdevice',$subDevice);
$partialEdit->prepare('device',$device);
$partialEdit->prepare('users',$USERS);
$partialEdit->prepare('rooms',$ROOMS);
2019-10-11 12:12:05 +00:00
$partialEdit->prepare('langMng',$LANGMNG);
2020-01-17 09:27:51 +00:00
2019-08-23 11:39:42 +00:00
$partialEdit->render();
2020-01-17 09:27:51 +00:00
}
2019-08-23 11:39:42 +00:00
}
} ?>
</div>
</div>
</div>
<?php
$partial = new Partial('footer');
$partial->render();
?>
<script>
$(document).on('keyup mouseup', '#value_control', function(event) {
$.ajax({
url: 'ajax',
type: 'POST',
//TODO: GET Attribute from ID
data: { subDevice_id : '46', action : 'set', value: this.value},
success: function(msg){
console.log("message");
console.log(msg);
},
error: function (request, status, error) {
console.log('0');
}
});
console.log(this.value);
});
</script>
2019-08-23 11:39:42 +00:00
</body>
2020-01-17 09:27:51 +00:00
</html>