OpenNIT

Quelltext des aktuellen Standes

Fassung 1.1.1

status.php

2 KB
<?php
/**
 * Systemstatus im Self-Service-Portal.
 *
 * Verwendet bewusst das Inhalts-Partial der öffentlichen Statusseite
 * (templates/status/_content.php) samt deren `sp-*`-Design (status.css), damit
 * die Portal-Ansicht identisch zur öffentlichen Seite unter /status aussieht –
 * nur eingebettet in die Portal-Kopf-/Fußleiste.
 *
 * Erwartete Variablen (wie auf der öffentlichen Seite):
 *   $overall, $services, $active_incidents, $recent_incidents,
 *   $maintenances, $uptime, $brand
 */
$this->layout('layouts/portal', [
    'page_title' => 'Systemstatus',
    'ssp_active' => 'status',
    'extra_css'  => $extra_css ?? ['/assets/css/status.css'],
]);
$recent = $recent_incidents ?? [];
$e  = fn($v) => htmlspecialchars((string)$v, ENT_QUOTES, 'UTF-8');
$dt = fn($v) => $v ? date('d.m.Y H:i', strtotime((string)$v)) : '';
?>
<div class="sp-body sp-body--portal">
    <div class="sp-container">
        <?php include dirname(__DIR__) . '/status/_content.php'; ?>

        <?php if (!empty($recent)): ?>
        <div class="sp-section">
            <h2 class="sp-section-title"><?= $this->te('Vergangene Störungen') ?></h2>
            <div class="sp-card" style="padding: .25rem 1.15rem;">
                <?php foreach ($recent as $inc): ?>
                <div class="sp-history-item">
                    <span class="sp-history-title"><?= $e($inc['title']) ?></span>
                    <span class="sp-pill sp-pill--operational" style="margin-left:.4rem;"><?= $this->te('Behoben') ?></span>
                    <div class="sp-incident-meta"><?= $dt($inc['started_at']) ?> &ndash; <?= $this->te('{zeitpunkt} Uhr', ['zeitpunkt' => $dt($inc['resolved_at'])]) ?></div>
                </div>
                <?php endforeach; ?>
            </div>
        </div>
        <?php endif; ?>
    </div>
</div>