rinkplanner/hub/views/admin_routines.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

94 lines
4.6 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
$linkFor = static function (int $targetPage) use ($query): string {
$params = [];
if ($query !== '') {
$params['q'] = $query;
}
if ($targetPage > 1) {
$params['page'] = $targetPage;
}
return url('/admin/routines') . ($params ? '?' . http_build_query($params) : '');
};
?>
<div class="page-head">
<div>
<h1><?= e(t('admin.title')) ?></h1>
<p class="muted"><?= e(t('admin_routines.lede', ['total' => (int) $total])) ?></p>
</div>
</div>
<?php $active = 'routines'; require HUB_ROOT . '/views/_admin_nav.php'; ?>
<div class="toolbar">
<form method="get" action="<?= e(url('/admin/routines')) ?>" class="search">
<input type="search" name="q" value="<?= e_attr($query) ?>" placeholder="<?= e_attr(t('admin_routines.search_placeholder')) ?>">
<button type="submit"><?= e(t('dashboard.search')) ?></button>
</form>
</div>
<?php if (!$items): ?>
<div class="empty"><p><?= e(t('admin_routines.empty')) ?></p></div>
<?php else: ?>
<div class="table-wrap">
<table class="list compact">
<thead>
<tr>
<th><?= e(t('table.title')) ?></th>
<th><?= e(t('table.by')) ?></th>
<th><?= e(t('table.status')) ?></th>
<th><?= e(t('table.revision')) ?></th>
<th><?= e(t('table.updated')) ?></th>
<th><?= e(t('table.downloads')) ?></th>
<th><?= e(t('table.actions')) ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($items as $item): ?>
<tr>
<td><a href="<?= e(url('/routines/' . (int) $item['id'])) ?>"><?= e($item['title']) ?></a></td>
<td><?= e($item['owner_username']) ?></td>
<td><span class="status status-<?= $item['status'] === 'published' ? 'open' : 'expired' ?>"><?= e($item['status']) ?></span></td>
<td><?= $item['revision'] !== null ? (int) $item['revision'] : '–' ?></td>
<td><?= e(fmt_dt($item['updated_at'])) ?></td>
<td><?= (int) $item['download_count'] ?></td>
<td>
<div class="row-actions">
<form class="inline" method="post" action="<?= e(url('/admin/routines/action')) ?>">
<?= csrf_field() ?>
<input type="hidden" name="routine_id" value="<?= (int) $item['id'] ?>">
<input type="hidden" name="action" value="<?= $item['status'] === 'published' ? 'hide' : 'publish' ?>">
<button class="link-button" type="submit"><?= e($item['status'] === 'published' ? t('admin_routines.hide') : t('admin_routines.publish')) ?></button>
</form>
<details class="danger-zone">
<summary><?= e(t('admin_routines.delete')) ?></summary>
<form method="post" action="<?= e(url('/admin/routines/action')) ?>" class="stack-tight">
<?= csrf_field() ?>
<input type="hidden" name="routine_id" value="<?= (int) $item['id'] ?>">
<input type="hidden" name="action" value="delete">
<label class="check small">
<input type="checkbox" name="confirm" value="1" required>
<?= e(t('admin_routines.delete_confirm')) ?>
</label>
<button class="link-button danger" type="submit"><?= e(t('admin_routines.delete_submit')) ?></button>
</form>
</details>
</div>
</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; ?>