drink-it-cold/views/layout.php
torsten 952a2874b0 feat(backup): Sicherungen von Datenbank und Dateien mit Restore
- app/backup.php: ein tar.gz-Archiv aus manifest.json (Format, Zeilen- und
  Dateizahl, SHA-256 des Dumps), database.sql (DROP/CREATE/INSERT) und allen
  Dateien aus storage/ ohne backups/ und logs/; Aufbewahrung app.backup_keep,
  eigener SQL-Splitter fürs Einspielen, Rechte 0600/0700
- Verwaltung → Sicherungen (/admin/backups): anlegen, herunterladen, hochladen
  (mit Prüfsummen- und Formatprüfung), einspielen (Datenbank und/oder Dateien,
  Bestätigungswort, automatische Sicherheitskopie, alte Dateien beiseitegelegt),
  löschen
- tools/backup.php (create/list/restore/rotate/delete) und
  /cron/backup?token=… für Hosting ohne SSH
- Bedienungsanleitung um Admin-Abschnitt „Sicherungen“ erweitert, README,
  ROADMAP (Feature 19), DSGVO-Hinweis, Deploy-Manifest um tools/backup.php
2026-11-30 16:11:36 +01:00

191 lines
13 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 string $title */
/** @var string $content */
/** @var array|null $user */
$flashes = flash_pull();
$path = current_path();
$badge = $user !== null ? auth_reminder_badge($user) : 0;
$searchValue = $path === '/search' ? query_string('q') : '';
$isAdmin = ($user['role'] ?? '') === 'admin';
$navActive = static function (string $area) use ($path): string {
return match ($area) {
'dashboard' => $path === '/' ? ' aria-current="page"' : '',
'calendar' => ($path === '/calendar' || str_starts_with($path, '/bookings')) ? ' aria-current="page"' : '',
'reminders' => str_starts_with($path, '/reminders') ? ' aria-current="page"' : '',
'absences' => str_starts_with($path, '/absences') ? ' aria-current="page"' : '',
'admin' => str_starts_with($path, '/admin') ? ' aria-current="page"' : '',
default => '',
};
};
?>
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="theme-color" content="#196abc">
<meta name="color-scheme" content="light">
<meta name="csrf-token" content="<?= e(csrf_token()) ?>">
<meta name="robots" content="noindex, nofollow">
<meta name="sw-url" content="<?= e(url('/sw.js')) ?>">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-mobile-web-app-title" content="Drink it cold">
<meta name="application-name" content="Drink it cold">
<title><?= e($title) ?> · Drink it cold</title>
<link rel="manifest" href="<?= e(url('/manifest.webmanifest')) ?>">
<link rel="icon" type="image/svg+xml" href="<?= e(asset('favicon.svg')) ?>">
<link rel="icon" type="image/png" sizes="32x32" href="<?= e(asset('icons/icon-32.png')) ?>">
<link rel="apple-touch-icon" sizes="180x180" href="<?= e(asset('icons/apple-touch-icon-180.png')) ?>">
<link rel="preload" as="font" type="font/woff2" href="<?= e(asset('fonts/manrope-latin.woff2')) ?>" crossorigin>
<link rel="preload" as="font" type="font/woff2" href="<?= e(asset('fonts/inter-latin.woff2')) ?>" crossorigin>
<link rel="stylesheet" href="<?= e(asset('app.css')) ?>">
<script src="<?= e(asset('app.js')) ?>" defer></script>
</head>
<body class="app">
<a class="skip-link" href="#main">Zum Inhalt springen</a>
<svg width="0" height="0" aria-hidden="true" focusable="false" style="position:absolute">
<defs>
<symbol id="i-grid" viewBox="0 0 24 24"><rect x="3" y="3" width="7.5" height="7.5" rx="1.6"/><rect x="13.5" y="3" width="7.5" height="7.5" rx="1.6"/><rect x="3" y="13.5" width="7.5" height="7.5" rx="1.6"/><rect x="13.5" y="13.5" width="7.5" height="7.5" rx="1.6"/></symbol>
<symbol id="i-calendar" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="16" rx="2.5"/><path d="M8 3v4M16 3v4M3 10.5h18"/></symbol>
<symbol id="i-bell" viewBox="0 0 24 24"><path d="M18 8.5a6 6 0 1 0-12 0c0 5-2 6.5-2 6.5h16s-2-1.5-2-6.5z"/><path d="M10 19a2.2 2.2 0 0 0 4 0"/></symbol>
<symbol id="i-users" viewBox="0 0 24 24"><circle cx="9" cy="8" r="3.4"/><path d="M2.8 20a6.2 6.2 0 0 1 12.4 0"/><path d="M16.4 5.2a3.2 3.2 0 0 1 0 6.1M18 14.6a5.4 5.4 0 0 1 3.2 4.9"/></symbol>
<symbol id="i-search" viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="6.5"/><path d="m15.5 15.5 5 5"/></symbol>
<symbol id="i-plus" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></symbol>
<symbol id="i-left" viewBox="0 0 24 24"><path d="m14.5 5.5-6.5 6.5 6.5 6.5"/></symbol>
<symbol id="i-right" viewBox="0 0 24 24"><path d="m9.5 5.5 6.5 6.5-6.5 6.5"/></symbol>
<symbol id="i-close" viewBox="0 0 24 24"><path d="m6 6 12 12M18 6 6 18"/></symbol>
<symbol id="i-copy" viewBox="0 0 24 24"><rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/></symbol>
<symbol id="i-check" viewBox="0 0 24 24"><path d="m5 12.5 4.5 4.5L19 6.5"/></symbol>
<symbol id="i-clock" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 7v5.4l3.4 2"/></symbol>
<symbol id="i-truck" viewBox="0 0 24 24"><path d="M2.5 6.5h10.5v10H2.5z"/><path d="M13 10h4l4 3.6v2.9h-8z"/><circle cx="6.5" cy="18.5" r="1.8"/><circle cx="17" cy="18.5" r="1.8"/></symbol>
<symbol id="i-return" viewBox="0 0 24 24"><path d="M4 9h11a5 5 0 0 1 0 10H9"/><path d="m8 5-4 4 4 4"/></symbol>
<symbol id="i-pin" viewBox="0 0 24 24"><path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0z"/><circle cx="12" cy="10" r="2.8"/></symbol>
<symbol id="i-phone" viewBox="0 0 24 24"><path d="M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8.1 9.9a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2z"/></symbol>
<symbol id="i-mail" viewBox="0 0 24 24"><rect x="2.5" y="4.5" width="19" height="15" rx="2"/><path d="m3 7 9 6 9-6"/></symbol>
<symbol id="i-edit" viewBox="0 0 24 24"><path d="M4 20h4L20 8l-4-4L4 16z"/><path d="m13.5 6.5 4 4"/></symbol>
<symbol id="i-trash" viewBox="0 0 24 24"><path d="M4 7h16M9 7V4.5h6V7M6 7l1 13h10l1-13"/><path d="M10 11v5M14 11v5"/></symbol>
<symbol id="i-logout" viewBox="0 0 24 24"><path d="M10 4H5a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5"/><path d="M15 8l4 4-4 4M19 12H9"/></symbol>
<symbol id="i-help" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M9.6 9.3a2.5 2.5 0 1 1 3.6 2.3c-.8.5-1.2 1-1.2 1.9v.3"/><path d="M12 17.2h.01"/></symbol>
<symbol id="i-user" viewBox="0 0 24 24"><circle cx="12" cy="8" r="4"/><path d="M4.5 20a7.5 7.5 0 0 1 15 0"/></symbol>
<symbol id="i-alert" viewBox="0 0 24 24"><path d="M12 3.5 2.5 20.5h19z"/><path d="M12 9.5v5M12 17.6v.4"/></symbol>
<symbol id="i-snow" viewBox="0 0 24 24"><path d="M12 2v20M4.5 6.8l15 10.4M19.5 6.8 4.5 17.2M12 6.4 9.6 4M12 6.4 14.4 4M12 17.6 9.6 20M12 17.6l2.4 2.4"/></symbol>
<symbol id="i-sun" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9 7 7M17 17l2.1 2.1M19.1 4.9 17 7M7 17l-2.1 2.1"/></symbol>
<symbol id="i-download" viewBox="0 0 24 24"><path d="M12 3v12M7 10l5 5 5-5"/><path d="M5 20h14"/></symbol>
<symbol id="i-database" viewBox="0 0 24 24"><ellipse cx="12" cy="5.5" rx="8" ry="3"/><path d="M4 5.5v13c0 1.7 3.6 3 8 3s8-1.3 8-3v-13"/><path d="M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3"/></symbol>
</defs>
</svg>
<header class="topbar">
<div class="topbar__inner">
<a class="brand" href="<?= e(url('/dashboard')) ?>" aria-label="Drink it cold – zur Übersicht">
<img class="brand__mark" src="<?= e(asset('logo-mark.svg')) ?>" alt="" width="44" height="32">
<span class="brand__text">
<span class="brand__name">Drink it cold</span>
<span class="brand__sub">Terminplanung</span>
</span>
</a>
<nav class="mainnav" aria-label="Hauptnavigation">
<a href="<?= e(url('/dashboard')) ?>"<?= $navActive('dashboard') ?>>
<svg class="ico" aria-hidden="true"><use href="#i-grid"/></svg><span><span class="nav-long">Übersicht</span><span class="nav-short">Start</span></span>
</a>
<a href="<?= e(url('/reminders')) ?>"<?= $navActive('reminders') ?>>
<svg class="ico" aria-hidden="true"><use href="#i-bell"/></svg><span><span class="nav-long">Erinnerungen</span><span class="nav-short">Aufgaben</span></span>
<?php if ($badge > 0): ?><span class="nav-badge" aria-label="<?= $badge ?> offene Erinnerungen"><?= $badge > 99 ? '99+' : $badge ?></span><?php endif; ?>
</a>
<a href="<?= e(url('/calendar')) ?>"<?= $navActive('calendar') ?>>
<svg class="ico" aria-hidden="true"><use href="#i-calendar"/></svg><span><span class="nav-long">Kalender</span><span class="nav-short">Kalender</span></span>
</a>
<a href="<?= e(url('/absences')) ?>"<?= $navActive('absences') ?>>
<svg class="ico" aria-hidden="true"><use href="#i-clock"/></svg><span><span class="nav-long">Abwesenheiten</span><span class="nav-short">Team</span></span>
</a>
<?php if ($isAdmin): ?>
<a href="<?= e(url('/admin/users')) ?>"<?= $navActive('admin') ?>>
<svg class="ico" aria-hidden="true"><use href="#i-users"/></svg><span><span class="nav-long">Verwaltung</span><span class="nav-short">Admin</span></span>
</a>
<?php endif; ?>
</nav>
<div class="topbar__tools">
<form class="global-search" method="get" action="<?= e(url('/search')) ?>" role="search">
<svg class="ico" aria-hidden="true"><use href="#i-search"/></svg>
<input type="search" name="q" value="<?= e($searchValue) ?>" placeholder="Kunde suchen …" aria-label="Buchung nach Kundenname suchen">
</form>
<details class="user-menu">
<summary aria-label="Benutzermenü">
<span class="avatar"><?= e(initials($user['first_name'] . ' ' . $user['last_name'])) ?></span>
<span class="user-menu__name"><?= e($user['first_name']) ?></span>
<svg class="ico chev" aria-hidden="true"><use href="#i-left"/></svg>
</summary>
<div class="user-menu__panel">
<p class="user-menu__who"><strong><?= e($user['first_name'] . ' ' . $user['last_name']) ?></strong>
<span><?= $isAdmin ? 'Administrator' : 'Mitarbeiter' ?></span></p>
<a href="<?= e(url('/account')) ?>"><svg class="ico" aria-hidden="true"><use href="#i-user"/></svg>Mein Konto</a>
<a href="<?= e(url('/anleitung')) ?>"><svg class="ico" aria-hidden="true"><use href="#i-help"/></svg>Bedienungsanleitung</a>
<button type="button" class="menu-button" data-install-app hidden><svg class="ico" aria-hidden="true"><use href="#i-download"/></svg>App installieren</button>
<?php if ($isAdmin): ?>
<a href="<?= e(url('/admin/users')) ?>"><svg class="ico" aria-hidden="true"><use href="#i-users"/></svg>Benutzerverwaltung</a>
<?php endif; ?>
<form method="post" action="<?= e(url('/logout')) ?>">
<?= csrf_field() ?>
<button type="submit" class="menu-button"><svg class="ico" aria-hidden="true"><use href="#i-logout"/></svg>Abmelden</button>
</form>
</div>
</details>
</div>
</div>
</header>
<?php if ($flashes): ?>
<div class="flash-wrap" role="status" aria-live="polite">
<?php foreach ($flashes as $flash): ?>
<div class="flash flash--<?= e($flash['type'] ?? 'info') ?>">
<svg class="ico" aria-hidden="true"><use href="#<?= ($flash['type'] ?? '') === 'success' ? 'i-check' : (($flash['type'] ?? '') === 'error' ? 'i-alert' : 'i-bell') ?>"/></svg>
<span><?= e($flash['message'] ?? '') ?></span>
<button type="button" class="flash__close" data-dismiss aria-label="Meldung schließen"><svg class="ico" aria-hidden="true"><use href="#i-close"/></svg></button>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<main class="page" id="main">
<?= $content ?>
</main>
<footer class="footer">
<span>Drink it cold · Kühlanhänger-Vermietung</span>
<nav class="footer__links" aria-label="Rechtliches">
<a href="<?= e(url('/impressum')) ?>">Impressum</a>
<a href="<?= e(url('/datenschutz')) ?>">Datenschutz</a>
</nav>
<span class="footer__hint">Interner Bereich · <?= e(fmt_date(today_iso())) ?></span>
</footer>
<dialog class="booking-dialog" id="booking-dialog" aria-label="Buchungsdetails">
<div class="booking-dialog__inner" id="booking-dialog-content"></div>
</dialog>
<dialog class="confirm-dialog" id="move-dialog" aria-labelledby="move-dialog-title">
<form method="dialog" class="confirm-dialog__inner">
<h2 id="move-dialog-title">Buchung verschieben?</h2>
<p class="confirm-dialog__lead" data-move-customer></p>
<dl class="confirm-dialog__facts">
<div><dt>Bisher</dt><dd data-move-from></dd></div>
<div><dt>Neu</dt><dd data-move-to></dd></div>
<div><dt>Kühlanhänger</dt><dd data-move-trailer></dd></div>
</dl>
<p class="muted small">Erinnerungen werden an den neuen Zeitraum angepasst.</p>
<div class="confirm-dialog__actions">
<button class="btn" type="submit" value="cancel">Abbrechen</button>
<button class="btn primary" type="submit" value="ok">OK, verschieben</button>
</div>
</form>
</dialog>
<div class="toast" id="toast" role="status" aria-live="polite" hidden></div>
</body>
</html>