output improvments

drop weblink param
This commit is contained in:
quenousimporte 2025-02-04 14:09:26 +01:00
parent 57bcc5a5a2
commit 6f37161f4c
1 changed files with 6 additions and 21 deletions

27
ics.php
View File

@ -91,24 +91,9 @@ $params = [];
parse_str($_SERVER['QUERY_STRING'], $params); parse_str($_SERVER['QUERY_STRING'], $params);
$recent = isset($params['recent']) ? (int)$params['recent'] : 7; $recent = isset($params['recent']) ? (int)$params['recent'] : 7;
$recentonly = isset($params['recentonly']); $recentonly = isset($params['recentonly']);
$weblink = isset($params['weblink']) ? $params['weblink'] : '';
$html = "<h1>Evénements à venir</h1>"; $html = "<h1>Evénements à venir</h1>";
$html .= "<div>Récent : $recent derniers jours</div>";
$html .= "<div>";
if ($recentonly)
{
$html .= "M";
}
else
{
$html .= "En gras: m";
}
$html .= "odifié les $recent derniers jours</div>";
if ($weblink) {
$html .= "<div><a target=\"_blank\" href=\"$weblink\">Lien vers calendrier web</a></div>";
}
$o = ics2json($result); $o = ics2json($result);
$lastmodified = new DateTime(); $lastmodified = new DateTime();
@ -131,7 +116,7 @@ foreach ($o['VEVENTS'] as $e) {
$group[$year] = []; $group[$year] = [];
} }
if (!isset($group[$year][$month])) { if (!isset($group[$year][$month])) {
$html .= "<h3>$month</h3>"; $html .= "<h3>". ucfirst($month) ."</h3>";
$group[$year][$month] = []; $group[$year][$month] = [];
} }
if (!isset($group[$year][$month][$week])) { if (!isset($group[$year][$month][$week])) {
@ -139,11 +124,11 @@ foreach ($o['VEVENTS'] as $e) {
$group[$year][$month][$week] = true; $group[$year][$month][$week] = true;
} }
$line = "<li title=\"modifié le " . strftime('%A, %e %B %Y %H:%M', $e['DTSTAMP']->getTimestamp()) . "\">"; $line = "<li title=\"modifié le " . strftime('%A, %e %B %Y %H:%M', $e['DTSTAMP']->getTimestamp()) . "\">";
$line .= "$formatteddate: " . $e['SUMMARY']; $line .= ucfirst($formatteddate) . ": " . $e['SUMMARY'];
$line .= '</li>'; if ($e['DTSTAMP'] >= $lastmodified) {
if ($e['DTSTAMP'] >= $lastmodified && !$recentonly) { $line .= " 🆕";
$line = "<b>$line</b>";
} }
$line .= '</li>';
$html .= $line; $html .= $line;
} }
} }