Big LNG MNG update for revox

This commit is contained in:
JonatanRek 2019-10-11 14:12:05 +02:00
parent cea2573875
commit 407d1fa8a9
25 changed files with 202 additions and 152 deletions

View File

@ -7,24 +7,36 @@ class LanguageManager
private $lngCode = 'en'; private $lngCode = 'en';
private $lngDatabase = []; private $lngDatabase = [];
private $debug = false;
function __construct(string $lngCode) function __construct(string $lngCode, bool $debug = false)
{ {
$this->lngCode = $lngCode; $this->lngCode = $lngCode;
$this->debug = $debug;
} }
function load() function load()
{ {
$file = './app/lang/en.php'; $file = './app/lang/en.php';
if (!file_exists($file)){
die();
//TODO add lng EXEPTIONS
}
$arrayFirst = include($file); $arrayFirst = include($file);
$file = './app/lang/' . $this->lngCode . '.php'; $file = './app/lang/' . $this->lngCode . '.php';
$arraySecond = [];
if (file_exists($file)){
$arraySecond = include($file); $arraySecond = include($file);
}
$this->lngDatabase = array_merge($arrayFirst,$arraySecond); $this->lngDatabase = array_merge($arrayFirst,$arraySecond);
return true; return true;
} }
function get(string $stringKey) function get(string $stringKey)
{ {
if ($this->debug) {
return $stringKey;
}
if (isset($this->lngDatabase[$stringKey])) { if (isset($this->lngDatabase[$stringKey])) {
return $this->lngDatabase[$stringKey]; return $this->lngDatabase[$stringKey];
} }
@ -33,9 +45,15 @@ class LanguageManager
function echo(string $stringKey) function echo(string $stringKey)
{ {
if (isset($this->lngDatabase[$stringKey])) { if ($this->debug) {
return $this->lngDatabase[$stringKey]; echo $stringKey;
return;
} }
return $stringKey; if (isset($this->lngDatabase[$stringKey])) {
echo $this->lngDatabase[$stringKey];
return;
}
echo $stringKey;
return;
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
$lang = [ return $lang = [
//Menu //Menu
'm_home' => 'Domů', 'm_home' => 'Domů',
'm_dashboard' => 'Nástěnka', 'm_dashboard' => 'Nástěnka',
@ -45,6 +45,7 @@ $lang = [
'l_sleepTime' => 'Doba spánku zařízení', 'l_sleepTime' => 'Doba spánku zařízení',
'l_atHome' => 'Doma Jsou', 'l_atHome' => 'Doma Jsou',
'l_nameAt' => 'Název', 'l_nameAt' => 'Název',
'l_lastSeen' => 'Naposledy připojeno',
//Title //Title
't_createScene' => 'Vytvořit scénu', 't_createScene' => 'Vytvořit scénu',

View File

@ -1,5 +1,5 @@
<?php <?php
$lang = [ return $lang = [
//Menu //Menu
'm_home' => 'Home', 'm_home' => 'Home',
'm_dashboard' => 'Dashboard', 'm_dashboard' => 'Dashboard',
@ -21,6 +21,12 @@ $lang = [
'b_approve' => 'Approve', 'b_approve' => 'Approve',
'b_disable' => 'Disable', 'b_disable' => 'Disable',
'b_save' => 'Save', 'b_save' => 'Save',
'b_logOut' => 'Logout',
'b_sendTestNotification' => 'Send Test Notification',
'b_rooms' => 'Rooms',
'b_restart' => 'Restart',
'b_disable' => 'disabele',
'b_select' => 'Select',
//labels //labels
@ -45,6 +51,8 @@ $lang = [
'l_sleepTime' => 'Device sleep Time', 'l_sleepTime' => 'Device sleep Time',
'l_atHome' => 'At home', 'l_atHome' => 'At home',
'l_nameAt' => 'Name', 'l_nameAt' => 'Name',
'l_lastSeen' => 'Last Seen',
'l_notificationStatus' => 'Notification status',
//Title //Title
't_createScene' => 'Create Scene', 't_createScene' => 'Create Scene',
@ -52,7 +60,15 @@ $lang = [
't_createAutomation' => 'Create Automation', 't_createAutomation' => 'Create Automation',
't_addDevice' => 'Add Device',
't_editDevice' => 'Edit Device', 't_editDevice' => 'Edit Device',
't_pageAfterLogIn' => 'Page After Login',
't_profile' => 'Profile',
't_notification' => 'Notification',
't_experimental' => 'Experimental',
't_' => 'Edit Device',
//constants //constants
'humi' => 'Humidity', 'humi' => 'Humidity',
@ -73,6 +89,19 @@ $lang = [
'w_neni' => 'At', 'w_neni' => 'At',
'w_is' => 'is', 'w_is' => 'is',
//tables
't_time' => 'Time',
't_state' => 'State',
//Days Long
'd_monday' => 'Monday',
'd_tuesday' => 'Tuesday',
'd_wednesday' => 'Wednesday',
'd_thursday' => 'Thursday',
'd_friday' => 'Friday',
'd_saturday' => 'Saturday',
'd_sunday' => 'Sunday',
//example //example
'' => '', '' => '',
]; ];

View File

@ -1,5 +1,5 @@
<?php <?php
$langMng = [ return $langMng = [
//Menu //Menu
'm_home' => 'Home', 'm_home' => 'Home',
'm_dashboard' => 'Dashboard', 'm_dashboard' => 'Dashboard',

View File

@ -14,24 +14,24 @@
<?php <?php
$partial = new Partial('menu'); $partial = new Partial('menu');
$partial->prepare('item','automation'); $partial->prepare('item','automation');
$partial->prepare('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$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 echo $LANG['t_createAutomation'];?></a> <a class="button is-primary m-1" onClick="$('#modal').removeClass('modal-container-hiden').show();"><?php $LANGMNG->echo('t_createAutomation'); ?></a>
<div class="row no-gutters"> <div class="row no-gutters">
<?php foreach ($AUTOMATIONS as $automationId => $automationData) { <?php foreach ($AUTOMATIONS as $automationId => $automationData) {
//BUTTON //BUTTON
$partial = new Partial('automationButton'); $partial = new Partial('automationButton');
$partial->prepare('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$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('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$partial->prepare('automationId',$automationId); $partial->prepare('automationId',$automationId);
$partial->prepare('automation',$automationData); $partial->prepare('automation',$automationData);
$partial->prepare('subDevices',$SUBDEVICES); $partial->prepare('subDevices',$SUBDEVICES);
@ -43,12 +43,12 @@
<?php <?php
if (isset($_POST['modalNext'])) { if (isset($_POST['modalNext'])) {
$partial = new Partial('automationCreateFinal'); $partial = new Partial('automationCreateFinal');
$partial->prepare('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$partial->prepare('subDevices',$SUBDEVICES); $partial->prepare('subDevices',$SUBDEVICES);
$partial->render(); $partial->render();
} else { } else {
$partial = new Partial('automationCreate'); $partial = new Partial('automationCreate');
$partial->prepare('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$partial->prepare('subDevices',$SUBDEVICES); $partial->prepare('subDevices',$SUBDEVICES);
$partial->render(); $partial->render();
} }

View File

@ -14,12 +14,12 @@
<?php <?php
$partial = new Partial('menu'); $partial = new Partial('menu');
$partial->prepare('item', 'dashboard'); $partial->prepare('item', 'dashboard');
$partial->prepare('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$partial->render(); $partial->render();
?> ?>
</div> </div>
<div class="col-md-9 main-body"> <div class="col-md-9 main-body">
<a onClick="$('#modal').removeClass('modal-container-hiden').show();" class="button is-primary m-1">Add Device</a> <a onClick="$('#modal').removeClass('modal-container-hiden').show();" class="button is-primary m-1"><?php $LANGMNG->echo('t_addDevice'); ?></a>
<div class="row no-gutters"> <div class="row no-gutters">
<?php foreach ($DASHBOARD as $dashboardItemId => $dashboardItemData) { <?php foreach ($DASHBOARD as $dashboardItemId => $dashboardItemData) {
$partialDeviceButton = new Partial('dashboardButton'); $partialDeviceButton = new Partial('dashboardButton');
@ -36,17 +36,17 @@
<div class="close"> <div class="close">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
</div> </div>
<h4 class="mb-4">Modal bitch</h4> <h4 class="mb-4"><?php $LANGMNG->echo('t_addDevice'); ?></h4>
<form method="post"> <form method="post">
<div class="field px-2"> <div class="field px-2">
<div class="label">Zvolte zařízení:</div> <div class="label"><?php $LANGMNG->echo('l_choseDevice'); ?>:</div>
<select class="input" name="devices[]" multiple> <select class="input" name="devices[]" multiple required>
<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){ ?> <?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){ ?>
<option value="<?php echo $subDeviceKey; ?>"><?php echo $subDeviceValue['name'] . '[' . $subDeviceValue['type'] . ']'; ?></option> <option value="<?php echo $subDeviceKey; ?>"><?php echo $subDeviceValue['name'] . '[' . $subDeviceValue['type'] . ']'; ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
<input type="submit" class="button" name="modalFinal" value="Next"/> <input type="submit" class="button" name="modalFinal" value="<?php $LANGMNG->echo('b_create'); ?>"/>
</form> </form>
</div> </div>
</div> </div>

View File

@ -14,7 +14,7 @@
<?php <?php
$partial = new Partial('menu'); $partial = new Partial('menu');
$partial->prepare('item', 'home'); $partial->prepare('item', 'home');
$partial->prepare('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$partial->render(); $partial->render();
?> ?>
</div> </div>
@ -25,7 +25,8 @@
<div class="label m-1"> <div class="label m-1">
<?php <?php
if ($USERSATHOME != "") { if ($USERSATHOME != "") {
echo $LANG['l_atHome'] . ': ' . $USERSATHOME; $LANGMNG->echo('l_atHome');
echo ': ' . $USERSATHOME;
} }
?> ?>
</div> </div>
@ -58,7 +59,7 @@
$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('lang',$LANG); $partialDetail->prepare('langMng',$LANGMNG);
$partialDetail->render(); $partialDetail->render();
@ -69,7 +70,7 @@
$partialEdit->prepare('device',$device); $partialEdit->prepare('device',$device);
$partialEdit->prepare('users',$USERS); $partialEdit->prepare('users',$USERS);
$partialEdit->prepare('rooms',$ROOMS); $partialEdit->prepare('rooms',$ROOMS);
$partialEdit->prepare('lang',$LANG); $partialEdit->prepare('langMng',$LANGMNG);
$partialEdit->render(); $partialEdit->render();
} }

View File

@ -14,7 +14,7 @@
<?php <?php
$partial = new Partial('menu'); $partial = new Partial('menu');
$partial->prepare('item', 'log'); $partial->prepare('item', 'log');
$partial->prepare('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$partial->render(); $partial->render();
?> ?>
</div> </div>
@ -22,13 +22,12 @@
<div class="col-12 col-sm-9 mx-auto mt-4"> <div class="col-12 col-sm-9 mx-auto mt-4">
<form method="post" action=""> <form method="post" action="">
<div class="field"> <div class="field">
<div class="label">LOG:CZ</div>
<select class="input" name="LogFile"> <select class="input" name="LogFile">
<?php foreach ($LOGSFILES as $key => $value) { ?> <?php foreach ($LOGSFILES as $key => $value) { ?>
<option value="<?php echo $value; ?>"><?php echo $value; ?></option> <option value="<?php echo $value; ?>"><?php echo $value; ?></option>
<?php } ?> <?php } ?>
</select> </select>
<input type="submit" class="button" name="selectFile" value="file"/> <input type="submit" class="button" name="selectFile" value="<?php $LANGMNG->echo('b_select');?>"/>
</div> </div>
</form> </form>
<?php <?php

View File

@ -53,10 +53,10 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<a class="button is-primary m-1" onclick="$('#modal').removeClass('modal-container-hiden').show();">restart</a> <a class="button is-primary m-1" onclick="$('#modal').removeClass('modal-container-hiden').show();"><?php $LANGMNG->echo('b_restart')?></a>
</div> </div>
<div class="col"> <div class="col">
<a class="button is-primary m-1" onclick="$('#modal').removeClass('modal-container-hiden').show();">deaktivovat</a> <a class="button is-primary m-1" onclick="$('#modal').removeClass('modal-container-hiden').show();"><?php $LANGMNG->echo('b_disable')?></a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,24 +1,24 @@
<div class="modal-container modal-container-hiden" id="modal"> <div class="modal-container modal-container-hiden" id="modal">
<div class="modal"> <div class="modal">
<a href=""><i class="fa fa-times close"></i></a> <a href=""><i class="fa fa-times close"></i></a>
<h4 class="mb-4"><?php echo $LANG['t_createAutomation']?></h4> <h4 class="mb-4"><?php $LANGMNG->echo('t_createAutomation')?></h4>
<form method="post"> <form method="post">
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['l_nameAt']?></div> <div class="label"><?php $LANGMNG->echo('l_nameAt')?></div>
<div class="field"> <div class="field">
<input class="input" type="text" name="name" required/> <input class="input" type="text" name="name" required/>
</div> </div>
<div class="label"><?php echo $LANG['l_runAt']?></div> <div class="label"><?php $LANGMNG->echo('l_runAt')?></div>
<div class="field"> <div class="field">
<select class="input" name="atSelector" id="valueSelector" required> <select class="input" name="atSelector" id="valueSelector" required>
<option value="sunSet"><?php echo $LANG['l_sunSet']?></option> <option value="sunSet"><?php $LANGMNG->echo('l_sunSet')?></option>
<option value="sunRise"><?php echo $LANG['l_sunRice']?></option> <option value="sunRise"><?php $LANGMNG->echo('l_sunRice')?></option>
<option value="inHome"><?php echo $LANG['l_inHome']?></option> <option value="inHome"><?php $LANGMNG->echo('l_inHome')?></option>
<option value="outHome"><?php echo $LANG['l_outHome']?></option> <option value="outHome"><?php $LANGMNG->echo('l_outHome')?></option>
<option value="time"><?php echo $LANG['l_time']?></option> <option value="time"><?php $LANGMNG->echo('l_time')?></option>
<option value="atDeviceValue"><?php echo $LANG['l_deviceValue'];?></option> <option value="atDeviceValue"><?php $LANGMNG->echo('l_deviceValue');?></option>
<option value="noOneHome"><?php echo $LANG['w_noOne'] . ' ' . $LANG['w_neni'] . ' ' . $LANG['w_home'];?></option> <option value="noOneHome"><?php $LANGMNG->echo('w_noOne') . ' ' . $LANGMNG->get('w_neni') . ' ' . $LANGMNG->get('w_home');?></option>
<option value="someOneHome"><?php echo $LANG['w_someOne'] . ' ' . $LANG['w_is'] . ' ' . $LANG['w_home'];?></option> <option value="someOneHome"><?php $LANGMNG->echo('w_someOne') . ' ' . $LANGMNG->get('w_is') . ' ' . $LANGMNG->get('w_home');?></option>
</select> </select>
<input class="input" type="time" name="atTime" id="atTime" disabled/> <input class="input" type="time" name="atTime" id="atTime" disabled/>
<select class="input" name="atDeviceValue" id="atDeviceValue" disabled> <select class="input" name="atDeviceValue" id="atDeviceValue" disabled>
@ -30,7 +30,7 @@
<input class="input" type="num" name="atDeviceValueInt" id="atDeviceValueInt" required disabled/> <input class="input" type="num" name="atDeviceValueInt" id="atDeviceValueInt" required disabled/>
</div> </div>
<div class="label"><?php echo $LANG['l_affectedDevices']?></div> <div class="label"><?php $LANGMNG->echo('l_affectedDevices')?></div>
<div class="field"> <div class="field">
<select class="input" name="devices[]" multiple> <select class="input" name="devices[]" multiple>
<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){ <?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){
@ -40,30 +40,30 @@
</select> </select>
</div> </div>
<div class="label"><?php echo $LANG['l_atDays']?></div> <div class="label"><?php $LANGMNG->echo('l_atDays')?></div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="mon"/> Pondělí <input type="checkbox" name="day[]" value="mon"/> <?php $LANGMNG->echo('d_monday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="tue"/> Úterý <input type="checkbox" name="day[]" value="tue"/> <?php $LANGMNG->echo('d_tuesday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="wed"/> Středa <input type="checkbox" name="day[]" value="wed"/> <?php $LANGMNG->echo('d_wednesday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="thu"/> Čtvrtek <input type="checkbox" name="day[]" value="thu"/> <?php $LANGMNG->echo('d_thursday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="fri"/> Pátek <input type="checkbox" name="day[]" value="fri"/> <?php $LANGMNG->echo('d_friday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="sat"/> Sobota <input type="checkbox" name="day[]" value="sat"/> <?php $LANGMNG->echo('d_saturday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="sun"/> Neděle <input type="checkbox" name="day[]" value="sun"/> <?php $LANGMNG->echo('d_sunday'); ?>
</div> </div>
</div> </div>
<input type="submit" class="button" name="modalNext" value="<?php echo $LANG['b_next']?>"/> <input type="submit" class="button" name="modalNext" value="<?php $LANGMNG->echo('b_next')?>"/>
</form> </form>
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
<div class="modal-container" id="modal"> <div class="modal-container" id="modal">
<div class="modal"> <div class="modal">
<a href=""><i class="fa fa-times close"></i></a> <a href=""><i class="fa fa-times close"></i></a>
<h4 class="mb-4"><?php echo $LANG['t_createAutomation']?></h4> <h4 class="mb-4"><?php $LANGMNG->echo('t_createAutomation'); ?></h4>
<form method="post"> <form method="post">
<div class="field"> <div class="field">
<input type="hidden" name="atSelector" value="<?php echo $_POST['atSelector']; ?>" required/> <input type="hidden" name="atSelector" value="<?php echo $_POST['atSelector']; ?>" required/>
@ -34,7 +34,7 @@
</select> </select>
<?php } ?> <?php } ?>
</div> </div>
<input type="submit" class="button" name="modalFinal" value="Next"/> <input type="submit" class="button" name="modalFinal" value="<?php $LANGMNG->echo('b_finish'); ?>"/>
</form> </form>
</div> </div>
</div> </div>

View File

@ -3,26 +3,26 @@
<div class="close"> <div class="close">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
</div> </div>
<h4 class="mb-4"><?php echo $LANG['t_createAutomation']?></h4> <h4 class="mb-4"><?php $LANGMNG->echo('t_createAutomation');?></h4>
<form method="post"> <form method="post">
<input name="automation_id" type="hidden" value="<?php echo $AUTOMATIONID; ?>"> <input name="automation_id" type="hidden" value="<?php echo $AUTOMATIONID; ?>">
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['l_nameAt']?></div> <div class="label"><?php $LANGMNG->echo('l_nameAt');?></div>
<div class="field"> <div class="field">
<input class="input" type="text" name="name" value="<?php echo (isset ($AUTOMATION['name']) ? $AUTOMATION['name'] : ""); ?>" required/> <input class="input" type="text" name="name" value="<?php echo (isset ($AUTOMATION['name']) ? $AUTOMATION['name'] : ""); ?>" required/>
</div> </div>
<div class="label"><?php echo $LANG['l_runAt']?></div> <div class="label"><?php $LANGMNG->echo('l_runAt');?></div>
<div class="field"> <div class="field">
<?php //TODO Dodělat identifikaci pro Selctor události a selector času zařízení hodnoty ?> <?php //TODO Dodělat identifikaci pro Selctor události a selector času zařízení hodnoty ?>
<select class="input" name="atSelector" id="valueSelector" required> <select class="input" name="atSelector" id="valueSelector" required>
<option value="sunSet" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "sunSet" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_sunSet']?></option> <option value="sunSet" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "sunSet" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_sunSet');?></option>
<option value="sunRise" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "sunRise" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_sunRice']?></option> <option value="sunRise" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "sunRise" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_sunRice');?></option>
<option value="inHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "inHome" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_inHome']?></option> <option value="inHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "inHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_inHome');?></option>
<option value="outHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "outHome" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_outHome']?></option> <option value="outHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "outHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_outHome');?></option>
<option value="time" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_time']?></option> <option value="time" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_time');?></option>
<option value="atDeviceValue" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_deviceValue'];?></option> <option value="atDeviceValue" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_deviceValue');;?></option>
<option value="noOneHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "noOneHome" ? 'selected="selected"' : ''); ?>><?php echo $LANG['w_noOne'] . ' ' . $LANG['w_neni'] . ' ' . $LANG['w_home'];?></option> <option value="noOneHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "noOneHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('w_noOne'); echo ' ' . $LANGMNG->get('w_neni') . ' ' . $LANGMNG->get('w_home');?></option>
<option value="someOneHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "someOneHome" ? 'selected="selected"' : ''); ?>><?php echo $LANG['w_someOne'] . ' ' . $LANG['w_is'] . ' ' . $LANG['w_home'];?></option> <option value="someOneHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "someOneHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('w_someOne'); echo ' ' . $LANGMNG->get('w_is') . ' ' . $LANGMNG->get('w_home');?></option>
</select> </select>
<input class="input" type="time" name="atTime" id="atTime" value="<?php echo (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? json_decode($AUTOMATION['ifSomething'], true)['value'] : ""); ?>" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? '' : 'disabled'); ?>/> <input class="input" type="time" name="atTime" id="atTime" value="<?php echo (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? json_decode($AUTOMATION['ifSomething'], true)['value'] : ""); ?>" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? '' : 'disabled'); ?>/>
<select class="input" name="atDeviceValue" id="atDeviceValue" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? '' : 'disabled'); ?>> <select class="input" name="atDeviceValue" id="atDeviceValue" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? '' : 'disabled'); ?>>
@ -34,7 +34,7 @@
<input class="input" type="text" name="atDeviceValueInt" id="atDeviceValueInt" required <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? '' : 'disabled'); ?>/> <input class="input" type="text" name="atDeviceValueInt" id="atDeviceValueInt" required <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? '' : 'disabled'); ?>/>
</div> </div>
<div class="label"><?php echo $LANG['l_affectedDevices'];?></div> <div class="label"><?php $LANGMNG->echo('l_affectedDevices'); ?></div>
<div class="field"> <div class="field">
<div class="field px-2"> <div class="field px-2">
<?php <?php
@ -53,31 +53,31 @@
} ?> } ?>
</div> </div>
</div> </div>
<div class="label"><?php echo $LANG['l_atDays'];?></div> <div class="label"><?php $LANGMNG->echo('l_atDays');?></div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="mon" <?php ECHO (in_array("mon", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Pondělí <input type="checkbox" name="day[]" value="mon" <?php ECHO (in_array("mon", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_monday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="tue" <?php ECHO (in_array("tue", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Úterý <input type="checkbox" name="day[]" value="tue" <?php ECHO (in_array("tue", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_tuesday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="wed" <?php ECHO (in_array("wed", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Středa <input type="checkbox" name="day[]" value="wed" <?php ECHO (in_array("wed", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_wednesday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="thu" <?php ECHO (in_array("thu", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Čtvrtek <input type="checkbox" name="day[]" value="thu" <?php ECHO (in_array("thu", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_thursday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="fri" <?php ECHO (in_array("fri", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Pátek <input type="checkbox" name="day[]" value="fri" <?php ECHO (in_array("fri", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_friday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="sat" <?php ECHO (in_array("sat", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Sobota <input type="checkbox" name="day[]" value="sat" <?php ECHO (in_array("sat", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_saturday'); ?>
</div> </div>
<div class="field"> <div class="field">
<input type="checkbox" name="day[]" value="sun" <?php ECHO (in_array("sun", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Neděle <input type="checkbox" name="day[]" value="sun" <?php ECHO (in_array("sun", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_sunday'); ?>
</div> </div>
</div> </div>
<input type="submit" class="button" name="modalFinal" value="<?php echo $LANG['b_edit'];?>"/> <input type="submit" class="button" name="modalFinal" value="<?php $LANGMNG->echo('b_edit'); ?>"/>
<input type="submit" class="button is-danger" onClick="ajaxPostSimple('ajax',{automation_id: '<?php echo $AUTOMATIONID ?>', action:'delete'}, true);" name="remove" value="<?php echo $LANG['b_remove'];?>"/> <input type="submit" class="button is-danger" onClick="ajaxPostSimple('ajax',{automation_id: '<?php echo $AUTOMATIONID ?>', action:'delete'}, true);" name="remove" value="<?php $LANGMNG->echo('b_remove');?>"/>
</form> </form>
</div> </div>

View File

@ -6,7 +6,7 @@
</div> </div>
<h4 class="mb-4"><?php echo $DEVICE['name']; ?></h4> <h4 class="mb-4"><?php echo $DEVICE['name']; ?></h4>
<h5 class="mb-4"><?php echo $SUBDEVICE['lastRecort']['value'] . $SUBDEVICE['unit']?></h5> <h5 class="mb-4"><?php echo $SUBDEVICE['lastRecort']['value'] . $SUBDEVICE['unit']?></h5>
<p>Last Seen <?php echo $SUBDEVICE['lastRecort']['niceTime']; ?></p> <p><?php $LANGMNG->echo('l_lastSeen'); echo ' ' . $SUBDEVICE['lastRecort']['niceTime']; ?></p>
<div class=""> <div class="">
<canvas id="canvas-<?php echo $SUBDEVICEID;?>"></canvas> <canvas id="canvas-<?php echo $SUBDEVICEID;?>"></canvas>
</div> </div>
@ -18,7 +18,7 @@
data-period="year" data-period="year"
data-group="month" data-group="month"
data-sub-device-id="<?php echo $SUBDEVICEID;?>" data-sub-device-id="<?php echo $SUBDEVICEID;?>"
value="<?php echo $LANG['b_year']?>" value="<?php $LANGMNG->echo('b_year');?>"
/> />
<input <input
@ -27,7 +27,7 @@
data-period="month" data-period="month"
data-group="day" data-group="day"
data-sub-device-id="<?php echo $SUBDEVICEID;?>" data-sub-device-id="<?php echo $SUBDEVICEID;?>"
value="<?php echo $LANG['b_month']?>" value="<?php $LANGMNG->echo('b_month');?>"
/> />
<input <input
@ -36,7 +36,7 @@
data-period="week" data-period="week"
data-group="day" data-group="day"
data-sub-device-id="<?php echo $SUBDEVICEID;?>" data-sub-device-id="<?php echo $SUBDEVICEID;?>"
value="<?php echo $LANG['b_week']?>" value="<?php $LANGMNG->echo('b_week');?>"
/> />
<input <input
@ -45,7 +45,7 @@
data-period="day" data-period="day"
data-group="hour" data-group="hour"
data-sub-device-id="<?php echo $SUBDEVICEID;?>" data-sub-device-id="<?php echo $SUBDEVICEID;?>"
value="<?php echo $LANG['b_day']?>" value="<?php $LANGMNG->echo('b_day');?>"
/> />
<input <input
@ -54,15 +54,15 @@
data-period="hour" data-period="hour"
data-group="minute" data-group="minute"
data-sub-device-id="<?php echo $SUBDEVICEID;?>" data-sub-device-id="<?php echo $SUBDEVICEID;?>"
value="<?php echo $LANG['b_hour']?>" value="<?php $LANGMNG->echo('b_hour');?>"
/> />
<div> <div>
<table class="table is-fluid"> <table class="table is-fluid">
<thead> <thead>
<tr> <tr>
<th>Time</th> <th><?php $LANGMNG->echo('t_time');?></th>
<th>State</th> <th><?php $LANGMNG->echo('t_state');?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -3,15 +3,15 @@
<div class="close"> <div class="close">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
</div> </div>
<h4 class="mb-4"><?php echo $LANG['t_editDevice']; ?></h4> <h4 class="mb-4"><?php $LANGMNG->echo('t_editDevice'); ?></h4>
<form method="post" action=""> <form method="post" action="">
<input class="input" type="hidden" name="deviceId" value="<?php echo $DEVICEID; ?>"> <input class="input" type="hidden" name="deviceId" value="<?php echo $DEVICEID; ?>">
<?php if ($DEVICE['approved'] != 0) { ?> <?php if ($DEVICE['approved'] != 0) { ?>
<?php if ($DEVICE['userIsAdmin']) { ?> <?php if ($DEVICE['userIsAdmin']) { ?>
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['l_owner']; ?></div> <div class="label"><?php $LANGMNG->echo('l_owner'); ?></div>
<select class="input" name="deviceOwnerUserId"> <select class="input" name="deviceOwnerUserId">
<option value=""><?php echo $LANG['w_noOne']; ?></option> <option value=""><?php $LANGMNG->echo('w_noOne'); ?></option>
<?php foreach ($USERS as $user) { <?php foreach ($USERS as $user) {
$userId = $user['user_id']; $userId = $user['user_id'];
$userName = $user['username']; $userName = $user['username'];
@ -20,11 +20,11 @@
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
<div class="label"> <?php echo $LANG['l_permission']; ?></div> <div class="label"><?php $LANGMNG->echo('l_permission'); ?></div>
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<div class="label"> - <?php echo $LANG['l_owner']; ?></div> <div class="label"> - <?php $LANGMNG->echo('l_owner'); ?></div>
</div> </div>
<div class="col-6"> <div class="col-6">
@ -37,24 +37,24 @@
echo '</pre>'; echo '</pre>';
} }
?> ?>
<input type="radio" name="permissionOwner" value=1 <?php ECHO ($permissions[0] == 1 ? 'checked' : ''); ?>/> <?php echo $LANG['l_read']; ?> <input type="radio" name="permissionOwner" value=1 <?php ECHO ($permissions[0] == 1 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_read'); ?>
<input type="radio" name="permissionOwner" value=2 <?php ECHO ($permissions[0] == 2 ? 'checked' : ''); ?>/> <?php echo $LANG['l_use']; ?> <input type="radio" name="permissionOwner" value=2 <?php ECHO ($permissions[0] == 2 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_use'); ?>
<input type="radio" name="permissionOwner" value=3 <?php ECHO ($permissions[0] == 3 ? 'checked' : ''); ?>/> <?php echo $LANG['l_edit']; ?> <input type="radio" name="permissionOwner" value=3 <?php ECHO ($permissions[0] == 3 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_edit'); ?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<div class="label"> - <?php echo $LANG['l_member']; ?></div> <div class="label"> - <?php $LANGMNG->echo('l_member'); ?></div>
</div> </div>
<div class="col-6"> <div class="col-6">
<input type="radio" name="permissionOther" value=1 <?php ECHO ($permissions[1] == 1 ? 'checked' : ''); ?>/> <?php echo $LANG['l_read']; ?> <input type="radio" name="permissionOther" value=1 <?php ECHO ($permissions[1] == 1 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_read'); ?>
<input type="radio" name="permissionOther" value=2 <?php ECHO ($permissions[1] == 2 ? 'checked' : ''); ?>/> <?php echo $LANG['l_use']; ?> <input type="radio" name="permissionOther" value=2 <?php ECHO ($permissions[1] == 2 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_use'); ?>
<input type="radio" name="permissionOther" value=3 <?php ECHO ($permissions[1] == 3 ? 'checked' : ''); ?>/> <?php echo $LANG['l_edit']; ?> <input type="radio" name="permissionOther" value=3 <?php ECHO ($permissions[1] == 3 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_edit'); ?>
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['w_title']; ?></div> <div class="label"><?php $LANGMNG->echo('w_title'); ?></div>
<input class="input" type="text" name="deviceName" value="<?php echo $DEVICE['name']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>> <input class="input" type="text" name="deviceName" value="<?php echo $DEVICE['name']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
</div> </div>
<?php } ?> <?php } ?>
@ -65,13 +65,13 @@
<?php if ($DEVICE['userIsAdmin']) { ?> <?php if ($DEVICE['userIsAdmin']) { ?>
<?php if (!in_array($SUBDEVICE['type'], ['on/off', 'door', 'water'])) { ?> <?php if (!in_array($SUBDEVICE['type'], ['on/off', 'door', 'water'])) { ?>
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['l_sleepTime']; ?></div> <div class="label"><?php $LANGMNG->echo('l_sleepTime'); ?></div>
<input class="input" type="int" name="sleepTime" value="<?php echo $DEVICE['sleepTime']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>> <input class="input" type="int" name="sleepTime" value="<?php echo $DEVICE['sleepTime']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
<p>* - <?php echo $LANG['l_inMinutes']; ?></p> <p>* - <?php $LANGMNG->echo('l_inMinutes'); ?></p>
</div> </div>
<?php }?> <?php }?>
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['w_room']; ?></div> <div class="label"><?php $LANGMNG->echo('w_room'); ?></div>
<select class="input" name="deviceOwnerId"> <select class="input" name="deviceOwnerId">
<?php foreach ($ROOMS as $room) { <?php foreach ($ROOMS as $room) {
$roomId = $room['room_id']; $roomId = $room['room_id'];
@ -82,9 +82,9 @@
</select> </select>
</div> </div>
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['w_icon']; ?></div> <div class="label"><?php $LANGMNG->echo('w_icon'); ?></div>
<select class="input fa" name="deviceIcon" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>> <select class="input fa" name="deviceIcon" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
<option value=""><?php echo $LANG['w_no'] . ' ' . $LANG['w_icon']; ?></option> <option value=""><?php $LANGMNG->echo('w_no'); ?><?php echo ' '; ?><?php $LANGMNG->echo('w_icon'); ?></option>
<option value="f0eb" <?php ECHO ($DEVICE['icon'] == "f0eb" ? 'selected="selected"' : ''); ?>>&#xf0eb; - fa-lightbulb-o</option> <option value="f0eb" <?php ECHO ($DEVICE['icon'] == "f0eb" ? 'selected="selected"' : ''); ?>>&#xf0eb; - fa-lightbulb-o</option>
<option value="f2dc" <?php ECHO ($DEVICE['icon'] == "f2dc" ? 'selected="selected"' : ''); ?>>&#xf2dc; - fa-snowflake-o</option> <option value="f2dc" <?php ECHO ($DEVICE['icon'] == "f2dc" ? 'selected="selected"' : ''); ?>>&#xf2dc; - fa-snowflake-o</option>
<option value="f0e7" <?php ECHO ($DEVICE['icon'] == "f0e7" ? 'selected="selected"' : ''); ?>>&#xf0e7; - fa-bolt</option> <option value="f0e7" <?php ECHO ($DEVICE['icon'] == "f0e7" ? 'selected="selected"' : ''); ?>>&#xf0e7; - fa-bolt</option>
@ -98,7 +98,7 @@
</div> </div>
<?php } ?> <?php } ?>
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['w_moduls']; ?></div> <div class="label"><?php $LANGMNG->echo('w_moduls'); ?></div>
<div class="row no-gutters"> <div class="row no-gutters">
<?php foreach ($DEVICE['subDevices'] as $subDeviceKey => $subDevice) { ?> <?php foreach ($DEVICE['subDevices'] as $subDeviceKey => $subDevice) { ?>
<div class="col-4 col-sm-3 col-xl-2 square-wrap"> <div class="col-4 col-sm-3 col-xl-2 square-wrap">
@ -123,11 +123,11 @@
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
<input type="submit" class="button" name="saveDevice" value="<?php echo $LANG['b_save']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>/> <input type="submit" class="button" name="saveDevice" value="<?php $LANGMNG->echo('b_save'); ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>/>
<input type="submit" class="button is-danger" name="disableDevice" value="<?php echo $LANG['b_disable']; ?>"/> <input type="submit" class="button is-danger" name="disableDevice" value="<?php $LANGMNG->echo('b_disable'); ?>"/>
<?php } else { ?> <?php } else { ?>
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['w_moduls']; ?></div> <div class="label"><?php $LANGMNG->echo('w_moduls'); ?></div>
<div class="row no-gutters"> <div class="row no-gutters">
<?php foreach ($DEVICE['subDevices'] as $subDeviceKey => $subDevice) { ?> <?php foreach ($DEVICE['subDevices'] as $subDeviceKey => $subDevice) { ?>
<div class="col-4 col-sm-3 col-xl-2 square-wrap"> <div class="col-4 col-sm-3 col-xl-2 square-wrap">
@ -152,8 +152,8 @@
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
<input type="submit" class="button is-primary" name="approveDevice" value="<?php echo $LANG['b_approve']; ?>"/> <input type="submit" class="button is-primary" name="approveDevice" value="<?php $LANGMNG->echo('b_approve'); ?>"/>
<input type="submit" class="button is-danger" name="disableDevice" value="<?php echo $LANG['b_disable']; ?>"/> <input type="submit" class="button is-danger" name="disableDevice" value="<?php $LANGMNG->echo('b_disable'); ?>"/>
<?php } ?> <?php } ?>
</form> </form>
</div> </div>

View File

@ -37,7 +37,7 @@
<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>
<span> <span>
<?php echo $LANG['m_'.$value['lngKey']]; ?> <?php $LANGMNG->echo('m_'.$value['lngKey']); ?>
</span> </span>
</a> </a>
</div> </div>

View File

@ -3,14 +3,14 @@
<div class="close"> <div class="close">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
</div> </div>
<h4 class="mb-4"><?php echo $LANG['t_createScene'];?></h4> <h4 class="mb-4"><?php $LANGMNG->echo('t_createScene');?></h4>
<form method="post" action="" > <form method="post" action="" >
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['w_title'];?>:</div> <div class="label"><?php $LANGMNG->echo('w_title');?>:</div>
<input type="text" class="input" name="sceneName" value=""/> <input type="text" class="input" name="sceneName" value=""/>
</div> </div>
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['w_icon'];?>:</div> <div class="label"><?php $LANGMNG->echo('w_icon');?>:</div>
<select class="input fa" name="sceneIcon" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>> <select class="input fa" name="sceneIcon" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
<option value="">No icon</option> <option value="">No icon</option>
<option value="f0eb">&#xf0eb; - fa-lightbulb-o</option> <option value="f0eb">&#xf0eb; - fa-lightbulb-o</option>
@ -25,7 +25,7 @@
</select> </select>
</div> </div>
<div class="field"> <div class="field">
<div class="label"><?php echo $LANG['l_choseDevice'];?></div> <div class="label"><?php $LANGMNG->echo('l_choseDevice');?></div>
<select class="input" name="devices[]" multiple> <select class="input" name="devices[]" multiple>
<?php <?php
foreach ($SUBDEVICES as $subdeviceId => $subdeviceData) { foreach ($SUBDEVICES as $subdeviceId => $subdeviceData) {
@ -34,7 +34,7 @@
?> ?>
</select> </select>
</div> </div>
<input type="submit" class="button" name="submit" value="<?php echo $LANG['b_next'];?>"/> <input type="submit" class="button" name="submit" value="<?php $LANGMNG->echo('b_next');?>"/>
</form> </form>
</div> </div>
</div> </div>

View File

@ -14,17 +14,17 @@
<?php <?php
$partial = new Partial('menu'); $partial = new Partial('menu');
$partial->prepare('item', 'scene'); $partial->prepare('item', 'scene');
$partial->prepare('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$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 echo $LANG['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('lang', $LANG); $partialScenButton->prepare('langMng', $LANGMNG);
$partialScenButton->prepare('sceneId', $sceneId); $partialScenButton->prepare('sceneId', $sceneId);
$partialScenButton->prepare('sceneData', $sceneData); $partialScenButton->prepare('sceneData', $sceneData);
@ -32,7 +32,7 @@
// Edit // Edit
$partialSceneEdit = new Partial('sceneEdit'); $partialSceneEdit = new Partial('sceneEdit');
$partialSceneEdit->prepare('lang',$LANG); $partialSceneEdit->prepare('langMng',$LANGMNG);
$partialSceneEdit->prepare('sceneId',$sceneId); $partialSceneEdit->prepare('sceneId',$sceneId);
$partialSceneEdit->prepare('scene',$sceneData); $partialSceneEdit->prepare('scene',$sceneData);
@ -45,7 +45,7 @@
<?php if (isset($_POST['devices'])) { <?php if (isset($_POST['devices'])) {
$partial = new Partial('sceneCreateOptions'); $partial = new Partial('sceneCreateOptions');
$partial->prepare('lang',$LANG); $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 );
@ -53,7 +53,7 @@
$partial->render(); $partial->render();
} else { } else {
$partial = new Partial('sceneCreate'); $partial = new Partial('sceneCreate');
$partial->prepare('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$partial->prepare('subDevices',$SUBDEVICES); $partial->prepare('subDevices',$SUBDEVICES);
$partial->render(); $partial->render();

View File

@ -14,13 +14,15 @@
<?php <?php
$partial = new Partial('menu'); $partial = new Partial('menu');
$partial->prepare('item', 'setting'); $partial->prepare('item', 'setting');
$partial->prepare('lang',$LANG); $partial->prepare('langMng',$LANGMNG);
$partial->render(); $partial->render();
?> ?>
</div> </div>
<div class="col-md-9 main-body"> <div class="col-md-9 main-body">
<div class="col-12 col-sm-9 mx-auto mt-4"> <div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4">Stránka po načtení</h4> <h4 class="mb-4">
<?php $LANGMNG->echo('t_pageAfterLogIn') ?>
</h4>
<form method="post" enctype="multipart/form-data"> <form method="post" enctype="multipart/form-data">
<div class=""> <div class="">
<div class="field"> <div class="field">
@ -29,28 +31,28 @@
<option value="1" <?php echo (UserManager::getUserData("startPage") == 1 ? "selected" : ""); ?>>Dashboard</option> <option value="1" <?php echo (UserManager::getUserData("startPage") == 1 ? "selected" : ""); ?>>Dashboard</option>
</select> </select>
</div> </div>
<input type="submit" name="submit" class="button" value="Uložit"/> <input type="submit" name="submit" class="button" value="<?php $LANGMNG->echo('b_save') ?>"/>
</div> </div>
</div> </div>
</form> </form>
<div class="col-12 col-sm-9 mx-auto mt-4"> <div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4">Profil</h4> <h4 class="mb-4"><?php $LANGMNG->echo('t_profile') ?></h4>
<div class="field"> <div class="field">
<a href="logout" class="button is-primary">Odhlásit se</a> <a href="logout" class="button is-primary"><?php $LANGMNG->echo('b_logOut') ?></a>
</div> </div>
</div> </div>
<div class="col-12 col-sm-9 mx-auto mt-4"> <div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4">Notifications</h4> <h4 class="mb-4"><?php $LANGMNG->echo('t_notification') ?></h4>
<input id="notifications" type="checkbox" onChange="toggleNotificationPermissions(this);" /> <input id="notifications" type="checkbox" onChange="toggleNotificationPermissions(this);" />
<div class="label">Status notifikací</div> <div class="label"><?php $LANGMNG->echo('l_notificationStatus') ?></div>
<div class="field"> <div class="field">
<a onClick="sendTestNotification();" class="button">Test Notification</a> <a onClick="sendTestNotification();" class="button"><?php $LANGMNG->echo('b_sendTestNotification');?></a>
</div> </div>
</div> </div>
<div class="col-12 col-sm-9 mx-auto mt-4"> <div class="col-12 col-sm-9 mx-auto mt-4">
<h4 class="mb-4">Logs</h4> <h4 class="mb-4"><?php $LANGMNG->echo('t_experimental') ?></h4>
<div class="field"> <div class="field">
<a href="rooms" class="button">ROOMS</a> <a href="rooms" class="button"><?php $LANGMNG->echo('b_rooms') ?></a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -10,7 +10,7 @@ class Automation extends Template
function __construct() function __construct()
{ {
global $userManager; global $userManager;
global $lang; global $langMng;
if (!$userManager->isLogin()){ if (!$userManager->isLogin()){
header('Location: ./login'); header('Location: ./login');
@ -52,7 +52,7 @@ class Automation extends Template
$template = new Template('automation'); $template = new Template('automation');
$template->prepare('title', 'Automation'); $template->prepare('title', 'Automation');
$template->prepare('lang', $lang); $template->prepare('langMng', $langMng);
$template->prepare('automations', $automations); $template->prepare('automations', $automations);
$template->prepare('subDevices', $approvedSubDevices); $template->prepare('subDevices', $approvedSubDevices);

View File

@ -4,7 +4,7 @@ class Dashboard extends Template
function __construct() function __construct()
{ {
global $userManager; global $userManager;
global $lang; global $langMng;
if (!$userManager->isLogin()){ if (!$userManager->isLogin()){
header('Location: ./login'); header('Location: ./login');
@ -81,7 +81,7 @@ class Dashboard extends Template
} }
$template->prepare('title', 'Nástěnka'); $template->prepare('title', 'Nástěnka');
$template->prepare('lang', $lang); $template->prepare('langMng', $langMng);
$template->prepare('dashboard', $dashboard); $template->prepare('dashboard', $dashboard);
$template->prepare('subDevices', $approvedSubDevices); $template->prepare('subDevices', $approvedSubDevices);

View File

@ -6,7 +6,7 @@ class Home extends Template
function __construct() function __construct()
{ {
global $userManager; global $userManager;
global $lang; global $langMng;
if (!$userManager->isLogin()){ if (!$userManager->isLogin()){
header('Location: ./login'); header('Location: ./login');
@ -171,7 +171,7 @@ class Home extends Template
$rooms = RoomManager::getAllRooms(); $rooms = RoomManager::getAllRooms();
$template->prepare('rooms', $rooms); $template->prepare('rooms', $rooms);
$template->prepare('title', 'Home'); $template->prepare('title', 'Home');
$template->prepare('lang', $lang); $template->prepare('langMng', $langMng);
$template->prepare('data', $roomsItems); $template->prepare('data', $roomsItems);
$template->render(); $template->render();

View File

@ -6,7 +6,7 @@ class Log extends Template
function __construct() function __construct()
{ {
global $userManager; global $userManager;
global $lang; global $langMng;
if (!$userManager->isLogin()){ if (!$userManager->isLogin()){
header('Location: ./login'); header('Location: ./login');
@ -26,7 +26,7 @@ class Log extends Template
} }
$template->prepare('logsFiles', $result); $template->prepare('logsFiles', $result);
$template->prepare('lang', $lang); $template->prepare('langMng', $langMng);
$template->render(); $template->render();

View File

@ -4,7 +4,7 @@ class Scene extends Template
function __construct() function __construct()
{ {
global $userManager; global $userManager;
global $lang; global $langMng;
if (!$userManager->isLogin()){ if (!$userManager->isLogin()){
header('Location: ./'); header('Location: ./');
@ -12,7 +12,7 @@ class Scene extends Template
$template = new Template('scene'); $template = new Template('scene');
$template->prepare('title', 'Scény'); $template->prepare('title', 'Scény');
$template->prepare('lang', $lang); $template->prepare('langMng', $langMng);
$scenes = []; $scenes = [];
foreach (SceneManager::getAllScenes() as $sceneId => $sceneData) { foreach (SceneManager::getAllScenes() as $sceneId => $sceneData) {

View File

@ -4,7 +4,7 @@ class Setting extends Template
function __construct() function __construct()
{ {
global $userManager; global $userManager;
global $lang; global $langMng;
if (!$userManager->isLogin()){ if (!$userManager->isLogin()){
header('Location: ./login'); header('Location: ./login');
@ -23,7 +23,7 @@ class Setting extends Template
$template = new Template('setting'); $template = new Template('setting');
$template->prepare('title', 'Automation'); $template->prepare('title', 'Automation');
$template->prepare('lang', $lang); $template->prepare('langMng', $langMng);
$template->prepare('automations', $automations); $template->prepare('automations', $automations);
$template->render(); $template->render();

View File

@ -25,21 +25,21 @@ foreach (["class", "views"] as $dir) {
/** Language **/ /** Language **/
$langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); $langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$langMng = new LanguageManager($langTag); $langMng = new LanguageManager($langTag, DEBUGMOD);
$langMng->load(); $langMng->load();
if (DEBUGMOD == 1) { if (DEBUGMOD == 1) {
echo '<div class="col-md-9 main-body">'; // echo '<div class="col-md-9 main-body">';
echo '<pre>'; // echo '<pre>';
echo 'Language SLUG: ' . $langTag; // echo 'Language SLUG: ' . $langTag;
echo '</pre>'; // echo '</pre>';
echo '<pre>'; // echo '<pre>';
print_r(get_defined_constants()); // print_r(get_defined_constants());
echo '</pre>'; // echo '</pre>';
echo '<pre>'; // echo '<pre>';
print_r(get_defined_vars()); // print_r(get_defined_vars());
echo '</pre>'; // echo '</pre>';
echo '</dev>'; // echo '</dev>';
} }
//DB Conector //DB Conector