[FRONT] additional day/night styling, layout values as tables

This commit is contained in:
Jannik Beyerstedt 2017-08-23 14:11:54 +02:00
parent d29232cb3c
commit 153d48f8ef
3 changed files with 50 additions and 19 deletions

View File

@ -7,8 +7,11 @@
$config_filename = 'config_times.json'; $config_filename = 'config_times.json';
$timeRegex = '/^((2[0-3]|1[0-9]|0[0-9]|[^0-9][0-9]):([0-5][0-9]|[0-9]))/'; $timeRegex = '/^((2[0-3]|1[0-9]|0[0-9]|[^0-9][0-9]):([0-5][0-9]|[0-9]))/';
$sun_zenith = 96; /* Civilian Twilight */ $sunsetTrue = 90+50/60; /* "true" sunrise/ sunset */
//$sun_zenith = 90+50/60; /* "true" sunrise/ sunset */ $sunsetCivilian = 96; /* Civilian Twilight */
$sunsetNautical = 102; /* Nauticla Twilight */
$sun_zenith = $sunsetCivilian;
$timezone = "Europe/Berlin"; $timezone = "Europe/Berlin";
class LightStatus { class LightStatus {

View File

@ -69,30 +69,41 @@ if (isset($_GET['action'])) {
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
</head> </head>
<body class="container"> <body class="container <?php echo ($light->isNight) ? 'dark' : 'light' ?>">
<h1>Garagenlicht</h1> <h1>Garagenlicht</h1>
<?php if ($error_string != '') : ?> <?php if ($error_string != '') : ?>
<div class="alert alert-danger" role="alert"><?php echo $error_string ?></div> <div class="alert alert-danger" role="alert"><?php echo $error_string ?></div>
<?php endif; ?> <?php endif; ?>
<h2>Aktueller Status</h2> <table class="big">
<p> <tr>
<?php if ($light->state) : ?> <td>Licht:</td>
Licht: <span class="label label-success">AN</span><br> <td><?php echo ($light->state) ? '<span class="label label-success">EINGESCHALTET</span>'
<?php else : ?> : '<span class="label label-default">AUSGESCHALTET</span>';?></td>
Licht: <span class="label label-default">AUS</span><br> </tr>
<?php endif; ?> <tr>
Zeit bis nächste Änderung: <span class="label label-default"><?php echo ($light->changeTime === 1) ? $light->changeTime." Minute" : $light->changeTime." Minuten" ?></span> <td>Änderung in:</td>
</p> <td><span class="label label-primary"><?php echo ($light->changeTime === 1) ? $light->changeTime." Minute" : $light->changeTime." Minuten" ?></span></td>
<a class="btn btn-success" href="index.php?action=enlighten">Licht temporär an (15 Min)</a> </tr>
</table>
<a class="btn btn-primary" href="index.php?action=enlighten">Licht temporär an (15 Min)</a>
<h5>weitere Informationen:</h5> <h5>weitere Informationen:</h5>
<p> <table>
Sonnenaufgang: <?php echo $light->sunrise ?><br> <tr>
Sonnenuntergang: <?php echo $light->sunset ?><br> <td>Sonnenaufgang:</td><td><?php echo $light->sunrise ?></td>
Aktuelle Zeit: <?php echo date("Y-m-d H:i",time()) ?><br> </tr>
</p> <tr>
<td>Sonnenuntergang:</td><td><?php echo $light->sunset ?></td>
</tr>
<tr>
<td>Aktuelle Zeit:</td><td><?php echo date("H:i, Y-m-d",time()) ?></td>
</tr>
<tr>
<td>Nacht (ja/nein):</td><td><?php echo ($light->isNight) ? "ja" : "nein" ?></td>
</tr>
</table>
<h2>Einstellungen</h2> <h2>Einstellungen</h2>
<form class="form-horizontal" action="index.php?action=update" method="post"> <form class="form-horizontal" action="index.php?action=update" method="post">
@ -117,7 +128,7 @@ if (isset($_GET['action'])) {
<input type="time" class="form-control" name="time3-stop" value="<?php echo $light->times['time3']['off'] ?>"> <input type="time" class="form-control" name="time3-stop" value="<?php echo $light->times['time3']['off'] ?>">
</div> </div>
</div> </div>
<button type="submit" class="btn btn-warning">Zeiten ändern</button> <button type="submit" class="btn btn-primary">Zeiten ändern</button>
</form> </form>
</body> </body>

View File

@ -5,6 +5,23 @@
body { body {
max-width: 500px; max-width: 500px;
margin-bottom: 20px;
}
.big{
font-size: 1.25em;
}
table {
margin-top: 1em;
margin-bottom: 1em;
}
table tr>td:first-child {
padding-right: 0.75em;
text-align: right;
}
.dark {
background-color: #292929;
color: #efefef;
} }
form div.form-group > div > input.form-control { form div.form-group > div > input.form-control {