Revamp lockdown mode, again. More readable this time.

This commit is contained in:
iwonder 2020-03-13 12:54:04 +00:00
parent 684139cef0
commit 1b62853120

103
index.php
View File

@ -48,10 +48,10 @@ $hash_to_state = array(
'86c75c0ad413b06ff8291673162d0b64' => 'unknown', '86c75c0ad413b06ff8291673162d0b64' => 'unknown',
'0' => 'error', '0' => 'error',
); );
if (! $DORF_IN_LOCKDOWN){
$img = file_get_contents('https://chaosdorf.de/raumstatus/status.png'); $img = file_get_contents('https://chaosdorf.de/raumstatus/status.png');
$hash = md5($img); $hash = md5($img);
$state = $hash_to_state[$hash]; $state = $hash_to_state[$hash];
if (! $DORF_IN_LOCKDOWN){
$ical = new ICal(false, array( $ical = new ICal(false, array(
'defaultSpan' => 2, 'defaultSpan' => 2,
'defaultTimeZone' => 'Europe/Berlin', 'defaultTimeZone' => 'Europe/Berlin',
@ -95,58 +95,59 @@ $v = file_get_contents($VISITORS_FILE);
<nav class="navbar"> <nav class="navbar">
<h1 class="text-center">Was geht im Dorf.jetzt?</h1><hr /> <h1 class="text-center">Was geht im Dorf.jetzt?</h1><hr />
</nav> </nav>
<div class="card mb-3 text-center"> <?php if($DORF_IN_LOCKDOWN): ?>
<div class="card-body"> <div class="card mb-3 text-center">
<h5 class="card-title">Türstatus</h5> <div class="card-body">
<i class="material-icons" id="state-icn" style="color:<?= $state_map[$state]->color ?>;font-size:16rem;"><?= $state_map[$state]->svg ?></i> <h5 class="card-title">Das Chaosdorf ist geschlossen</h5>
<p class="card-text"><?= $state_map[$state]->state_string ?></p> <i class="material-icons" id="state-icn" style="color:red;font-size:16rem;">lock</i>
<div class="btn-wrapper"> <p class="card-text font-weight-normal">Das Chaosdorf ist als Vorsichtsmaßnahme bis auf Weiteres für Besucher geschlossen.</p>
<a href="https://wiki.chaosdorf.de/Raumstatus" class="btn btn-lg btn-block btn-primary">What's this?</a> <p class="card-text font-weight-normal">Für weitere Informationen schau bitte auf <a href="https://chaosdorf.de/">den Blog</a>.</p>
</div>
</div>
</div>
<div class="card mb-3 text-center">
<div class="card-body">
<h5 class="card-title">Events</h5>
<?php if (! $DORF_IN_LOCKDOWN && !empty($events)) : ?>
<h6 class="card-subtitle mb-2 text-muted">Nächste Veranstaltung</h6>
<p class="card-text">
<h5 class="font-weight-bold"><?= htmlspecialchars($first_event->summary, ENT_QUOTES, 'UTF-8') ?></h5>
<span class="font-weight-normal"><?= format_event($first_event) ?></span>
</p>
<h5 class="card-title">Danach:</h5>
<table class="table">
<tbody>
<?php foreach ($events as $event) : ?>
<tr>
<th scope="row"><?=format_event($event)?></th>
<td><?= htmlspecialchars($event->summary) ?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<a href="https://wiki.chaosdorf.de/Chaosdorf_Wiki:Current_events" class="btn btn-lg btn-block btn-primary">Event-Kalender</a>
<?php else: ?>
<h6 class="card-subtitle mb-2 text-muted">Aktuell keine Veranstaltungen.</h6>
<?php if ($DORF_IN_LOCKDOWN): ?>
<p class="card-text">
<span class="font-weight-normal">
Aktuell finden als Vorsichtsmaßnahme keine öffentlichen Veranstaltungen statt.<br>
Bitte beobachte <a href="https://chaosdorf.de">den Blog des Chaosdorf</a> für weitere Informationen.
</span>
</p>
<?php else: ?>
<p class="card-text">
<span class="font-weight-normal">
Es stehen aktuell keine Veranstaltungen an.
</span>
</p>
<?php endif ?>
<?php endif ?>
</div>
</div> </div>
</div> </div>
<?php else: ?>
<div class="card mb-3 text-center">
<div class="card-body">
<h5 class="card-title">Türstatus</h5>
<i class="material-icons" id="state-icn" style="color:<?= $state_map[$state]->color ?>;font-size:16rem;"><?= $state_map[$state]->svg ?></i>
<p class="card-text"><?= $state_map[$state]->state_string ?></p>
<div class="btn-wrapper">
<a href="https://wiki.chaosdorf.de/Raumstatus" class="btn btn-lg btn-block btn-primary">What's this?</a>
</div>
</div>
</div>
<div class="card mb-3 text-center">
<div class="card-body">
<h5 class="card-title">Events</h5>
<?php if (!empty($events)) : ?>
<h6 class="card-subtitle mb-2 text-muted">Nächste Veranstaltung</h6>
<p class="card-text">
<h5 class="font-weight-bold"><?= htmlspecialchars($first_event->summary, ENT_QUOTES, 'UTF-8') ?></h5>
<span class="font-weight-normal"><?= format_event($first_event) ?></span>
</p>
<h5 class="card-title">Danach:</h5>
<table class="table">
<tbody>
<?php foreach ($events as $event) : ?>
<tr>
<th scope="row"><?=format_event($event)?></th>
<td><?= htmlspecialchars($event->summary) ?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<a href="https://wiki.chaosdorf.de/Chaosdorf_Wiki:Current_events" class="btn btn-lg btn-block btn-primary">Event-Kalender</a>
<?php else: ?>
<h6 class="card-subtitle mb-2 text-muted">Aktuell keine Veranstaltungen.</h6>
<p class="card-text">
<span class="font-weight-normal">
Es stehen aktuell keine Veranstaltungen an.
</span>
</p>
<?php endif ?>
</div>
</div>
</div>
<?php endif ?>
<footer class="page-footer font-small text-center"> <footer class="page-footer font-small text-center">
<div> <div>
Look at the code <a href="https://git.iwonder.name/iwonder/dorf.jetzt">here</a> Look at the code <a href="https://git.iwonder.name/iwonder/dorf.jetzt">here</a>