Testing updates
This commit is contained in:
53
cal_testing.php
Executable file
53
cal_testing.php
Executable file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
// Set header to tell clients it's a calendar feed
|
||||||
|
header('Content-Type: text/calendar; charset=utf-8');
|
||||||
|
header('Content-Disposition: inline; filename=calendar.ics');
|
||||||
|
|
||||||
|
// Use Brisbane timezone (no DST)
|
||||||
|
date_default_timezone_set('Australia/Brisbane');
|
||||||
|
|
||||||
|
// Read and parse the JSON file
|
||||||
|
$json = file_get_contents('events_testing.json');
|
||||||
|
$events = json_decode($json, true);
|
||||||
|
|
||||||
|
// Start of the iCalendar content
|
||||||
|
echo "BEGIN:VCALENDAR\r\n";
|
||||||
|
echo "VERSION:2.0\r\n";
|
||||||
|
echo "PRODID:-//HLB//Brisbane Calendar//EN\r\n";
|
||||||
|
echo "CALSCALE:GREGORIAN\r\n";
|
||||||
|
echo "METHOD:PUBLISH\r\n";
|
||||||
|
echo "X-WR-TIMEZONE:Australia/Brisbane\r\n";
|
||||||
|
|
||||||
|
// Add VTIMEZONE block for Australia/Brisbane
|
||||||
|
echo "BEGIN:VTIMEZONE\r\n";
|
||||||
|
echo "TZID:Australia/Brisbane\r\n";
|
||||||
|
echo "BEGIN:STANDARD\r\n";
|
||||||
|
echo "DTSTART:19700101T000000\r\n";
|
||||||
|
echo "TZOFFSETFROM:+1000\r\n";
|
||||||
|
echo "TZOFFSETTO:+1000\r\n";
|
||||||
|
echo "TZNAME:AEST\r\n";
|
||||||
|
echo "END:STANDARD\r\n";
|
||||||
|
echo "END:VTIMEZONE\r\n";
|
||||||
|
|
||||||
|
// Generate VEVENTS
|
||||||
|
foreach ($events as $event) {
|
||||||
|
$uid = uniqid() . "@yourdomain.com";
|
||||||
|
|
||||||
|
$dtstart = date("Ymd\THis", strtotime($event["start"]));
|
||||||
|
$dtend = date("Ymd\THis", strtotime($event["end"]));
|
||||||
|
$summary = htmlspecialchars($event["title"]);
|
||||||
|
$location = htmlspecialchars($event["location"]);
|
||||||
|
|
||||||
|
echo "BEGIN:VEVENT\r\n";
|
||||||
|
echo "UID:$uid\r\n";
|
||||||
|
echo "DTSTAMP:" . gmdate("Ymd\THis\Z") . "\r\n";
|
||||||
|
echo "DTSTART;TZID=Australia/Brisbane:$dtstart\r\n";
|
||||||
|
echo "DTEND;TZID=Australia/Brisbane:$dtend\r\n";
|
||||||
|
echo "SUMMARY:$summary\r\n";
|
||||||
|
echo "LOCATION:$location\r\n";
|
||||||
|
echo "END:VEVENT\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of calendar
|
||||||
|
echo "END:VCALENDAR\r\n";
|
||||||
|
?>
|
||||||
16
events_testing.json
Executable file
16
events_testing.json
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"start": "2025-06-10T19:00:00",
|
||||||
|
"end": "2025-06-10T21:00:00",
|
||||||
|
"title": "June 2025 Online Catch Up",
|
||||||
|
"description": "Getting started with meshtastic",
|
||||||
|
"location": "Jitsi"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"start": "2025-06-19T18:30:00",
|
||||||
|
"end": "2025-06-19T21:00:00",
|
||||||
|
"title": "June 2025 In Person Catch Up",
|
||||||
|
"location": "Chermside Library"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Reference in New Issue
Block a user