Scenes/Automation function Fixs
This commit is contained in:
parent
875fbccd6e
commit
986bcff3c8
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
if (isset($_POST) && !empty($_POST)){
|
if (isset($_POST) && !empty($_POST)){
|
||||||
if (isset($_POST['modalFinal']) && $_POST['modalFinal'] == "Next") {
|
if (isset($_POST['modalFinal']) && $_POST['action'] == "add") {
|
||||||
$doCode = json_encode($_POST['device'], JSON_PRETTY_PRINT);
|
$doCode = json_encode($_POST['device'], JSON_PRETTY_PRINT);
|
||||||
$ifCode = json_encode([
|
$ifCode = json_encode([
|
||||||
"type" => $_POST['atSelector'],
|
"type" => $_POST['atSelector'],
|
||||||
@ -8,11 +8,22 @@ if (isset($_POST) && !empty($_POST)){
|
|||||||
], JSON_PRETTY_PRINT);
|
], JSON_PRETTY_PRINT);
|
||||||
$onDays = $_POST['atDays'];
|
$onDays = $_POST['atDays'];
|
||||||
|
|
||||||
|
//Debug
|
||||||
|
if (DEBUGMOD == 1) {
|
||||||
|
echo '<pre>';
|
||||||
|
echo $permissionsInJson;
|
||||||
|
echo $deviceId;
|
||||||
|
var_dump(json_decode ($permissionsInJson));
|
||||||
|
echo '</pre>';
|
||||||
|
echo '<a href="' . BASEDIR .'">CONTINUE</a>';
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
AutomationManager::create($_POST['name'], $onDays, $doCode, $ifCode);
|
AutomationManager::create($_POST['name'], $onDays, $doCode, $ifCode);
|
||||||
|
|
||||||
header('Location: ' . BASEDIR . strtolower(basename(__FILE__, '.php')), TRUE);
|
header('Location: ' . BASEDIR . strtolower(basename(__FILE__, '.php')));
|
||||||
die();
|
die();
|
||||||
} else if (isset($_POST['modalFinal']) && $_POST['modalFinal'] == "Upravit") {
|
} else if (isset($_POST['modalFinal']) && $_POST['action'] == "edit") {
|
||||||
$doCode = json_encode($_POST['device'], JSON_PRETTY_PRINT);
|
$doCode = json_encode($_POST['device'], JSON_PRETTY_PRINT);
|
||||||
|
|
||||||
if (isset ($_POST['atDeviceValue'])) {
|
if (isset ($_POST['atDeviceValue'])) {
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (isset($_POST) && !empty($_POST)){
|
if (isset($_POST) && !empty($_POST)){
|
||||||
if (sset($_POST['devices']) && $_POST['devices'] != '') {
|
if (isset($_POST['submitFinal']) && $_POST['submitFinal'] != "") {
|
||||||
SceneManager::create($_POST['sceneIcon'], $_POST['sceneName'], json_encode($_POST['devices']));
|
SceneManager::create($_POST['sceneIcon'], $_POST['sceneName'], json_encode($_POST['devices']));
|
||||||
|
header('Location: ' . BASEDIR . strtolower(basename(__FILE__, '.php')));
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Debug
|
//Debug
|
||||||
@ -13,7 +15,4 @@ if (isset($_POST) && !empty($_POST)){
|
|||||||
echo '<a href="/' . BASEDIR . strtolower(basename(__FILE__, '.php')).'">CONTINUE</a>';
|
echo '<a href="/' . BASEDIR . strtolower(basename(__FILE__, '.php')).'">CONTINUE</a>';
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: ' . BASEDIR . strtolower(basename(__FILE__, '.php')));
|
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<div class="modal-container" id="modal">
|
<div class="modal-container" id="modal">
|
||||||
<div class="modal">
|
<div class="modal" action="" >
|
||||||
<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 $LANGMNG->echo('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="action" value="add" required/>
|
||||||
<input type="hidden" name="atSelector" value="<?php echo $_POST['atSelector']; ?>" required/>
|
<input type="hidden" name="atSelector" value="<?php echo $_POST['atSelector']; ?>" required/>
|
||||||
<input type="hidden" name="name" value="<?php echo $_POST['name']; ?>" required/>
|
<input type="hidden" name="name" value="<?php echo $_POST['name']; ?>" required/>
|
||||||
<input type="hidden" name="atSelectorValue" value="<?php if (isset($_POST['atTime'])) {
|
<input type="hidden" name="atSelectorValue" value="<?php if (isset($_POST['atTime'])) {
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<h4 class="mb-4"><?php $LANGMNG->echo('t_createAutomation');?></h4>
|
<h4 class="mb-4"><?php $LANGMNG->echo('t_createAutomation');?></h4>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
<input type="hidden" name="action" value="edit" required/>
|
||||||
<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 $LANGMNG->echo('l_nameAt');?></div>
|
<div class="label"><?php $LANGMNG->echo('l_nameAt');?></div>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<i class="fa fa-times"></i>
|
<i class="fa fa-times"></i>
|
||||||
</div>
|
</div>
|
||||||
<h4 class="mb-4"><?php $LANGMNG->echo('t_createScene');?></h4>
|
<h4 class="mb-4"><?php $LANGMNG->echo('t_createScene');?></h4>
|
||||||
<form method="post" action="" >
|
<form method="post">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="label"><?php $LANGMNG->echo('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=""/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<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">
|
<form method="post">
|
||||||
<input type="hidden" name="sceneName" value="<?php echo $SCENENAME; ?>">
|
<input type="hidden" name="sceneName" value="<?php echo $SCENENAME; ?>">
|
||||||
<input type="hidden" name="sceneIcon" value="<?php echo $SCENEICON; ?>">
|
<input type="hidden" name="sceneIcon" value="<?php echo $SCENEICON; ?>">
|
||||||
@ -20,7 +20,7 @@
|
|||||||
<?php
|
<?php
|
||||||
$i++;
|
$i++;
|
||||||
} ?>
|
} ?>
|
||||||
<input type="submit" class="button" name="submit" value="<?php echo $LANG['b_create'];?>"/>
|
<input type="submit" class="button" name="submitFinal" value="<?php echo $LANGMNG->echo('b_create');?>"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -44,8 +44,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (isset($_POST['devices'])) {
|
<?php if (isset($_POST['submit'])) {
|
||||||
$partial = new Partial('sceneCreateOptions');
|
$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 );
|
||||||
|
Loading…
Reference in New Issue
Block a user