PHP_SMART_HOME_V3/templates/part/automationCreateFinal.phtml
2019-08-23 13:39:42 +02:00

38 lines
2.0 KiB
PHTML

<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>
<form method="post">
<div class="field">
<input type="hidden" name="atSelector" value="<?php if (isset($_POST['atTime'])) {
echo $_POST['atTime'];
} else if (isset($_POST['atDeviceValue'])) {
$subDeviceId = $_POST['atDeviceValue'];
$subDeviceValue = $_POST['atDeviceValueInt'];
$subDevice = SubDeviceManager::getSubDevice($subDeviceId);
$subDeviceMaster = SubDeviceManager::getSubDeviceMaster($subDeviceId,$subDevice['type']);
$json = json_encode([
'deviceID' => $subDeviceMaster['device_id'],
'type'=> htmlspecialchars($subDevice['type']),
'value'=> $subDeviceValue,
]);
echo htmlspecialchars($json);
}
else {
echo $_POST['atSelector'];
} ?>" required/>
<input type="hidden" name="atDays" value="<?php echo htmlspecialchars(($_POST['day'] != '' ? json_encode($_POST['day']) : '')); ?>" required/>
<?php foreach ($_POST['devices'] as $value) { ?>
<?php $deviceData = DeviceManager::getDeviceById($value); ?>
<div class="label"><?php echo $deviceData['name'];?></div>
<select class="input" name="device[<?php echo $deviceData['device_id'];?>]">
<option value="1">ON</option>
<option value="0">OFF</option>
</select>
<?php } ?>
</div>
<input type="submit" class="button" name="modalFinal" value="Next"/>
</form>
</div>
</div>