From 10356b51f95050d0aec0cd1807d5ba1ec46d475a Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 18 Nov 2019 16:12:26 +0100 Subject: [PATCH] doclist: sublists of multiple dates grouped by year --- widget/doclist.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/widget/doclist.php b/widget/doclist.php index a465768..5c11c68 100644 --- a/widget/doclist.php +++ b/widget/doclist.php @@ -6,11 +6,12 @@ foreach (glob("$Page$Args/2*") as $url) { $link = preg_replace('/\.html$/', '', $url); $name = pathinfo($link, PATHINFO_BASENAME); @list ($date, $suffix) = explode('.', $name, 2); - if (!isset($cal[$date])) { - $cal[$date] = []; + $group = substr($date, 0, 4); + if (!isset($cal[$group][$date])) { + $cal[$group][$date] = []; } if (!is_dir($url) and filesize($url)) { - $cal[$date][$suffix] = $link; + $cal[$group][$date][$suffix] = $link; } } @@ -19,8 +20,17 @@ $scale = 8; # em width per year $mindate = strtotime($date) + ($year / $scale * 3); # first point plus about 3em for centered text print '\n\n"; -- 2.30.0