From 84d43caf0d171b690f632be40ce00f712891f248 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Tue, 18 Feb 2020 09:26:11 +0100
Subject: Add formatting for past and current events on list.php
---
list.php | 16 +++++++++++++++-
style.css | 12 ++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/list.php b/list.php
index 27858a5..52fc4ce 100644
--- a/list.php
+++ b/list.php
@@ -69,10 +69,24 @@ foreach ($events as $event){
$start_date=strtotime ($event['start_date']);
$end_date=strtotime ($event['end_date']);
+ $classes=[];
+
$month=date ('m',$start_date);
- echo $month==$last_month ? '
' : '
';
+ if ($month!=$last_month)
+ $classes[]='new-month';
$last_month=$month;
+ $time=time();
+ if ($end_date<$time)
+ $classes[]='expired';
+ elseif ($start_date<=$time && $time<$end_date+3600*24)
+ $classes[]='current';
+
+ if (count ($classes))
+ echo '
';
+ else
+ echo '
';
+
echo ''.format_date_range ($start_date,$end_date).' | ';
echo ''.htmlspecialchars ($event['location']).' | ';
echo ''.htmlspecialchars ($event['title']).' | ';
diff --git a/style.css b/style.css
index 647250e..bc268d4 100644
--- a/style.css
+++ b/style.css
@@ -18,6 +18,18 @@ tr.new-month {
border-top: 1px dotted #888;
}
+tr.expired {
+ color: #888;
+}
+
+tr.current {
+ color: red;
+}
+
+tr.current .description {
+ color: initial;
+}
+
th, td {
padding-right: 1em;
text-align: left;
--
cgit v1.2.3