-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRomanCalendarRenderHTML.php
More file actions
69 lines (63 loc) · 2.18 KB
/
RomanCalendarRenderHTML.php
File metadata and controls
69 lines (63 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
namespace RomanCalendar;
/**
* RomanCalendar 5.0
* @author Br. Jayarathina Madharasan SDB
* @created 2025-08-07
* @updated 2025-08-07
* @description This class generates HTML for the Roman Catholic Calendar.
* @version 5.0
* @license MIT
*
*/
class RomanCalendarRenderHTML {
function printYearHTML($currentYear, $fullYear) {
//Previous year and next year navigation
$rows = "<tr><th colspan=2> <a class='arrowRight' href='index.php?year=" . ($currentYear - 1) . "'>◄</a> {$currentYear} <a class='arrowLeft' href='index.php?year=" . ($currentYear + 1) . "'>►</a> </th></tr>";
foreach ($fullYear as $month => $value) {
foreach ($value as $days => $feasts) {
$tempDt2 = new \DateTime($currentYear . "-$month-$days");
if ($days == 1) {
$rows .= '<tr><td class="dt" colspan=2>' . $tempDt2->format('F') . '</td></tr>';
}
$rows .= '<tr>';
$rows .= '<td class="dt">' . $tempDt2->format('d M D') . '</td>';
$rows .= '<td class="dayTitle">';
foreach ($feasts as $feastIndex => $fet) {
if ($feastIndex == 'other') {
$rows .= '<b><i>In other years:</i></b><br/>';
foreach ($fet as $otherFet) {
$type = isset($otherFet['type']) ? ' (' . $this->getFeastType( $otherFet['type']) . ')' : '';
$rows .= $otherFet['name'] . $type . '<span class="dot Col' . $otherFet["color"] . '"></span><br/>';
}
} else {
$rows .= $fet['name'];
$rows .= isset($fet['type']) ? ' (' . $this->getFeastType($fet['type']) . ')' : ''; // Day Type: Memory, Feast etc.,
$rows .= '<span class="dot Col' . $fet["color"] . '"></span><br/>';
}
}
$rows .= '</td>';
$rows .= '</tr>';
}
}
echo "<table>$rows</table>";
}
private function getFeastType($fType) {
return match ($fType) {
'' => '',
'Solemnity' => 'Sol.',
'Solemnity-PrincipalPartron-Place' => 'Sol.',
'Feast-Lord' => 'Feast',
'Feast' => 'Feast',
'Feast-PrincipalPartron-Place' => 'Feast',
'Mem' => 'Mem',
'Mem-Mary' => 'Mem',
'OpMem' => 'Op. Mem',
'Mem-Mary-Sat' => 'Mem',
'Mem-OwnChurch' => 'Mem.',
'OpMem-Commemoration' => 'Commem.',
'Commemoration' => 'Commem.',
'All Souls' => ''
};
}
}