diff options
author | Camil Staps | 2020-02-18 09:26:11 +0100 |
---|---|---|
committer | Camil Staps | 2020-02-18 09:26:11 +0100 |
commit | 84d43caf0d171b690f632be40ce00f712891f248 (patch) | |
tree | be212ba0a95abcf241130808f78193686a2147a7 | |
parent | Commit missing file (diff) |
Add formatting for past and current events on list.php
-rw-r--r-- | list.php | 16 | ||||
-rw-r--r-- | style.css | 12 |
2 files changed, 27 insertions, 1 deletions
@@ -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>'; @@ -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; |