add name to automatization
This commit is contained in:
parent
9ae039a4b5
commit
68da935592
@ -8,7 +8,7 @@ if (isset($_POST) && !empty($_POST)){
|
||||
], JSON_PRETTY_PRINT);
|
||||
$onDays = $_POST['atDays'];
|
||||
|
||||
AutomationManager::create('name', $onDays, $doCode, $ifCode);
|
||||
AutomationManager::create($_POST['name'], $onDays, $doCode, $ifCode);
|
||||
|
||||
header('Location: /vasek/home/' . strtolower(basename(__FILE__, '.php')), TRUE);
|
||||
die();
|
||||
@ -23,7 +23,7 @@ if (isset($_POST) && !empty($_POST)){
|
||||
|
||||
$json = json_encode([
|
||||
'deviceID' => $subDeviceMaster['device_id'],
|
||||
'type'=> htmlspecialchars($subDevice['type']),
|
||||
'type'=> $subDevice['type'],
|
||||
'value'=> $subDeviceValue,
|
||||
]);
|
||||
}
|
||||
@ -36,7 +36,7 @@ if (isset($_POST) && !empty($_POST)){
|
||||
], JSON_PRETTY_PRINT);
|
||||
$onDays = ($_POST['day'] != '' ? json_encode($_POST['day']) : '');
|
||||
|
||||
AutomationManager::create('name', $onDays, $doCode, $ifCode, (isset ($_POST['automation_id']) ? $_POST['automation_id'] : ""));
|
||||
AutomationManager::create($_POST['name'], $onDays, $doCode, $ifCode, (isset ($_POST['automation_id']) ? $_POST['automation_id'] : ""));
|
||||
|
||||
header('Location: /vasek/home/' . strtolower(basename(__FILE__, '.php')), TRUE);
|
||||
die();
|
||||
|
@ -44,6 +44,7 @@ $lang = [
|
||||
'l_inMinutes' => 'v minutách',
|
||||
'l_sleepTime' => 'Doba spánku zařízení',
|
||||
'l_atHome' => 'Doma Jsou',
|
||||
'l_nameAt' => 'Název',
|
||||
|
||||
//Title
|
||||
't_createScene' => 'Vytvořit scénu',
|
||||
|
@ -44,6 +44,7 @@ $lang = [
|
||||
'l_inMinutes' => 'in minutes',
|
||||
'l_sleepTime' => 'Device sleep Time',
|
||||
'l_atHome' => 'At home',
|
||||
'l_nameAt' => 'Name',
|
||||
|
||||
//Title
|
||||
't_createScene' => 'Create Scene',
|
||||
|
@ -10,23 +10,23 @@
|
||||
case 'sunSet':
|
||||
echo'';
|
||||
break;
|
||||
|
||||
|
||||
case 'sunRise':
|
||||
echo' ';
|
||||
break;
|
||||
|
||||
|
||||
case 'inHome':
|
||||
echo'';
|
||||
break;
|
||||
|
||||
|
||||
case 'outHome':
|
||||
echo'';
|
||||
break;
|
||||
|
||||
|
||||
case 'outDevice':
|
||||
echo'';
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
echo'';
|
||||
break;
|
||||
@ -36,10 +36,11 @@
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="text-right break-all">
|
||||
<?php
|
||||
if (!in_array($AUTOMATIONDATA['ifSomething'], ["sunRise", "sunSet"])) {
|
||||
<?php
|
||||
/*if (!in_array($AUTOMATIONDATA['ifSomething'], ["sunRise", "sunSet"])) {
|
||||
echo $AUTOMATIONDATA['ifSomething'];
|
||||
}
|
||||
}*/
|
||||
echo $AUTOMATIONDATA['name'];
|
||||
?>
|
||||
</h5>
|
||||
</div>
|
||||
@ -49,6 +50,14 @@
|
||||
<?php echo implode(', ',$AUTOMATIONDATA['onDays']);?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<a class="button is-primary m-1" onclick="$('#modal').removeClass('modal-container-hiden').show();">restart</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<a class="button is-primary m-1" onclick="$('#modal').removeClass('modal-container-hiden').show();">deaktivovat</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -4,6 +4,10 @@
|
||||
<h4 class="mb-4"><?php echo $LANG['t_createAutomation']?></h4>
|
||||
<form method="post">
|
||||
<div class="field">
|
||||
<div class="label"><?php echo $LANG['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="field">
|
||||
<select class="input" name="atSelector" id="valueSelector" required>
|
||||
@ -29,12 +33,12 @@
|
||||
<div class="label"><?php echo $LANG['l_affectedDevices']?></div>
|
||||
<div class="field">
|
||||
<select class="input" name="devices[]" multiple>
|
||||
<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){
|
||||
<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){
|
||||
if ($subDeviceValue['type'] != 'on/off') continue;?>
|
||||
<option value="<?php echo $subDeviceValue['masterDevice']; ?>"><?php echo $subDeviceValue['name']; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="label"><?php echo $LANG['l_atDays']?></div>
|
||||
<div class="field">
|
||||
@ -62,4 +66,4 @@
|
||||
<input type="submit" class="button" name="modalNext" value="<?php echo $LANG['b_next']?>"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -5,6 +5,7 @@
|
||||
<form method="post">
|
||||
<div class="field">
|
||||
<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="atSelectorValue" value="<?php if (isset($_POST['atTime'])) {
|
||||
echo $_POST['atTime'];
|
||||
} else if (isset($_POST['atDeviceValue'])) {
|
||||
@ -12,7 +13,7 @@
|
||||
$subDeviceValue = $_POST['atDeviceValueInt'];
|
||||
$subDevice = SubDeviceManager::getSubDevice($subDeviceId);
|
||||
$subDeviceMaster = SubDeviceManager::getSubDeviceMaster($subDeviceId,$subDevice['type']);
|
||||
|
||||
|
||||
$json = json_encode([
|
||||
'deviceID' => $subDeviceMaster['device_id'],
|
||||
'type'=> htmlspecialchars($subDevice['type']),
|
||||
@ -36,4 +37,4 @@
|
||||
<input type="submit" class="button" name="modalFinal" value="Next"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -7,6 +7,10 @@
|
||||
<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="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="field">
|
||||
<?php //TODO Dodělat identifikaci pro Selctor události a selector času zařízení hodnoty ?>
|
||||
|
@ -28,7 +28,7 @@ class Automation extends Template
|
||||
];
|
||||
}
|
||||
$automations[$automationData['automation_id']] = [
|
||||
'name' => '',
|
||||
'name' => $automationData['name'],
|
||||
'onDays' => json_decode($automationData['on_days']),
|
||||
'ifSomething' => $automationData['if_something'],
|
||||
'doSomething' => $doSomething,
|
||||
|
Loading…
Reference in New Issue
Block a user