← Code-Übersicht

code-detail.php

Pfad: src/Infrastructure/Http/view/code-detail.php

Ext: php

Größe: 1746 Bytes

Geändert: 2026-07-16 10:04:30+02

<?php
declare(strict_types=1);

/**
 * Detail-Ansicht einer Code-Datei inkl. Historie.
 *
 * @var callable(string):string                   $e
 * @var \Demo\Domain\Code\CodeDatei               $datei
 * @var list<\Demo\Domain\Code\CodeVersion>       $versionen
 * @var bool                                     $readOnly
 */
?>
        <p><a href="/code">&larr; Code-Übersicht</a></p>
        <h1><?= $e($datei->dateiName) ?></h1>
        <p><strong>Pfad:</strong> <?= $e($datei->relativerPfad) ?></p>
        <p><strong>Ext:</strong> <?= $e($datei->dateiErweiterung) ?></p>
        <p><strong>Größe:</strong> <?= $e((string) $datei->dateiGroesse) ?> Bytes</p>
        <p><strong>Geändert:</strong> <?= $e($datei->geaendert) ?></p>
<?php if ($readOnly): ?>
        <p class="code-version-hinweis">Frühere Version vom <?= $e($datei->geaendert) ?> &middot; <a href="/code/<?= $e((string) $datei->id) ?>">zur aktuellen Fassung</a></p>
<?php endif; ?>
        <pre class="code-block"><code><?= $e($datei->code) ?></code></pre>
<?php if ($versionen !== []): ?>
        <h2>Frühere Versionen</h2>
        <table class="tabelle">
            <thead>
                <tr>
                    <th>Version</th>
                    <th>Zeitpunkt</th>
                    <th>Operation</th>
                </tr>
            </thead>
            <tbody>
<?php foreach ($versionen as $v): ?>
                <tr>
                    <td><a href="/code/<?= $e((string) $datei->id) ?>/<?= $e((string) $v->id) ?>"><?= $e((string) $v->id) ?></a></td>
                    <td><?= $e($v->geaendertAm) ?></td>
                    <td><?= $e($v->operation) ?></td>
                </tr>
<?php endforeach; ?>
            </tbody>
        </table>
<?php endif; ?>