Display-Seiten: Betriebszeiten, PIN, Gerätesperre, Sprache und Vorschau
All checks were successful
CI / PHP Lint (push) Successful in 34s
CI / PHP Lint-1 (push) Successful in 39s
CI / Unit Tests & Static Analysis (push) Successful in 38s
CI / PHP Lint (pull_request) Successful in 41s
CI / PHP Lint-1 (pull_request) Successful in 49s
CI / Unit Tests & Static Analysis (pull_request) Successful in 41s

Die Display-Seiten hängen an öffentlichen Links, deshalb bekommen sie
Regler, mit denen sich der Missbrauch begrenzen lässt, und ein paar
Komfortfunktionen für den Betrieb:

- Betriebszeiten je Seite (auch über Mitternacht hinweg); außerhalb
  zeigt die Seite einen Hinweis statt des Buttons
- Optionale PIN von der Rezeption, geprüft mit hash_equals
- Wartezeit je Gerät über ein Cookie, zusätzlich zum globalen Cooldown
- Feste Sprache je Seite, sonst Browsersprache; Gäste können unten
  umschalten
- Reporting zeigt die Ausgabe pro Display-Seite
- Vorschau der Seite direkt in der Administration
- Backup exportiert und importiert die neuen Felder mit

Migration 0007, 16 neue Sprachschlüssel, 7 zusätzliche Tests
(69 Tests, 152 Assertions).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-24 11:21:20 +00:00
parent 88f40a3d21
commit dd8e805e27
28 changed files with 478 additions and 26 deletions

View file

@ -88,6 +88,24 @@ $chartLabels = array_map(fn($r) => date('d.m', strtotime($r['d'])), $daily);
$chartData = array_map(fn($r) => (int)$r['c'], $daily);
$csrf = $auth->getCsrfToken();
// Auswertung der Display-Seiten: woher kommen die Codes?
try {
$perKiosk = $db->fetchAll(
"SELECT k.name, s.name AS site_name,
COUNT(v.id) AS total,
SUM(CASE WHEN v.created_at >= DATE_SUB(NOW(), INTERVAL ? DAY) THEN 1 ELSE 0 END) AS in_period
FROM kiosks k
INNER JOIN sites s ON s.id = k.site_id
LEFT JOIN vouchers v ON v.kiosk_id = k.id
GROUP BY k.id, k.name, s.name
HAVING total > 0
ORDER BY in_period DESC, total DESC",
[$days]
);
} catch (Exception $e) {
$perKiosk = []; // Tabelle fehlt auf alten Installationen
}
$currentPage = 'reports';
$adminBase = '';
?>
@ -142,6 +160,19 @@ $adminBase = '';
</table>
</div>
<div class="card">
<h2><?= __('rep_per_kiosk') ?></h2>
<?php if (empty($perKiosk)): ?>
<p class="muted"><?= __('rep_kiosk_none') ?></p>
<?php else: ?>
<table><tr><th><?= __('kiosks_name') ?></th><th><?= __('label_site') ?></th><th><?= str_replace('{days}', (string)$days, __('rep_in_period')) ?></th><th><?= __('label_total') ?></th></tr>
<?php foreach ($perKiosk as $r): ?>
<tr><td><?= htmlspecialchars($r['name']) ?></td><td><?= htmlspecialchars($r['site_name']) ?></td><td><?= (int)$r['in_period'] ?></td><td><?= (int)$r['total'] ?></td></tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>
<div class="card">
<h2><?= __('rep_top_users') ?></h2>
<table><tr><th><?= __('label_user') ?></th><th><?= __('rep_col_created') ?></th></tr>