Finished off the agenda and minutes features in the adm page. Added another six events to the calendar.

This commit is contained in:
2025-07-10 12:40:53 +10:00
parent 558012bf89
commit 3e32ea92b4
7 changed files with 121 additions and 29 deletions

View File

@@ -33,4 +33,32 @@ function getEvents() {
return($entries);
}
function putEvents($events) {
for ( $i = 0; $i < count($events); $i++ ) {
$entry = $events[$i];
$dt = new DateTime( $entry["start"] );
$start = new DateTime($entry["start"]);
$datestamp = $dt -> format("Ymd");
$files = array( "agenda" => sprintf("dat/agenda/%d.md", $datestamp)
, "minutes" => sprintf("dat/minutes/%d.md", $datestamp)
);
foreach ( $files as $key => $path ) {
if ( in_array($key, array_keys($entry)) ) {
$fout = fopen($path, "wt");
fwrite($fout, $entry[$key]);
fclose($fout);
} else {
if ( file_exists($path) ) {
unlink($path);
}
}
}
foreach ( array( "ctl", "hours", "agenda", "minutes" ) as $field ) {
unset($events[$i][$field]);
}
}
$json = json_encode($events, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
file_put_contents("dat/events.json", $json);
}
?>