Files
radio-free-elsewhere/admin/shows.php
T
2026-10-30 08:37:10 -05:00

47 lines
1.3 KiB
PHP

<?php
require __DIR__ . '/../includes/auth.php';
require __DIR__ . '/../includes/admin_layout.php';
$admin = requireAdmin();
$shows = getDB()->query('SELECT id, slug, name, background_image FROM shows ORDER BY name')->fetchAll();
adminHeader('Shows', $admin);
?>
<ul class="actions">
<li><a href="show_edit.php" class="button primary small">Add a show</a></li>
</ul>
<div class="table-wrapper">
<table>
<thead>
<tr>
<th>Background</th>
<th>Name</th>
<th>Slug</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($shows as $show): ?>
<tr>
<td>
<?php if ($show['background_image']): ?>
<img src="../images/backgrounds/<?= e(rawurlencode($show['background_image'])) ?>" alt="" style="width:80px;height:50px;object-fit:cover;border-radius:4px;display:block;">
<?php else: ?>
<em>Default</em>
<?php endif; ?>
</td>
<td><?= e($show['name']) ?></td>
<td><code><?= e($show['slug']) ?></code></td>
<td><a href="show_edit.php?id=<?= (int)$show['id'] ?>">Edit</a></td>
</tr>
<?php endforeach; ?>
<?php if (!$shows): ?>
<tr><td colspan="4">No shows yet.</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php
adminFooter();