DEBUGMODE in FRONTEND

This commit is contained in:
JonatanRek 2020-01-17 10:27:51 +01:00
parent f345419c39
commit 3479fb9c87
15 changed files with 73 additions and 51 deletions

View File

@ -16,6 +16,7 @@
$partial = new Partial('menu');
$partial->prepare('item','automation');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('debugMod',$DEBUGMOD);
$partial->render();
?>
</div>
@ -29,10 +30,11 @@
$partial->prepare('automationId',$automationId);
$partial->prepare('automationData',$automationData);
$partial->render();
//EDIT
$partial = new Partial('automationEdit');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('userManager',$USERMANAGER);
$partial->prepare('automationId',$automationId);
$partial->prepare('automation',$automationData);
$partial->prepare('subDevices',$SUBDEVICES);
@ -41,15 +43,17 @@
</div>
</div>
</div>
<?php
<?php
if (isset($_POST['modalNext'])) {
$partial = new Partial('automationCreateFinal');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('userManager',$USERMANAGER);
$partial->prepare('subDevices',$SUBDEVICES);
$partial->render();
} else {
$partial = new Partial('automationCreate');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('subDevices',$SUBDEVICES);
$partial->render();
}?>

View File

@ -16,6 +16,7 @@
$partial = new Partial('menu');
$partial->prepare('item', 'dashboard');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('debugMod',$DEBUGMOD);
$partial->render();
?>
</div>
@ -25,13 +26,13 @@
<?php foreach ($DASHBOARD as $dashboardItemId => $dashboardItemData) {
$partialDeviceButton = new Partial('dashboardButton');
$partialDeviceButton->prepare('dashboardItemData', $dashboardItemData);
$partialDeviceButton->render();
} ?>
</div>
</div>
</div>
<div class="modal-container modal-container-hiden" id="modal">
<div class="modal">
<div class="close">
@ -51,12 +52,12 @@
</form>
</div>
</div>
<?php
if (isset($_POST['deviceId'])) {
$partial = new Partial('deviceEdit');
$partial->prepare('DEVICEDATA', $DEVICEDATA);
$partial->render();
}
$partial = new Partial('footer');

View File

@ -16,18 +16,19 @@
$partial = new Partial('menu');
$partial->prepare('item', 'home');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('debugMod',$DEBUGMOD);
$partial->render();
?>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.bundle.min.js"></script>
<div class="col-md-9 main-body">
<div class="label m-1">
<?php
<?php
if ($USERSATHOME != "") {
$LANGMNG->echo('l_atHome');
echo ': ' . $USERSATHOME;
echo ': ' . $USERSATHOME;
}
?>
</div>
@ -42,8 +43,8 @@
</select>
</div>
<div class="row no-gutters">
<?php foreach ($DATA as $roomId => $room) { ?>
<?php foreach ($room['devices'] as $deviceId => $device) { ?>
<?php foreach ($DATA as $roomId => $room) { ?>
<?php foreach ($room['devices'] as $deviceId => $device) { ?>
<?php foreach ($device['subDevices'] as $subDeviceKey => $subDevice) {
//BUTTON
$partialDeviceButton = new Partial('deviceButton');
@ -52,18 +53,18 @@
$partialDeviceButton->prepare('subdevice',$subDevice);
$partialDeviceButton->prepare('deviceid',$deviceId);
$partialDeviceButton->prepare('device',$device);
$partialDeviceButton->render();
//DETAIL
$partialDetail = new Partial('deviceDetail');
$partialDetail->prepare('subdeviceid',$subDeviceKey);
$partialDetail->prepare('subdevice',$subDevice);
$partialDetail->prepare('device',$device);
$partialDetail->prepare('langMng',$LANGMNG);
$partialDetail->render();
//SETTING
$partialEdit = new Partial('deviceEdit');
$partialEdit->prepare('deviceid',$deviceId);
@ -72,9 +73,9 @@
$partialEdit->prepare('users',$USERS);
$partialEdit->prepare('rooms',$ROOMS);
$partialEdit->prepare('langMng',$LANGMNG);
$partialEdit->render();
}
}
}
} ?>
</div>
@ -85,4 +86,4 @@
$partial->render();
?>
</body>
</html>
</html>

View File

@ -16,6 +16,7 @@
$partial = new Partial('menu');
$partial->prepare('item', 'log');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('debugMod',$DEBUGMOD);
$partial->render();
?>
</div>
@ -33,7 +34,7 @@
<input type="submit" class="button" name="selectFile" value="<?php $LANGMNG->echo('b_select');?>"/>
</div>
</form>
<?php
<?php
if (isset($_POST['LogFile'])) {
$file_lines = file('./app/logs/' . $_POST['LogFile']);
echo '<pre style="overflow: auto;">';
@ -45,7 +46,7 @@
?>
</div>
</div>
<?php
$partial = new Partial('footer');
$partial->render();

View File

@ -32,7 +32,11 @@
'path' => 'log',
],
];
foreach ( $menuItems as $key => $value) { ?>
foreach ( $menuItems as $key => $value) {
if ($DEBUGMOD == 0 && $value['path'] == 'log') {
continue;
}
?>
<div class="nav-item <?php echo ($ITEM == $value ? 'is-active' : ''); ?>">
<a href="<?php echo $value['path']?>">
<i class="fa <?php echo $key ?>"></i>
@ -42,5 +46,5 @@
</a>
</div>
<?php }?>
</div>
</div>

View File

@ -16,12 +16,13 @@
$partial = new Partial('menu');
$partial->prepare('item', 'rooms');
$partial->prepare('lang',$LANG);
$partial->prepare('debugMod',$DEBUGMOD);
$partial->render();
?>
</div>
<div class="col-md-9 main-body">
<div class="frame">
<?php foreach ($ROOMS as $roomId => $room) { ?>
@ -72,26 +73,26 @@
flex: 0 0 100%;
height: 100%;
}
.frame {
overflow-x: auto;
width: 100%;
display: flex;
height: 100%;
}
body,html{
height: 100%;
}
.frame .single-frame:nth-child(even) {
background: red;
}
.frame .single-frame:nth-child(odd) {
background: green;
}
</style>
</div>
</div>
@ -104,27 +105,27 @@
var id;
var current_element
var elementWidth = $('.frame').width();
$('.frame').scroll(function(){
//console.log('SCROLLING!');
//console.log('scrool'+$('.single-frame').scrollLeft());
var element_width = $('.single-frame').width();
var offset = $('.single-frame').offset();
var positive = Math.abs(offset.left)
var divided = positive / element_width;
var round = Math.round(divided);
current_element = $('.frame').children().eq(round);
id = current_element.attr('id');
if (prev_id != id){
prev_id = id;
console.log(prev_id);
}
var scrollTo = $('#'+id).offset().left;
console.log('s-f: '+ scrollTo)
});
$('.frame').on('touchend', function(){ // listen to mouse up
console.log('STOPPED SCROLLING!');
@ -135,19 +136,19 @@
if(a[index].id == id){
$('.frame').animate({
scrollLeft: (index * elementWidth)
});
});
$('.frame').animate({
scrollLeft: (index * elementWidth)
});
});
}
console.log(a[index]);
}
if (scrollTo > 160) {
console.log($('#'+id).left)
}
});
</script>
</body>
</html>
</html>

View File

@ -16,51 +16,52 @@
$partial = new Partial('menu');
$partial->prepare('item', 'scene');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('debugMod',$DEBUGMOD);
$partial->render();
?>
</div>
<div class="col-md-9 main-body">
<a class="button is-primary m-1" onClick="$('#modal').removeClass('modal-container-hiden').show();"><?php $LANGMNG->echo('t_createScene');?></a>
<div class="row no-gutters">
<?php foreach ($SCENES as $sceneId => $sceneData) {
<?php foreach ($SCENES as $sceneId => $sceneData) {
//BUTTON
$partialScenButton = new Partial('sceneButton');
$partialScenButton->prepare('langMng', $LANGMNG);
$partialScenButton->prepare('sceneId', $sceneId);
$partialScenButton->prepare('sceneData', $sceneData);
$partialScenButton->render();
// Edit
$partialSceneEdit = new Partial('sceneEdit');
$partialSceneEdit->prepare('langMng',$LANGMNG);
$partialSceneEdit->prepare('sceneId',$sceneId);
$partialSceneEdit->prepare('scene',$sceneData);
$partialSceneEdit->render();
?>
<?php } ?>
</div>
</div>
</div>
<?php if (isset($_POST['submit'])) {
$partial = new Partial('sceneCreateFinal');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('setStateFormDevices',$SETSTATEFORMDEVICES );
$partial->prepare('sceneIcon',$SCENEICON );
$partial->prepare('SceneName',$SCENENAME );
$partial->render();
} else {
$partial = new Partial('sceneCreate');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('subDevices',$SUBDEVICES);
$partial->render();
}
}
$partial = new Partial('footer');
$partial->render();
?>
</body>
</html>
</html>

View File

@ -16,6 +16,7 @@
$partial = new Partial('menu');
$partial->prepare('item', 'setting');
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('debugMod',$DEBUGMOD);
$partial->render();
?>
</div>

View File

@ -52,6 +52,7 @@ class Automation extends Template
$template = new Template('automation');
$template->prepare('baseDir', BASEDIR);
$template->prepare('debugMod', DEBUGMOD);
$template->prepare('title', 'Automation');
$template->prepare('langMng', $langMng);
$template->prepare('userManager', $userManager);

View File

@ -81,6 +81,7 @@ class Dashboard extends Template
}
$template->prepare('baseDir', BASEDIR);
$template->prepare('debugMod', DEBUGMOD);
$template->prepare('title', 'Nástěnka');
$template->prepare('langMng', $langMng);
$template->prepare('dashboard', $dashboard);

View File

@ -177,6 +177,7 @@ class Home extends Template
$rooms = RoomManager::getAllRooms();
$template->prepare('baseDir', BASEDIR);
$template->prepare('debugMod', DEBUGMOD);
$template->prepare('title', 'Home');
$template->prepare('rooms', $rooms);
$template->prepare('langMng', $langMng);

View File

@ -15,6 +15,8 @@ class Login extends Template
$template->prepare('title', 'Home');
$template->prepare('lang', $lang);
$template->render();
}
}

View File

@ -15,6 +15,7 @@ class Rooms extends Template
$template = new Template('rooms');
$template->prepare('baseDir', BASEDIR);
$template->prepare('debugMod', DEBUGMOD);
$template->prepare('title', 'Rooms');
$template->prepare('lang', $lang);

View File

@ -12,6 +12,7 @@ class Scene extends Template
$template = new Template('scene');
$template->prepare('baseDir', BASEDIR);
$template->prepare('debugMod', DEBUGMOD);
$template->prepare('title', 'Scény');
$template->prepare('langMng', $langMng);

View File

@ -24,6 +24,7 @@ class Setting extends Template
$template = new Template('setting');
$template->prepare('baseDir', BASEDIR);
$template->prepare('debugMod', DEBUGMOD);
$template->prepare('title', 'Automation');
$template->prepare('langMng', $langMng);
$template->prepare('automations', $automations);