rinkplanner/hub/views/dashboard.php
torsten 055a2919c3 feat: Kür-Hub mit Einladungen, Uploads und API
- PHP-App unter hub/ für rinkplanner-hub.programmschmiede.de
- MariaDB-Schema, Argon2id, Sessions, CSRF und Ratenbegrenzung
- Einladungscodes, Admin-Bereich und Kür-Pakete mit Audiodatei
- JSON-API v1 mit Bearer-Tokens für die Godot-App
- Deployment und Erstinstallation über tools/deploy_hub.sh
- Doku und Credentials-Vorlage ergänzt
2026-11-11 13:14:26 +01:00

110 lines
4.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php /** @var array $items */ ?>
<?php /** @var int $total */ ?>
<?php /** @var int $page */ ?>
<?php /** @var int $pages */ ?>
<?php /** @var string $query */ ?>
<?php /** @var bool $mine */ ?>
<?php
$linkFor = static function (int $targetPage) use ($query, $mine): string {
$params = [];
if ($query !== '') {
$params['q'] = $query;
}
if ($mine) {
$params['mine'] = '1';
}
if ($targetPage > 1) {
$params['page'] = $targetPage;
}
return url('/') . ($params ? '?' . http_build_query($params) : '');
};
?>
<div class="page-head">
<div>
<h1>Küren</h1>
<p class="muted"><?= (int) $total ?> <?= $total === 1 ? 'Kür' : 'Küren' ?> im Hub<?= $mine ? ' (nur deine)' : '' ?>.</p>
</div>
<a class="button primary" href="<?= e(url('/upload')) ?>">Kür hochladen</a>
</div>
<div class="toolbar">
<form method="get" action="<?= e(url('/')) ?>" class="search">
<input type="search" name="q" value="<?= e_attr($query) ?>" placeholder="Titel, Skater, Musik, Benutzer …">
<?php if ($mine): ?><input type="hidden" name="mine" value="1"><?php endif; ?>
<button type="submit">Suchen</button>
</form>
<div class="tabs">
<a class="<?= $mine ? '' : 'active' ?>" href="<?= e(url('/')) ?>">Alle</a>
<a class="<?= $mine ? 'active' : '' ?>" href="<?= e(url('/?mine=1')) ?>">Meine Küren</a>
</div>
</div>
<?php if (!$items): ?>
<div class="empty">
<p>Keine Küren gefunden.</p>
<?php if ($query !== ''): ?>
<p class="muted">Suche zurücksetzen oder <a href="<?= e(url('/upload')) ?>">selbst eine Kür hochladen</a>.</p>
<?php else: ?>
<p class="muted">Der Hub ist noch leer. <a href="<?= e(url('/upload')) ?>">Erste Kür hochladen</a>.</p>
<?php endif; ?>
</div>
<?php else: ?>
<div class="table-wrap">
<table class="list">
<thead>
<tr>
<th>Titel</th>
<th>Skater</th>
<th>Musik</th>
<th>Rev.</th>
<th>Größe</th>
<th>Aktualisiert</th>
<th>Von</th>
</tr>
</thead>
<tbody>
<?php foreach ($items as $item): ?>
<tr>
<td>
<a class="title-link" href="<?= e(url('/routines/' . (int) $item['id'])) ?>"><?= e($item['title']) ?></a>
<?php if ($item['status'] !== 'published'): ?>
<span class="badge">versteckt</span>
<?php endif; ?>
<?php if (!empty($item['category'])): ?>
<span class="badge badge-soft"><?= e($item['category']) ?></span>
<?php endif; ?>
</td>
<td><?= e($item['skater_name'] ?? '–') ?></td>
<td>
<?= e($item['music_title'] ?: ($item['audio_original_name'] ?? '–')) ?>
<?php if (!empty($item['music_artist'])): ?>
<span class="muted">· <?= e($item['music_artist']) ?></span>
<?php endif; ?>
</td>
<td><?= $item['revision'] !== null ? (int) $item['revision'] : '–' ?></td>
<td>
<?= e(human_bytes((int) ($item['routine_bytes'] ?? 0))) ?>
<?php if (!empty($item['audio_bytes'])): ?>
<span class="muted">+ <?= e(human_bytes((int) $item['audio_bytes'])) ?></span>
<?php endif; ?>
</td>
<td><?= e(fmt_dt($item['updated_at'])) ?></td>
<td><?= e($item['owner_display_name'] ?: $item['owner_username']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php if ($pages > 1): ?>
<nav class="pagination">
<?php if ($page > 1): ?>
<a href="<?= e($linkFor($page - 1)) ?>">← Zurück</a>
<?php endif; ?>
<span>Seite <?= (int) $page ?> von <?= (int) $pages ?></span>
<?php if ($page < $pages): ?>
<a href="<?= e($linkFor($page + 1)) ?>">Weiter →</a>
<?php endif; ?>
</nav>
<?php endif; ?>
<?php endif; ?>