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 $lngDatabase = [];
private $debug = false;
function __construct(string $lngCode)
function __construct(string $lngCode, bool $debug = false)
{
$this->lngCode = $lngCode;
$this->debug = $debug;
}
function load()
{
$file = './app/lang/en.php';
if (!file_exists($file)){
die();
//TODO add lng EXEPTIONS
}
$arrayFirst = include($file);
$file = './app/lang/' . $this->lngCode . '.php';
$arraySecond = include($file);
$arraySecond = [];
if (file_exists($file)){
$arraySecond = include($file);
}
$this->lngDatabase = array_merge($arrayFirst,$arraySecond);
return true;
}
function get(string $stringKey)
{
if ($this->debug) {
return $stringKey;
}
if (isset($this->lngDatabase[$stringKey])) {
return $this->lngDatabase[$stringKey];
}
@ -33,9 +45,15 @@ class LanguageManager
function echo(string $stringKey)
{
if (isset($this->lngDatabase[$stringKey])) {
return $this->lngDatabase[$stringKey];
if ($this->debug) {
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
$lang = [
return $lang = [
//Menu
'm_home' => 'Domů',
'm_dashboard' => 'Nástěnka',
@ -45,6 +45,7 @@ $lang = [
'l_sleepTime' => 'Doba spánku zařízení',
'l_atHome' => 'Doma Jsou',
'l_nameAt' => 'Název',
'l_lastSeen' => 'Naposledy připojeno',
//Title
't_createScene' => 'Vytvořit scénu',

View File

@ -1,5 +1,5 @@
<?php
$lang = [
return $lang = [
//Menu
'm_home' => 'Home',
'm_dashboard' => 'Dashboard',
@ -21,6 +21,12 @@ $lang = [
'b_approve' => 'Approve',
'b_disable' => 'Disable',
'b_save' => 'Save',
'b_logOut' => 'Logout',
'b_sendTestNotification' => 'Send Test Notification',
'b_rooms' => 'Rooms',
'b_restart' => 'Restart',
'b_disable' => 'disabele',
'b_select' => 'Select',
//labels
@ -45,6 +51,8 @@ $lang = [
'l_sleepTime' => 'Device sleep Time',
'l_atHome' => 'At home',
'l_nameAt' => 'Name',
'l_lastSeen' => 'Last Seen',
'l_notificationStatus' => 'Notification status',
//Title
't_createScene' => 'Create Scene',
@ -52,7 +60,15 @@ $lang = [
't_createAutomation' => 'Create Automation',
't_addDevice' => 'Add Device',
't_editDevice' => 'Edit Device',
't_pageAfterLogIn' => 'Page After Login',
't_profile' => 'Profile',
't_notification' => 'Notification',
't_experimental' => 'Experimental',
't_' => 'Edit Device',
//constants
'humi' => 'Humidity',
@ -73,6 +89,19 @@ $lang = [
'w_neni' => 'At',
'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
'' => '',
];

View File

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

View File

@ -14,24 +14,24 @@
<?php
$partial = new Partial('menu');
$partial->prepare('item','automation');
$partial->prepare('lang',$LANG);
$partial->prepare('langMng',$LANGMNG);
$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 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">
<?php foreach ($AUTOMATIONS as $automationId => $automationData) {
//BUTTON
$partial = new Partial('automationButton');
$partial->prepare('lang',$LANG);
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('automationId',$automationId);
$partial->prepare('automationData',$automationData);
$partial->render();
//EDIT
$partial = new Partial('automationEdit');
$partial->prepare('lang',$LANG);
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('automationId',$automationId);
$partial->prepare('automation',$automationData);
$partial->prepare('subDevices',$SUBDEVICES);
@ -43,12 +43,12 @@
<?php
if (isset($_POST['modalNext'])) {
$partial = new Partial('automationCreateFinal');
$partial->prepare('lang',$LANG);
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('subDevices',$SUBDEVICES);
$partial->render();
} else {
$partial = new Partial('automationCreate');
$partial->prepare('lang',$LANG);
$partial->prepare('langMng',$LANGMNG);
$partial->prepare('subDevices',$SUBDEVICES);
$partial->render();
}

View File

@ -14,12 +14,12 @@
<?php
$partial = new Partial('menu');
$partial->prepare('item', 'dashboard');
$partial->prepare('lang',$LANG);
$partial->prepare('langMng',$LANGMNG);
$partial->render();
?>
</div>
<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">
<?php foreach ($DASHBOARD as $dashboardItemId => $dashboardItemData) {
$partialDeviceButton = new Partial('dashboardButton');
@ -36,17 +36,17 @@
<div class="close">
<i class="fa fa-times"></i>
</div>
<h4 class="mb-4">Modal bitch</h4>
<h4 class="mb-4"><?php $LANGMNG->echo('t_addDevice'); ?></h4>
<form method="post">
<div class="field px-2">
<div class="label">Zvolte zařízení:</div>
<select class="input" name="devices[]" multiple>
<div class="label"><?php $LANGMNG->echo('l_choseDevice'); ?>:</div>
<select class="input" name="devices[]" multiple required>
<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){ ?>
<option value="<?php echo $subDeviceKey; ?>"><?php echo $subDeviceValue['name'] . '[' . $subDeviceValue['type'] . ']'; ?></option>
<?php } ?>
</select>
</div>
<input type="submit" class="button" name="modalFinal" value="Next"/>
<input type="submit" class="button" name="modalFinal" value="<?php $LANGMNG->echo('b_create'); ?>"/>
</form>
</div>
</div>

View File

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

View File

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

View File

@ -53,10 +53,10 @@
</div>
<div class="row">
<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 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>

View File

@ -1,24 +1,24 @@
<div class="modal-container modal-container-hiden" id="modal">
<div class="modal">
<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">
<div class="field">
<div class="label"><?php echo $LANG['l_nameAt']?></div>
<div class="label"><?php $LANGMNG->echo('l_nameAt')?></div>
<div class="field">
<input class="input" type="text" name="name" required/>
</div>
<div class="label"><?php echo $LANG['l_runAt']?></div>
<div class="label"><?php $LANGMNG->echo('l_runAt')?></div>
<div class="field">
<select class="input" name="atSelector" id="valueSelector" required>
<option value="sunSet"><?php echo $LANG['l_sunSet']?></option>
<option value="sunRise"><?php echo $LANG['l_sunRice']?></option>
<option value="inHome"><?php echo $LANG['l_inHome']?></option>
<option value="outHome"><?php echo $LANG['l_outHome']?></option>
<option value="time"><?php echo $LANG['l_time']?></option>
<option value="atDeviceValue"><?php echo $LANG['l_deviceValue'];?></option>
<option value="noOneHome"><?php echo $LANG['w_noOne'] . ' ' . $LANG['w_neni'] . ' ' . $LANG['w_home'];?></option>
<option value="someOneHome"><?php echo $LANG['w_someOne'] . ' ' . $LANG['w_is'] . ' ' . $LANG['w_home'];?></option>
<option value="sunSet"><?php $LANGMNG->echo('l_sunSet')?></option>
<option value="sunRise"><?php $LANGMNG->echo('l_sunRice')?></option>
<option value="inHome"><?php $LANGMNG->echo('l_inHome')?></option>
<option value="outHome"><?php $LANGMNG->echo('l_outHome')?></option>
<option value="time"><?php $LANGMNG->echo('l_time')?></option>
<option value="atDeviceValue"><?php $LANGMNG->echo('l_deviceValue');?></option>
<option value="noOneHome"><?php $LANGMNG->echo('w_noOne') . ' ' . $LANGMNG->get('w_neni') . ' ' . $LANGMNG->get('w_home');?></option>
<option value="someOneHome"><?php $LANGMNG->echo('w_someOne') . ' ' . $LANGMNG->get('w_is') . ' ' . $LANGMNG->get('w_home');?></option>
</select>
<input class="input" type="time" name="atTime" id="atTime" disabled/>
<select class="input" name="atDeviceValue" id="atDeviceValue" disabled>
@ -30,7 +30,7 @@
<input class="input" type="num" name="atDeviceValueInt" id="atDeviceValueInt" required disabled/>
</div>
<div class="label"><?php echo $LANG['l_affectedDevices']?></div>
<div class="label"><?php $LANGMNG->echo('l_affectedDevices')?></div>
<div class="field">
<select class="input" name="devices[]" multiple>
<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){
@ -40,30 +40,30 @@
</select>
</div>
<div class="label"><?php echo $LANG['l_atDays']?></div>
<div class="label"><?php $LANGMNG->echo('l_atDays')?></div>
<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 class="field">
<input type="checkbox" name="day[]" value="tue"/> Úterý
<input type="checkbox" name="day[]" value="tue"/> <?php $LANGMNG->echo('d_tuesday'); ?>
</div>
<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 class="field">
<input type="checkbox" name="day[]" value="thu"/> Čtvrtek
<input type="checkbox" name="day[]" value="thu"/> <?php $LANGMNG->echo('d_thursday'); ?>
</div>
<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 class="field">
<input type="checkbox" name="day[]" value="sat"/> Sobota
<input type="checkbox" name="day[]" value="sat"/> <?php $LANGMNG->echo('d_saturday'); ?>
</div>
<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>
<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>
</div>
</div>

View File

@ -1,7 +1,7 @@
<div class="modal-container" id="modal">
<div class="modal">
<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">
<div class="field">
<input type="hidden" name="atSelector" value="<?php echo $_POST['atSelector']; ?>" required/>
@ -34,7 +34,7 @@
</select>
<?php } ?>
</div>
<input type="submit" class="button" name="modalFinal" value="Next"/>
<input type="submit" class="button" name="modalFinal" value="<?php $LANGMNG->echo('b_finish'); ?>"/>
</form>
</div>
</div>

View File

@ -3,26 +3,26 @@
<div class="close">
<i class="fa fa-times"></i>
</div>
<h4 class="mb-4"><?php echo $LANG['t_createAutomation']?></h4>
<h4 class="mb-4"><?php $LANGMNG->echo('t_createAutomation');?></h4>
<form method="post">
<input name="automation_id" type="hidden" value="<?php echo $AUTOMATIONID; ?>">
<div class="field">
<div class="label"><?php echo $LANG['l_nameAt']?></div>
<div class="label"><?php $LANGMNG->echo('l_nameAt');?></div>
<div class="field">
<input class="input" type="text" name="name" value="<?php echo (isset ($AUTOMATION['name']) ? $AUTOMATION['name'] : ""); ?>" required/>
</div>
<div class="label"><?php echo $LANG['l_runAt']?></div>
<div class="label"><?php $LANGMNG->echo('l_runAt');?></div>
<div class="field">
<?php //TODO Dodělat identifikaci pro Selctor události a selector času zařízení hodnoty ?>
<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="sunRise" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "sunRise" ? 'selected="selected"' : ''); ?>><?php echo $LANG['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="outHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "outHome" ? 'selected="selected"' : ''); ?>><?php echo $LANG['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="atDeviceValue" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? 'selected="selected"' : ''); ?>><?php echo $LANG['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="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="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 $LANGMNG->echo('l_sunRice');?></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 $LANGMNG->echo('l_outHome');?></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 $LANGMNG->echo('l_deviceValue');;?></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 $LANGMNG->echo('w_someOne'); echo ' ' . $LANGMNG->get('w_is') . ' ' . $LANGMNG->get('w_home');?></option>
</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'); ?>/>
<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'); ?>/>
</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 px-2">
<?php
@ -53,31 +53,31 @@
} ?>
</div>
</div>
<div class="label"><?php echo $LANG['l_atDays'];?></div>
<div class="label"><?php $LANGMNG->echo('l_atDays');?></div>
<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 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 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 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 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 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 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>
<input type="submit" class="button" name="modalFinal" value="<?php echo $LANG['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" 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 $LANGMNG->echo('b_remove');?>"/>
</form>
</div>

View File

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

View File

@ -3,15 +3,15 @@
<div class="close">
<i class="fa fa-times"></i>
</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="">
<input class="input" type="hidden" name="deviceId" value="<?php echo $DEVICEID; ?>">
<?php if ($DEVICE['approved'] != 0) { ?>
<?php if ($DEVICE['userIsAdmin']) { ?>
<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">
<option value=""><?php echo $LANG['w_noOne']; ?></option>
<option value=""><?php $LANGMNG->echo('w_noOne'); ?></option>
<?php foreach ($USERS as $user) {
$userId = $user['user_id'];
$userName = $user['username'];
@ -20,11 +20,11 @@
<?php } ?>
</select>
</div>
<div class="label"> <?php echo $LANG['l_permission']; ?></div>
<div class="label"><?php $LANGMNG->echo('l_permission'); ?></div>
<div class="row">
<div class="col-6">
<div class="label"> - <?php echo $LANG['l_owner']; ?></div>
<div class="label"> - <?php $LANGMNG->echo('l_owner'); ?></div>
</div>
<div class="col-6">
@ -37,24 +37,24 @@
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=2 <?php ECHO ($permissions[0] == 2 ? 'checked' : ''); ?>/> <?php echo $LANG['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=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 $LANGMNG->echo('l_use'); ?>
<input type="radio" name="permissionOwner" value=3 <?php ECHO ($permissions[0] == 3 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_edit'); ?>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="label"> - <?php echo $LANG['l_member']; ?></div>
<div class="label"> - <?php $LANGMNG->echo('l_member'); ?></div>
</div>
<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=2 <?php ECHO ($permissions[1] == 2 ? 'checked' : ''); ?>/> <?php echo $LANG['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=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 $LANGMNG->echo('l_use'); ?>
<input type="radio" name="permissionOther" value=3 <?php ECHO ($permissions[1] == 3 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_edit'); ?>
</div>
</div>
<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' : ''); ?>>
</div>
<?php } ?>
@ -65,13 +65,13 @@
<?php if ($DEVICE['userIsAdmin']) { ?>
<?php if (!in_array($SUBDEVICE['type'], ['on/off', 'door', 'water'])) { ?>
<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' : ''); ?>>
<p>* - <?php echo $LANG['l_inMinutes']; ?></p>
<p>* - <?php $LANGMNG->echo('l_inMinutes'); ?></p>
</div>
<?php }?>
<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">
<?php foreach ($ROOMS as $room) {
$roomId = $room['room_id'];
@ -82,9 +82,9 @@
</select>
</div>
<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' : ''); ?>>
<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="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>
@ -98,7 +98,7 @@
</div>
<?php } ?>
<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">
<?php foreach ($DEVICE['subDevices'] as $subDeviceKey => $subDevice) { ?>
<div class="col-4 col-sm-3 col-xl-2 square-wrap">
@ -123,11 +123,11 @@
<?php } ?>
</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 is-danger" name="disableDevice" value="<?php echo $LANG['b_disable']; ?>"/>
<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 $LANGMNG->echo('b_disable'); ?>"/>
<?php } else { ?>
<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">
<?php foreach ($DEVICE['subDevices'] as $subDeviceKey => $subDevice) { ?>
<div class="col-4 col-sm-3 col-xl-2 square-wrap">
@ -152,8 +152,8 @@
<?php } ?>
</div>
</div>
<input type="submit" class="button is-primary" name="approveDevice" value="<?php echo $LANG['b_approve']; ?>"/>
<input type="submit" class="button is-danger" name="disableDevice" value="<?php echo $LANG['b_disable']; ?>"/>
<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 $LANGMNG->echo('b_disable'); ?>"/>
<?php } ?>
</form>
</div>

View File

@ -37,7 +37,7 @@
<a href="<?php echo $value['path']?>">
<i class="fa <?php echo $key ?>"></i>
<span>
<?php echo $LANG['m_'.$value['lngKey']]; ?>
<?php $LANGMNG->echo('m_'.$value['lngKey']); ?>
</span>
</a>
</div>

View File

@ -3,14 +3,14 @@
<div class="close">
<i class="fa fa-times"></i>
</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="" >
<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=""/>
</div>
<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' : ''); ?>>
<option value="">No icon</option>
<option value="f0eb">&#xf0eb; - fa-lightbulb-o</option>
@ -25,7 +25,7 @@
</select>
</div>
<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>
<?php
foreach ($SUBDEVICES as $subdeviceId => $subdeviceData) {
@ -34,7 +34,7 @@
?>
</select>
</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>
</div>
</div>

View File

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

View File

@ -14,13 +14,15 @@
<?php
$partial = new Partial('menu');
$partial->prepare('item', 'setting');
$partial->prepare('lang',$LANG);
$partial->prepare('langMng',$LANGMNG);
$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">Stránka po načtení</h4>
<h4 class="mb-4">
<?php $LANGMNG->echo('t_pageAfterLogIn') ?>
</h4>
<form method="post" enctype="multipart/form-data">
<div class="">
<div class="field">
@ -29,28 +31,28 @@
<option value="1" <?php echo (UserManager::getUserData("startPage") == 1 ? "selected" : ""); ?>>Dashboard</option>
</select>
</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>
</form>
<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">
<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 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);" />
<div class="label">Status notifikací</div>
<div class="label"><?php $LANGMNG->echo('l_notificationStatus') ?></div>
<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 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">
<a href="rooms" class="button">ROOMS</a>
<a href="rooms" class="button"><?php $LANGMNG->echo('b_rooms') ?></a>
</div>
</div>
</div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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