aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2020-02-18 09:26:11 +0100
committerCamil Staps2020-02-18 09:26:11 +0100
commit84d43caf0d171b690f632be40ce00f712891f248 (patch)
treebe212ba0a95abcf241130808f78193686a2147a7
parentCommit missing file (diff)
Add formatting for past and current events on list.php
-rw-r--r--list.php16
-rw-r--r--style.css12
2 files changed, 27 insertions, 1 deletions
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 ? '<tr>' : '<tr class="new-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 '<tr class="'.implode (' ',$classes).'">';
+ else
+ echo '<tr>';
+
echo '<td>'.format_date_range ($start_date,$end_date).'</td>';
echo '<td>'.htmlspecialchars ($event['location']).'</td>';
echo '<td class="large"><span class="title-link" title="Click for details" onclick="expand_or_collapse(this,'.$event['id'].');">'.htmlspecialchars ($event['title']).'</span></td>';
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;