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

View File

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

View File

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

View File

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

View File

@ -32,7 +32,11 @@
'path' => 'log', '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' : ''); ?>"> <div class="nav-item <?php echo ($ITEM == $value ? 'is-active' : ''); ?>">
<a href="<?php echo $value['path']?>"> <a href="<?php echo $value['path']?>">
<i class="fa <?php echo $key ?>"></i> <i class="fa <?php echo $key ?>"></i>
@ -42,5 +46,5 @@
</a> </a>
</div> </div>
<?php }?> <?php }?>
</div> </div>

View File

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

View File

@ -16,51 +16,52 @@
$partial = new Partial('menu'); $partial = new Partial('menu');
$partial->prepare('item', 'scene'); $partial->prepare('item', 'scene');
$partial->prepare('langMng',$LANGMNG); $partial->prepare('langMng',$LANGMNG);
$partial->prepare('debugMod',$DEBUGMOD);
$partial->render(); $partial->render();
?> ?>
</div> </div>
<div class="col-md-9 main-body"> <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> <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"> <div class="row no-gutters">
<?php foreach ($SCENES as $sceneId => $sceneData) { <?php foreach ($SCENES as $sceneId => $sceneData) {
//BUTTON //BUTTON
$partialScenButton = new Partial('sceneButton'); $partialScenButton = new Partial('sceneButton');
$partialScenButton->prepare('langMng', $LANGMNG); $partialScenButton->prepare('langMng', $LANGMNG);
$partialScenButton->prepare('sceneId', $sceneId); $partialScenButton->prepare('sceneId', $sceneId);
$partialScenButton->prepare('sceneData', $sceneData); $partialScenButton->prepare('sceneData', $sceneData);
$partialScenButton->render(); $partialScenButton->render();
// Edit // Edit
$partialSceneEdit = new Partial('sceneEdit'); $partialSceneEdit = new Partial('sceneEdit');
$partialSceneEdit->prepare('langMng',$LANGMNG); $partialSceneEdit->prepare('langMng',$LANGMNG);
$partialSceneEdit->prepare('sceneId',$sceneId); $partialSceneEdit->prepare('sceneId',$sceneId);
$partialSceneEdit->prepare('scene',$sceneData); $partialSceneEdit->prepare('scene',$sceneData);
$partialSceneEdit->render(); $partialSceneEdit->render();
?> ?>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
</div> </div>
<?php if (isset($_POST['submit'])) { <?php if (isset($_POST['submit'])) {
$partial = new Partial('sceneCreateFinal'); $partial = new Partial('sceneCreateFinal');
$partial->prepare('langMng',$LANGMNG); $partial->prepare('langMng',$LANGMNG);
$partial->prepare('setStateFormDevices',$SETSTATEFORMDEVICES ); $partial->prepare('setStateFormDevices',$SETSTATEFORMDEVICES );
$partial->prepare('sceneIcon',$SCENEICON ); $partial->prepare('sceneIcon',$SCENEICON );
$partial->prepare('SceneName',$SCENENAME ); $partial->prepare('SceneName',$SCENENAME );
$partial->render(); $partial->render();
} else { } else {
$partial = new Partial('sceneCreate'); $partial = new Partial('sceneCreate');
$partial->prepare('langMng',$LANGMNG); $partial->prepare('langMng',$LANGMNG);
$partial->prepare('subDevices',$SUBDEVICES); $partial->prepare('subDevices',$SUBDEVICES);
$partial->render(); $partial->render();
} }
$partial = new Partial('footer'); $partial = new Partial('footer');
$partial->render(); $partial->render();
?> ?>
</body> </body>
</html> </html>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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