Replaced the google calendar with our own itinerary, driven from our JSON file.
This commit is contained in:
199
index.php
Executable file
199
index.php
Executable file
@@ -0,0 +1,199 @@
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
|
||||
function getEvents() {
|
||||
$content = file_get_contents("events.json");
|
||||
$entries = json_decode($content, $associative = true);
|
||||
for ( $i = 0; $i < count($entries); $i++ ) {
|
||||
$entry = $entries[$i];
|
||||
$dt = new DateTime( $entry["start"] );
|
||||
$ctl = $dt -> format("YmdHi");
|
||||
$entries[$i]["ctl"] = $ctl;
|
||||
}
|
||||
usort($entries, function ($a, $b) {
|
||||
$dateA = new DateTime($a['start']);
|
||||
$dateB = new DateTime($b['start']);
|
||||
return $dateA < $dateB ? 1 : -1;
|
||||
});
|
||||
return($entries);
|
||||
}
|
||||
|
||||
?>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Homelab Brisbane</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
crossorigin="anonymous" />
|
||||
<link href="index.css" rel="stylesheet" />
|
||||
<style>
|
||||
.card img {
|
||||
max-height: 120px;
|
||||
height: auto;
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="p-5 mt-4 mb-4 bg-body-secondary rounded-3">
|
||||
<div class="container-fluid py-4">
|
||||
<h1 class="display-5 fw-bold">Homelab Brisbane</h1>
|
||||
<p class="col-md-12 fs-4">We’re a group of tech enthusiasts who enjoy exploring the latest trends in technology using our own hardware, in our own time. We founded Homelab Brisbane to connect with others who share this passion — to ask and answer questions, share insights, and make discoveries together.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col d-flex">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<img src="image/icon/webcam.png" class="card-img-top" alt="...">
|
||||
<h5 class="card-title">Meet Online</h5>
|
||||
We meet online with our <a href="https://meet.homelabbrisbane.com.au/" target="jitsi">Jitsi</a> server every month. With these online meetings we can meet face to face, and even include people outside of Brisbane. They are announced on <a href="https://www.meetup.com/brisbane-homelabs/" target="meetup">meetup.com</a> and the Google calendar below.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<img src="image/icon/handshake.png" class="card-img-top" alt="...">
|
||||
<h5 class="card-title">Meet In Person</h5>
|
||||
Once a month we also meet in person in a library meeting room in Brisbane. We try to move these around to make them convenient to a broader range of people. These gatherings are also announced on <a href="https://www.meetup.com/brisbane-homelabs/" target="meetup">meetup.com</a> and on the Google calendar below.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<img src="image/icon/chat.png" class="card-img-top" alt="...">
|
||||
<h5 class="card-title">Online Forum</h5>
|
||||
When we're not meeting in person or online, we're discussing our various interests and projects on our <a href="https://discourse.homelabbrisbane.com.au/" target="discourse">Discourse</a> server.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<img src="image/icon/email.png" class="card-img-top" alt="...">
|
||||
<h5 class="card-title">Contact Us</h5>
|
||||
If you have any other inquiries you can always email us at <a href="mailto:listmaster@homelabbrisbane.com.au">listmaster@homelabbrisbane.com.au</a>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row mt-4">
|
||||
<div class="col">
|
||||
<p>We publish our past and upcoming events on the following url. You can subscribe to them in the calendar of your choice.</p>
|
||||
<div class="input-group input-group-lg">
|
||||
<span class="input-group-text" id="basic-addon1">📅</span>
|
||||
<input type="text" class="form-control" disabled value="https://homelabbrisbane.com.au/cal.php">
|
||||
<button class="btn btn-outline-secondary" type="button" action="copy" value="https://homelabbrisbane.com.au/cal.php">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
<div class="col">
|
||||
<?php
|
||||
$events = getEvents();
|
||||
?>
|
||||
<div class="accordion" id="accordionExample">
|
||||
<?php
|
||||
$nextCtl = null;
|
||||
foreach ( $events as $event ) {
|
||||
if ( ( new DateTime($event["start"]) ) > ( new DateTime() ) ) {
|
||||
$nextCtl = $event["ctl"];
|
||||
}
|
||||
?>
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#ctl<?= $event["ctl"] ?>" aria-expanded="false" aria-controls="ctl<?= $event["ctl"] ?>">
|
||||
<?= ( new DateTime($event["start"]) ) -> format("j M Y") ?>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="ctl<?= $event["ctl"] ?>" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
|
||||
<div class="accordion-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card-body">
|
||||
<h3 class="card-title"><?= $event["title"] ?></h3>
|
||||
<div class="input-group mt-3 mb-3">
|
||||
<span class="input-group-text" id="basic-addon1">Location</span>
|
||||
<input type="text" class="form-control" disabled value="<?= $event["location"] ?>">
|
||||
<?php
|
||||
if ( $event["location"] == "Jitsi" ) {
|
||||
?>
|
||||
<button class="btn btn-outline-secondary" type="button" action="jitsi">
|
||||
<img style="margin-top: -8px; max-height: 26px;" src="image/icon/jitsi.svg" />
|
||||
</button>
|
||||
<?php
|
||||
} elseif ( in_array( "coordinates", array_keys($event) ) ) {
|
||||
?>
|
||||
<button class="btn btn-outline-secondary" type="button" action="map" coordinates="<?= $event["coordinates"] ?>">📍</button>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php if ( in_array( "description", array_keys($event) ) ) { ?>
|
||||
<h5 class="card-title mb-2">Description</h5>
|
||||
<p><?= $event["description"] ?></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<?php
|
||||
if ( in_array( "minutes", array_keys($event) ) ) {
|
||||
?>
|
||||
<h5 class="card-title mb-2">Minutes</h5>
|
||||
<p style="white-space: pre;"><?= $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>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user