Virtual events

This commit is contained in:
Christopher Teutsch 2020-03-16 20:26:47 +01:00
parent c6baf79a51
commit 8dd1e563ee

View File

@ -4,6 +4,7 @@ use ICal\ICal;
static $DATE_FORMAT = 'd.m.Y H:i'; static $DATE_FORMAT = 'd.m.Y H:i';
static $VISITORS_FILE = '/media/sg/dorf.jetzt_visitors'; static $VISITORS_FILE = '/media/sg/dorf.jetzt_visitors';
static $DORF_IN_LOCKDOWN = true; static $DORF_IN_LOCKDOWN = true;
static $DORF_VIRTUAL_EVENTS = true;
static $ICAL_URL = 'https://chaosdorf.de/~derf/cccd_all.ics'; static $ICAL_URL = 'https://chaosdorf.de/~derf/cccd_all.ics';
$state_map = array( $state_map = array(
'closed' => (object) array( 'closed' => (object) array(
@ -48,7 +49,7 @@ $hash_to_state = array(
'86c75c0ad413b06ff8291673162d0b64' => 'unknown', '86c75c0ad413b06ff8291673162d0b64' => 'unknown',
'0' => 'error', '0' => 'error',
); );
if (! $DORF_IN_LOCKDOWN){ if ($DORF_VIRTUAL_EVENTS || ! $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];
@ -102,8 +103,10 @@ $v = file_get_contents($VISITORS_FILE);
<i class="material-icons" id="state-icn" style="color:red;font-size:16rem;">lock</i> <i class="material-icons" id="state-icn" style="color:red;font-size:16rem;">lock</i>
<p class="card-text font-weight-normal">Das Chaosdorf ist aufgrund <a href="https://www.land.nrw/de/pressemitteilung/landesregierung-beschliesst-weitere-massnahmen-zur-eindaemmung-der-corona-virus">einer Verordnung der Landesregierung</a> geschlossen.</p> <p class="card-text font-weight-normal">Das Chaosdorf ist aufgrund <a href="https://www.land.nrw/de/pressemitteilung/landesregierung-beschliesst-weitere-massnahmen-zur-eindaemmung-der-corona-virus">einer Verordnung der Landesregierung</a> geschlossen.</p>
<p class="card-text font-weight-normal">Das gilt mindestens bis <span class="font-weight-bold">19. April 2020</span>.</p> <p class="card-text font-weight-normal">Das gilt mindestens bis <span class="font-weight-bold">19. April 2020</span>.</p>
<p class="card-text font-weight-normal">Natürlich hört das Chaosdorfleben nicht auf, <span class="font-weight-bold">kommt uns gerne im <a href="https://wiki.chaosdorf.de/VirtualSpace">VirtualSpace</a> besuchen.</span></p>
</div> </div>
</div> </div>
<?php else: ?> <?php else: ?>
<div class="card mb-3 text-center"> <div class="card mb-3 text-center">
<div class="card-body"> <div class="card-body">
@ -115,6 +118,8 @@ $v = file_get_contents($VISITORS_FILE);
</div> </div>
</div> </div>
</div> </div>
<?php endif ?>
<?php if($DORF_VIRTUAL_EVENTS || !$DORF_IN_LOCKDOWN): ?>
<div class="card mb-3 text-center"> <div class="card mb-3 text-center">
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Events</h5> <h5 class="card-title">Events</h5>
@ -123,6 +128,7 @@ $v = file_get_contents($VISITORS_FILE);
<p class="card-text"> <p class="card-text">
<h5 class="font-weight-bold"><?= htmlspecialchars($first_event->summary, ENT_QUOTES, 'UTF-8') ?></h5> <h5 class="font-weight-bold"><?= htmlspecialchars($first_event->summary, ENT_QUOTES, 'UTF-8') ?></h5>
<span class="font-weight-normal"><?= format_event($first_event) ?></span> <span class="font-weight-normal"><?= format_event($first_event) ?></span>
<span class="font-weight-normal"><a href="<?= $first_event->url ?>">Details zur Veranstaltung</a></span>
</p> </p>
<h5 class="card-title">Danach:</h5> <h5 class="card-title">Danach:</h5>
<table class="table"> <table class="table">
@ -131,6 +137,7 @@ $v = file_get_contents($VISITORS_FILE);
<tr> <tr>
<th scope="row"><?=format_event($event)?></th> <th scope="row"><?=format_event($event)?></th>
<td><?= htmlspecialchars($event->summary) ?></td> <td><?= htmlspecialchars($event->summary) ?></td>
<td><a href="<?= $first_event->url ?>">Details</a></td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
@ -146,8 +153,8 @@ $v = file_get_contents($VISITORS_FILE);
<?php endif ?> <?php endif ?>
</div> </div>
</div> </div>
<?php endif ?>
</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>