Broke agenda and minutes out into folders of markdown.
This commit is contained in:
42
index.php
42
index.php
@@ -1,6 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
use Michelf\Markdown;
|
||||
|
||||
function getEvents() {
|
||||
$content = file_get_contents("events.json");
|
||||
$entries = json_decode($content, $associative = true);
|
||||
@@ -9,6 +12,15 @@ function getEvents() {
|
||||
$dt = new DateTime( $entry["start"] );
|
||||
$ctl = $dt -> format("YmdHi");
|
||||
$entries[$i]["ctl"] = $ctl;
|
||||
$datestamp = $dt -> format("Ymd");
|
||||
$files = array( "agenda" => sprintf("agenda/%d.md", $datestamp)
|
||||
, "minutes" => sprintf("minutes/%d.md", $datestamp)
|
||||
);
|
||||
foreach ( $files as $key => $file ) {
|
||||
if ( file_exists( $file ) ) {
|
||||
$entries[$i][$key] = file_get_contents($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
usort($entries, function ($a, $b) {
|
||||
$dateA = new DateTime($a['start']);
|
||||
@@ -151,12 +163,12 @@ function getEvents() {
|
||||
if ( in_array( "minutes", array_keys($event) ) ) {
|
||||
?>
|
||||
<h5 class="card-title mb-2">Minutes</h5>
|
||||
<p style="white-space: pre;"><?= $event["minutes"] ?></p>
|
||||
<p style="white-space: pre;"><?= Markdown::defaultTransform($event["minutes"]) ?></p>
|
||||
<?php
|
||||
} elseif ( in_array( "agenda", array_keys($event) ) ) {
|
||||
?>
|
||||
<h5 class="card-title mb-2">Agenda</h5>
|
||||
<p style="white-space: pre;"><?= $event["agenda"] ?></p>
|
||||
<p style="white-space: pre;"><?= Markdown::defaultTransform($event["agenda"]) ?></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -172,32 +184,10 @@ function getEvents() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="vars" style="display: none;" nextCtl="<?= $nextCtl ?>"></div>
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var c = $('button.accordion-button[data-bs-target="#ctl<?= $nextCtl ?>"]');
|
||||
console.log(c.length);
|
||||
$(c).click();
|
||||
$('button[action]').click(function() {
|
||||
var action = $(this).attr('action');
|
||||
var url = null;
|
||||
var target = action;
|
||||
if ( action == 'jitsi' ) {
|
||||
url = 'https://meet.homelabbrisbane.com.au/';
|
||||
}
|
||||
if ( action == 'map' ) {
|
||||
url = 'https://www.google.com/maps/place/' + $(this).attr('coordinates');
|
||||
}
|
||||
if ( action == 'copy' ) {
|
||||
navigator.clipboard.writeText( $(this).attr('value') );
|
||||
}
|
||||
if ( url != null ) {
|
||||
window.open( url, target );
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user