-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexamples.php
137 lines (124 loc) · 4.08 KB
/
examples.php
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
include_once('common.php');
$example = isset($_GET['example']) ? $_GET['example'] : null;
$h2 = _('Liturgical Calendar as an HTML table produced by Javascript');
$JAVASCRIPT_EXAMPLE_CONTENTS = <<<EOT
<form id="litcalForm">
<div class="row mb-4" id="calendarOptions">
<h2>{$h2}</h2>
</div>
</form>
<div id="litcalWebcalendar"></div>
<table id="LitCalMessages">
<thead></thead>
<tbody></tbody>
</table>
<script type="module" src="examples/javascript/main.js"></script>
EOT;
$FULLCALENDAR_MESSAGES_FIRST = <<<EOT
<table id="LitCalMessages">
<thead></thead>
<tbody></tbody>
</table>
<div id='calendar'></div>
EOT;
$FULLCALENDAR_CALENDAR_FIRST = <<<EOT
<div id='calendar'></div>
<table id="LitCalMessages">
<thead></thead>
<tbody></tbody>
</table>
EOT;
$FULLCALENDAR_EXAMPLE_CONTENTS = <<<EOT
<div id="spinnerWrapper">
<div class="lds-roller">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<header>
<div id="calendarOptions" class="row mb-4"></div>
</header>
{INTERPOLATE}
<script type="importmap">
{
"imports": {
"@fullcalendar/core": "https://cdn.skypack.dev/@fullcalendar/core@6.1.15",
"@fullcalendar/core/": "https://cdn.skypack.dev/@fullcalendar/core@6.1.15/",
"@fullcalendar/daygrid": "https://cdn.skypack.dev/@fullcalendar/daygrid@6.1.15",
"@fullcalendar/list": "https://cdn.skypack.dev/@fullcalendar/list@6.1.15",
"@fullcalendar/bootstrap5": "https://cdn.skypack.dev/@fullcalendar/bootstrap5@6.1.15",
"@liturgical-calendar/components-js": "https://cdn.jsdelivr.net/npm/@liturgical-calendar/components-js@1.2.0/+esm"
}
}
</script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/latest/js.cookie.min.js"
integrity="sha512-iewyUmLNmAZBOOtFnG+GlGeGudYzwDjE1SX3l9SWpGUs0qJTzdeVgGFeBeU7/BIyOZdDy6DpILikEBBvixqO9Q=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script type="module" src="examples/fullcalendar/script.js"></script>
EOT;
$EXAMPLES = [
"PHP" => "examples/php/index.php",
"JavaScript" => $JAVASCRIPT_EXAMPLE_CONTENTS,
"FullCalendar" => strtr($FULLCALENDAR_EXAMPLE_CONTENTS, [
"{INTERPOLATE}" => $FULLCALENDAR_CALENDAR_FIRST
]),
"FullCalendarMessages" => strtr($FULLCALENDAR_EXAMPLE_CONTENTS, [
"{INTERPOLATE}" => $FULLCALENDAR_MESSAGES_FIRST
])
];
?><!doctype html>
<html lang="<?php echo $i18n->LOCALE; ?>">
<head>
<title><?php
echo _("General Roman Calendar");
?></title>
<?php
include_once('layout/head.php');
// Since JavaScript is not an iframe, we need to ensure the CSS is loaded
if ($example) {
switch ($example) {
case "JavaScript":
echo '<link rel="stylesheet" href="examples/javascript/styles.css">';
break;
case "FullCalendar":
case "FullCalendarMessages":
echo '<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css" rel="stylesheet">';
echo '<link href="examples/fullcalendar/styles.css" rel="stylesheet" />';
break;
case "PHP":
echo '<link href="examples/php/styles.css" rel="stylesheet" />';
break;
}
}
?>
</head>
<body class="sb-nav-fixed">
<?php
include_once('layout/header.php');
if (array_key_exists($example, $EXAMPLES)) {
switch ($example) {
case "PHP":
include_once($EXAMPLES[$example]);
break;
case "JavaScript":
case "FullCalendar":
case "FullCalendarMessages":
echo $EXAMPLES[$example];
break;
}
} else {
echo "<h1>" . sprintf(_("Example '%s' not found"), $example) . "</h1>";
}
include_once('layout/footer.php');
?>
</body>
</html>