81 lines
3.6 KiB
PHP
81 lines
3.6 KiB
PHP
<?php
|
|
require_once __DIR__ . '/includes/bootstrap.php';
|
|
require_permission('dashboard.view');
|
|
|
|
$user = current_user();
|
|
|
|
// Was seit dem letzten Besuch neu ist, bekommt ein "Neu" - danach gilt alles als gelesen.
|
|
$seenStmt = db()->prepare('SELECT patchnotes_seen FROM users WHERE id = ?');
|
|
$seenStmt->execute([(int) $user['id']]);
|
|
$seenId = (string) ($seenStmt->fetchColumn() ?: '');
|
|
$newIds = [];
|
|
foreach (PATCHNOTES as $note) {
|
|
if ($note['id'] === $seenId) {
|
|
break;
|
|
}
|
|
$newIds[] = $note['id'];
|
|
}
|
|
// Wer die Seite zum ersten Mal oeffnet, bekommt nur den neuesten Eintrag markiert - nicht die ganze Historie.
|
|
if ($seenId === '') {
|
|
$newIds = array_slice($newIds, 0, 1);
|
|
}
|
|
if (patchnotes_unseen($seenId)) {
|
|
db()->prepare('UPDATE users SET patchnotes_seen = ? WHERE id = ?')->execute([patchnotes_latest_id(), (int) $user['id']]);
|
|
}
|
|
|
|
$months = [1 => 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
|
|
$formatDate = static function (string $date) use ($months): string {
|
|
$ts = strtotime($date);
|
|
return $ts ? date('j', $ts) . '. ' . $months[(int) date('n', $ts)] . ' ' . date('Y', $ts) : $date;
|
|
};
|
|
|
|
$pageTitle = 'Patchnotes';
|
|
include __DIR__ . '/includes/header.php';
|
|
?>
|
|
<div class="panel">
|
|
<h1>Patchnotes</h1>
|
|
<p class="text-muted">Was sich auf der Website grundlegend geändert hat - neue Funktionen, geänderte Abläufe und wichtige Fehlerbehebungen. Rein optische Anpassungen stehen hier nicht.</p>
|
|
<div class="patchnote-legend">
|
|
<?php foreach (PATCHNOTE_TYPES as $type => $label): ?>
|
|
<span class="patchnote-type patchnote-type-<?= e($type) ?>"><?= e($label) ?></span>
|
|
<?php endforeach; ?>
|
|
<span class="patchnote-audience" title="Betrifft vor allem die Verwaltung">Leitung</span>
|
|
</div>
|
|
</div>
|
|
|
|
<?php foreach (PATCHNOTES as $note): ?>
|
|
<?php $isNew = in_array($note['id'], $newIds, true); ?>
|
|
<article class="panel patchnote<?= $isNew ? ' patchnote-new' : '' ?>" id="<?= e($note['id']) ?>">
|
|
<header class="patchnote-head">
|
|
<div>
|
|
<time class="patchnote-date" datetime="<?= e($note['date']) ?>"><?= e($formatDate($note['date'])) ?></time>
|
|
<h2><?= e($note['title']) ?></h2>
|
|
</div>
|
|
<?php if ($isNew): ?>
|
|
<span class="badge patchnote-new-badge">Neu für dich</span>
|
|
<?php endif; ?>
|
|
</header>
|
|
<?php if (!empty($note['summary'])): ?>
|
|
<p class="patchnote-summary"><?= e($note['summary']) ?></p>
|
|
<?php endif; ?>
|
|
<ul class="patchnote-list">
|
|
<?php foreach (array_keys(PATCHNOTE_TYPES) as $type): ?>
|
|
<?php foreach ($note['changes'] as $change): ?>
|
|
<?php if ($change['type'] !== $type) { continue; } ?>
|
|
<li>
|
|
<span class="patchnote-type patchnote-type-<?= e($type) ?>"><?= e(PATCHNOTE_TYPES[$type]) ?></span>
|
|
<div class="patchnote-text">
|
|
<strong class="patchnote-area"><?= e($change['area']) ?></strong>
|
|
<?php if (($change['audience'] ?? '') === 'leitung'): ?>
|
|
<span class="patchnote-audience" title="Betrifft vor allem die Verwaltung">Leitung</span>
|
|
<?php endif; ?>
|
|
<p><?= e($change['text']) ?></p>
|
|
</div>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
|
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|