rinkplanner/hub/views/dashboard.php
torsten 9819311403 feat: Website und Hub zweisprachig (Deutsch/Englisch)
Website (rinkplanner.programmschmiede.de) liegt jetzt im Repo unter web/:
Sprachweiche nach Accept-Language (der User-Agent enthält keine Sprache),
/de/ und /en/ als eigene URLs mit hreflang, Cookie für die manuelle Wahl,
Texte in web/i18n.php, Markup in web/template.php. Deployment über
tools/deploy_web.sh (--sync, --check, --all); /index.html leitet weiter.

Hub: optionale englische Oberfläche über den DE/EN-Umschalter, Cookie
RHUB_LANG, Route /language. Alle Texte (Views, Meldungen, Validierung,
API-messages) stehen in hub/app/i18n_strings.php und laufen über t();
Datum und Zahlen folgen der Sprache. Die API behält ihre code-Felder und
antwortet ohne Cookie weiter deutsch.

deploy_hub.sh --check prüft jetzt Schlüsselparität und fehlende t()-Schlüssel.
Doku: docs/website.md neu, docs/hub.md und AGENTS.md ergänzt.
2026-11-12 22:38:32 +01:00

124 lines
5.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) : '');
};
?>
<section class="hub-hero">
<img class="hub-hero-logo" src="<?= e(url('/assets/logo.png')) ?>"
alt="Rinkplanner-Hub-Logo: drei Schlittschuhe, durch ein Netz verbunden"
width="132" height="132">
<div class="hub-hero-text">
<p class="eyebrow"><?= e(t('dashboard.eyebrow')) ?></p>
<p class="hub-hero-title"><?= e(t('dashboard.hero_title')) ?></p>
<p class="hub-hero-sub"><?= e(t('dashboard.hero_sub')) ?></p>
</div>
</section>
<div class="page-head">
<div>
<h1><?= e(t('dashboard.title')) ?></h1>
<p class="muted"><?= e(t('dashboard.count', [
'count' => (int) $total,
'label' => t($total === 1 ? 'dashboard.one_routine' : 'dashboard.many_routines'),
])) ?><?= $mine ? e(t('dashboard.mine_suffix')) : '' ?>.</p>
</div>
<a class="button primary" href="<?= e(url('/upload')) ?>"><?= e(t('dashboard.upload')) ?></a>
</div>
<div class="toolbar">
<form method="get" action="<?= e(url('/')) ?>" class="search">
<input type="search" name="q" value="<?= e_attr($query) ?>" placeholder="<?= e_attr(t('dashboard.search_placeholder')) ?>">
<?php if ($mine): ?><input type="hidden" name="mine" value="1"><?php endif; ?>
<button type="submit"><?= e(t('dashboard.search')) ?></button>
</form>
<div class="tabs">
<a class="<?= $mine ? '' : 'active' ?>" href="<?= e(url('/')) ?>"><?= e(t('dashboard.all')) ?></a>
<a class="<?= $mine ? 'active' : '' ?>" href="<?= e(url('/?mine=1')) ?>"><?= e(t('dashboard.mine')) ?></a>
</div>
</div>
<?php if (!$items): ?>
<div class="empty">
<p><?= e(t('dashboard.empty')) ?></p>
<?php if ($query !== ''): ?>
<p class="muted"><?= e(t('dashboard.empty_hint')) ?> <a href="<?= e(url('/upload')) ?>"><?= e(t('dashboard.empty_upload')) ?></a>.</p>
<?php else: ?>
<p class="muted"><?= e(t('dashboard.empty_first')) ?> <a href="<?= e(url('/upload')) ?>"><?= e(t('dashboard.empty_first_action')) ?></a>.</p>
<?php endif; ?>
</div>
<?php else: ?>
<div class="table-wrap">
<table class="list">
<thead>
<tr>
<th><?= e(t('table.title')) ?></th>
<th><?= e(t('table.skater')) ?></th>
<th><?= e(t('table.music')) ?></th>
<th><?= e(t('table.revision')) ?></th>
<th><?= e(t('table.size')) ?></th>
<th><?= e(t('table.updated')) ?></th>
<th><?= e(t('table.by')) ?></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"><?= e(t('badge.hidden')) ?></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)) ?>"><?= e(t('pagination.back')) ?></a>
<?php endif; ?>
<span><?= e(t('pagination.page', ['page' => (int) $page, 'pages' => (int) $pages])) ?></span>
<?php if ($page < $pages): ?>
<a href="<?= e($linkFor($page + 1)) ?>"><?= e(t('pagination.next')) ?></a>
<?php endif; ?>
</nav>
<?php endif; ?>
<?php endif; ?>