Quelltext des aktuellen Standes
<?php $this->layout('layouts/admin', [
'page_title' => 'Fristen-Digest',
'current_admin_page' => 'deadlines-digest',
]); ?>
<?php
/** Digest-Einstellungen: $digest, $horizons, $weekdays, $last_run */
?>
<div class="settings-page">
<section class="settings-card">
<div class="settings-card-header">
<span class="settings-card-icon">📧</span>
<div>
<h2><?= $this->te('Fristen-Digest') ?></h2>
<p class="settings-card-desc"><?= $this->t('Eine wöchentliche Sammel-E-Mail mit allen anstehenden Fristen – statt vieler einzelner Erinnerungen. Voraussetzung: konfigurierter Mailversand (SMTP) und laufender Scheduler. Das Cockpit selbst findest du im Frontend unter <a href="/deadlines">Fristen-Cockpit</a>.') ?></p>
</div>
</div>
<div class="settings-card-body">
<form method="post" action="/admin/deadlines/settings">
<input type="hidden" name="_csrf" value="<?= $this->e($this->csrf()) ?>">
<div class="form-group">
<label class="settings-toggle" style="display:inline-flex;align-items:center;gap:0.5rem;cursor:pointer;font-weight:600;">
<input type="checkbox" name="enabled" value="1" <?= $digest['enabled'] ? 'checked' : '' ?>>
<?= $this->te('Digest-Mail aktiv') ?>
</label>
</div>
<div class="form-group">
<label for="dl-recipients"><?= $this->te('Empfänger') ?> <span class="text-danger">*</span></label>
<textarea id="dl-recipients" name="recipients" class="form-control" rows="2"
placeholder="<?= $this->te('it@example.com, leitung@example.com') ?>"><?= $this->e($digest['recipients']) ?></textarea>
<small class="form-hint"><?= $this->te('Mehrere Adressen mit Komma trennen. Ungültige Einträge werden beim Speichern entfernt.') ?></small>
</div>
<div class="form-row" style="display:flex;gap:1rem;flex-wrap:wrap;">
<div class="form-group" style="flex:0 0 auto;">
<label for="dl-weekday"><?= $this->te('Versandtag') ?></label>
<select id="dl-weekday" name="weekday" class="form-control">
<?php foreach ($weekdays as $n => $label): ?>
<option value="<?= (int)$n ?>" <?= $digest['weekday'] === (int)$n ? 'selected' : '' ?>><?= $this->e($label) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group" style="flex:0 0 auto;">
<label for="dl-horizon"><?= $this->te('Zeitraum der Vorschau') ?></label>
<select id="dl-horizon" name="horizon_days" class="form-control">
<?php foreach ($horizons as $d => $label): ?>
<option value="<?= (int)$d ?>" <?= $digest['horizon_days'] === (int)$d ? 'selected' : '' ?>><?= $this->e($label) ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-actions" style="margin-top:1.25rem;">
<button type="submit" class="btn btn-primary"><?= $this->te('Speichern') ?></button>
</div>
</form>
<?php if (!empty($last_run) && !empty($last_run['last_run_at'])): ?>
<p class="form-hint" style="margin-top:1.5rem;padding-top:1rem;border-top:1px solid var(--color-gray-100);">
<?= $this->te('Letzter Lauf:') ?> <strong><?= $this->e($last_run['last_run_at']) ?></strong>
(<?= $this->e($last_run['last_status'] ?? '') ?>)<?= !empty($last_run['last_message']) ? ' – ' . $this->e($last_run['last_message']) : '' ?>
</p>
<?php endif; ?>
<p class="form-hint" style="margin-top:1rem;">
<?= $this->t('Der Task „Fristen-Digest" läuft täglich, versendet aber nur am gewählten Wochentag (höchstens einmal pro Tag). Aktivierung/Intervall unter <a href="/admin/cronjobs">Cronjobs</a>.') ?>
</p>
</div>
</section>
</div>