request more items from schedule api and make table

This commit is contained in:
Ben Harris 2020-06-18 15:36:12 -04:00
parent c1d42e189b
commit 6bafb428ea
1 changed files with 23 additions and 5 deletions

View File

@ -1,14 +1,32 @@
<?php
include '../header.php';
$schedule = json_decode(file_get_contents("https://radio.tildeverse.org/api/station/1/schedule"), true);
$schedule = json_decode(file_get_contents("https://radio.tildeverse.org/api/station/1/schedule?rows=1000&now=last%20monday"), true);
date_default_timezone_set("UTC");
function formatdate($date) {
return date("D H:i", strtotime($date));
}
?>
<h1><a href="https://tilderadio.org"><img style="width:75px;" src="../logos/tilderadio-green.png">tilderadio.org</a></h1>
<br>
<h4>upcoming broadcasts</h4>
<p>all times in UTC</p>
<?php foreach ($schedule as $item): ?>
<p><?=$item["name"]?> - <?=$item["start"]?>-<?=$item["end"]?></p>
<?php endforeach; ?>
<table class="table table-striped">
<thead>
<tr>
<th>dj</th>
<th>time</th>
</tr>
</thead>
<tbody>
<?php foreach ($schedule as $item): ?>
<tr>
<td><?=$item["name"]?></td>
<td><?=formatdate($item["start"])?> - <?=formatdate($item["end"])?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php include '../footer.php'; ?>