From 213019995160086216dc2b354fb4732f8b71f02a Mon Sep 17 00:00:00 2001
From: Christopher Teutsch <chris@heychris.eu>
Date: Fri, 21 Feb 2020 20:28:01 +0100
Subject: [PATCH] layout fixes, visitor counting

---
 index.php | 71 +++++++++++++++++++++++++++++--------------------------
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/index.php b/index.php
index 3870c30..0ccaeb8 100644
--- a/index.php
+++ b/index.php
@@ -61,6 +61,7 @@ $locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
 if ($locale !== null){
 	setlocale(LC_TIME, $locale);
 }
+$v = file_get_contents('/media/sg/dorf.jetzt_visitors');
 ?>
 <!DOCTYPE html>
 <html lang="de">
@@ -76,55 +77,57 @@ if ($locale !== null){
 		<nav class="navbar">	
 			<h1 class="text-center">Was geht im Dorf.jetzt?</h1><hr />
 		</nav>
-		<div class="card-deck mb-3 text-center">
-			<div class="card" style="width: 18rem;">
-				<div class="card-img-top">
-					
-				</div>
+			<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> 
+						<?= $state_map[$state]->svg ?>
+					</i> 
 					<p class="card-text"><?= $state_map[$state]->state_string ?></p>
-					<a href="https://wiki.chaosdorf.de/Raumstatus" class="btn btn-block btn-lg btn-primary">What's this?</a>
+						<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" style="width: 18rem;">
+			<div class="card mb-3 text-center">
 				<div class="card-body">
 					<h5 class="card-title">Events</h5>
 					<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"><?= $ical->iCalDateToDateTime($first_event->dtstart_array[3])->format('Y-m-d H:i'); ?></span>
+						<h5 class="font-weight-bold"><?= htmlspecialchars($first_event->summary, ENT_QUOTES, 'UTF-8') ?></h5>
+						<span class="font-weight-normal"><?= $ical->iCalDateToDateTime($first_event->dtstart_array[3])->format('Y-m-d H:i'); ?></span>
 					</p>
 					<h5 class="card-title">Danach:</h5>
 					<table class="table">
-<tbody>
-<?php foreach ($events as $event) : ?>
-<tr>
-<th scope="row"><?= $ical->iCalDateToDateTime($event->dtstart_array[3])->format('Y-m-d H:i') ?></th>
-<td><?= htmlspecialchars($event->summary) ?></td>
-</tr>
-<?php endforeach ?>
-</tbody>
-</table>
-					<a href="https://wiki.chaosdorf.de/Chaosdorf_Wiki:Current_events" class="btn btn-block btn-lg btn-primary">Event-Kalender</a>
+						<tbody>
+						<?php foreach ($events as $event) : ?>
+							<tr>
+								<th scope="row"><?= $ical->iCalDateToDateTime($event->dtstart_array[3])->format('Y-m-d H:i') ?></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>
 				</div>
 			</div>
 		</div>
-	</div>
-
-<footer class="page-footer font-small text-center">
-<div>
-Look at the code <a href="https://git.iwonder.name/iwonder/dorf.jetzt">here</a>
-</div>
-<div>
-Report issues to <a href="mailto:help@dorf.jetzt">help@dorf.jetzt</a>
-</div>
-</footer>
-<script src="assets/js/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
-<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
-<script src="assets/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
+	<footer class="page-footer font-small text-center">
+		<div>
+		Look at the code <a href="https://git.iwonder.name/iwonder/dorf.jetzt">here</a>
+		</div>
+		<div>
+		Report issues to <a href="mailto:help@dorf.jetzt">help@dorf.jetzt</a>
+		</div>
+		<div>You are visitor #<?= $v ?>
+	</footer>
+	<script src="assets/js/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
+	<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
+	<script src="assets/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
 </body>
 </html>
+<?php
+if(!$v) $v=0;
+$v++;
+file_put_contents('/media/sg/dorf.jetzt_visitors', $v);