show.php
- Pfad:
src/View/content/show.php - Namespace: -
- Zeilen: 284 | Größe: 11,966 Bytes
- Geändert: 2025-12-30 20:51:33 | Gescannt: 2025-12-31 10:22:15
Code Hygiene Score: 94
- Dependencies: 100 (25%)
- LOC: 72 (20%)
- Methods: 100 (20%)
- Secrets: 100 (15%)
- Classes: 100 (10%)
- Magic Numbers: 100 (10%)
Keine Issues gefunden.
Versionen 38
-
v38
2025-12-30 20:51 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v37
2025-12-28 01:20 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v36
2025-12-27 12:10 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v35
2025-12-27 12:10 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v34
2025-12-27 12:09 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v33
2025-12-24 01:31 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v32
2025-12-24 01:26 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v31
2025-12-24 01:26 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v30
2025-12-24 01:26 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v29
2025-12-24 01:26 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v28
2025-12-24 01:26 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v27
2025-12-24 01:25 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v26
2025-12-24 01:21 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v25
2025-12-24 01:17 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v24
2025-12-24 01:17 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v23
2025-12-24 01:16 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v22
2025-12-24 01:15 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v21
2025-12-24 01:11 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v20
2025-12-24 01:10 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v19
2025-12-24 00:16 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v18
2025-12-24 00:16 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v17
2025-12-24 00:16 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v16
2025-12-24 00:15 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v15
2025-12-24 00:15 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v14
2025-12-24 00:15 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v13
2025-12-24 00:15 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v12
2025-12-21 14:46 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v11
2025-12-21 14:37 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v10
2025-12-21 09:14 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v9
2025-12-21 04:14 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v8
2025-12-21 04:14 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v7
2025-12-21 04:14 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v6
2025-12-21 03:01 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v5
2025-12-21 03:01 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v4
2025-12-20 19:18 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v3
2025-12-20 19:17 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v2
2025-12-20 19:17 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v1
2025-12-20 19:17 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php
ob_start();
$orderModel = $order['model'] ?? 'claude-sonnet-4-20250514';
$orderCollections = json_decode($order['collections'] ?? '["documents"]', true) ?: ['documents'];
$orderContextLimit = (int) ($order['context_limit'] ?? 5);
$isGenerating = ($order['generation_status'] ?? 'idle') === 'generating';
$orderId = $order['id'];
?>
<nav class="breadcrumb">
<a href="/content">Content Studio</a> » Auftrag #<?= $order['id'] ?>
</nav>
<h1><?= htmlspecialchars($order['title']) ?></h1>
<div class="info-grid">
<div class="info-card">
<h3>Auftrag</h3>
<dl class="info-list">
<dt>ID</dt><dd><?= $order['id'] ?></dd>
<dt>Status</dt><dd><span class="badge badge--<?= $order['status'] ?>"><?= $order['status'] ?></span></dd>
<dt>Erstellt</dt><dd><?= $order['created_at'] ?></dd>
</dl>
</div>
<div class="info-card">
<h3>KI-Einstellungen</h3>
<dl class="info-list">
<dt>Modell</dt><dd><?= htmlspecialchars($models[$orderModel] ?? $orderModel) ?></dd>
<dt>Collections</dt><dd><?= htmlspecialchars(implode(', ', $orderCollections)) ?></dd>
<dt>Quellen</dt><dd><?= $orderContextLimit ?></dd>
</dl>
</div>
<div class="info-card">
<h3>Content-Config</h3>
<dl class="info-list">
<dt>Profil</dt><dd><?= htmlspecialchars($order['profile_name'] ?? '-') ?></dd>
<dt>Contract</dt><dd><?= htmlspecialchars($order['contract_name'] ?? '-') ?></dd>
<dt>Struktur</dt><dd><?= htmlspecialchars($order['structure_name'] ?? '-') ?></dd>
</dl>
</div>
</div>
<h2>Briefing</h2>
<div class="briefing-box"><?= nl2br(htmlspecialchars($order['briefing'])) ?></div>
<h2>Aktionen</h2>
<div class="action-cards">
<!-- Basis-Aktionen -->
<div class="action-card">
<div class="action-card__header">Auftrag</div>
<div class="action-card__body">
<a href="/content/<?= $order['id'] ?>/edit" class="btn btn--full">Bearbeiten</a>
</div>
</div>
<?php if (!$latestVersion): ?>
<!-- Content Generieren -->
<div class="action-card action-card--primary">
<div class="action-card__header">Content generieren</div>
<div class="action-card__desc">Erstellt Content basierend auf Briefing und RAG-Quellen</div>
<form method="POST" action="/content/<?= $order['id'] ?>/generate" class="action-card__body generate-form" id="generate-form"
hx-post="/content/<?= $order['id'] ?>/generate"
hx-headers='{"X-CSRF-TOKEN": "<?= $csrfToken ?>"}'
hx-target="#content-result"
hx-swap="innerHTML"
hx-disabled-elt="find button">
<?= $csrfField ?>
<div class="form-row">
<label class="form-label">KI-Modell</label>
<select name="model" class="form-select" <?= $isGenerating ? 'disabled' : '' ?>>
<?php foreach ($models ?? [] as $modelId => $modelName): ?>
<option value="<?= $modelId ?>" <?= $modelId === $orderModel ? 'selected' : '' ?>><?= htmlspecialchars($modelName) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-row">
<label class="form-label">Wissens-Quelle</label>
<?php
$collections = $availableCollections ?? [];
$selected = $orderCollections;
$name = 'collection';
$variant = 'block';
$multiple = false;
include __DIR__ . '/../partials/form/collections-select.php';
?>
</div>
<div class="form-row">
<label class="form-label">Kontext-Limit</label>
<select name="context_limit" class="form-select" <?= $isGenerating ? 'disabled' : '' ?>>
<option value="3" <?= $orderContextLimit === 3 ? 'selected' : '' ?>>3 Quellen</option>
<option value="5" <?= $orderContextLimit === 5 ? 'selected' : '' ?>>5 Quellen</option>
<option value="10" <?= $orderContextLimit === 10 ? 'selected' : '' ?>>10 Quellen</option>
<option value="15" <?= $orderContextLimit === 15 ? 'selected' : '' ?>>15 Quellen</option>
</select>
</div>
<button type="submit" class="btn btn--primary btn--full generate-btn <?= $isGenerating ? 'is-loading' : '' ?>" <?= $isGenerating ? 'disabled' : '' ?>>
<span class="btn-text">Generieren</span>
<span class="btn-loading"><span></span><span></span><span></span></span>
</button>
</form>
</div>
<?php endif; ?>
<?php if ($latestVersion): ?>
<!-- Kritik-Runde -->
<div class="action-card">
<div class="action-card__header">Kritik-Runde</div>
<div class="action-card__desc">
Alle aktiven <a href="/config?type=critic" class="action-link">Kritiker</a> prüfen den Content
</div>
<form method="POST" action="/content/<?= $order['id'] ?>/critique" class="action-card__body critique-form"
hx-post="/content/<?= $order['id'] ?>/critique"
hx-headers='{"X-CSRF-TOKEN": "<?= $csrfToken ?>"}'
hx-target="#critique-result"
hx-swap="innerHTML"
hx-disabled-elt="find button">
<?= $csrfField ?>
<div class="form-row">
<label class="form-label">KI-Modell für Kritik</label>
<select name="model" class="form-select">
<?php foreach ($models ?? [] as $modelId => $modelName): ?>
<option value="<?= $modelId ?>" <?= $modelId === $orderModel ? 'selected' : '' ?>><?= htmlspecialchars($modelName) ?></option>
<?php endforeach; ?>
</select>
</div>
<button type="submit" class="btn btn--light btn--full critique-btn">
<span class="btn-text">Kritik starten</span>
<span class="btn-loading"><span></span><span></span><span></span></span>
</button>
</form>
</div>
<!-- Revision -->
<div class="action-card">
<div class="action-card__header">Revision erstellen</div>
<div class="action-card__desc">Überarbeitet Content basierend auf dem Kritik-Feedback</div>
<form method="POST" action="/content/<?= $order['id'] ?>/revise" class="action-card__body revise-form"
hx-post="/content/<?= $order['id'] ?>/revise"
hx-headers='{"X-CSRF-TOKEN": "<?= $csrfToken ?>"}'
hx-target="#content-result"
hx-swap="innerHTML"
hx-disabled-elt="find button">
<?= $csrfField ?>
<div class="form-row">
<label class="form-label">KI-Modell für Revision</label>
<select name="model" class="form-select">
<?php foreach ($models ?? [] as $modelId => $modelName): ?>
<option value="<?= $modelId ?>" <?= $modelId === $orderModel ? 'selected' : '' ?>><?= htmlspecialchars($modelName) ?></option>
<?php endforeach; ?>
</select>
</div>
<button type="submit" class="btn btn--light btn--full revise-btn">
<span class="btn-text">Revision erstellen</span>
<span class="btn-loading"><span></span><span></span><span></span></span>
</button>
</form>
</div>
<!-- Freigabe -->
<?php if (in_array($order['status'], ['validate', 'critique', 'revision'])): ?>
<div class="action-card">
<div class="action-card__header">Freigabe</div>
<div class="action-card__desc">Content genehmigen oder zurück zu Entwurf</div>
<div class="action-card__body action-card__buttons">
<button class="btn btn--success btn--full" hx-post="/content/<?= $order['id'] ?>/approve" hx-swap="none" hx-on::after-request="location.reload()" hx-headers='{"X-CSRF-TOKEN": "<?= $csrfToken ?>"}'>Genehmigen</button>
<button class="btn btn--danger btn--full" hx-post="/content/<?= $order['id'] ?>/decline" hx-swap="none" hx-on::after-request="location.reload()" hx-headers='{"X-CSRF-TOKEN": "<?= $csrfToken ?>"}'>Ablehnen</button>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<div id="content-result">
<?php if ($isGenerating): ?>
<?php include __DIR__ . '/partials/generating.php'; ?>
<?php endif; ?>
</div>
<div id="critique-result"></div>
<?php if ($latestVersion):
$contentData = json_decode($latestVersion['content'], true);
$contentText = is_array($contentData) ? ($contentData['text'] ?? '') : $latestVersion['content'];
?>
<h2>Content (Version <?= $latestVersion['version_number'] ?>)</h2>
<div class="result-box">
<div class="result-box__header">
<strong>Version <?= $latestVersion['version_number'] ?></strong>
<span><?= date('d.m.Y H:i', strtotime($latestVersion['created_at'])) ?></span>
</div>
<div class="result-box__content">
<pre><?= htmlspecialchars($contentText) ?></pre>
</div>
</div>
<?php endif; ?>
<?php if (!empty($critiques)): ?>
<h2>Kritiken</h2>
<table data-sortable>
<thead>
<tr>
<th data-sort="round">Runde</th>
<th data-sort="critic">Kritiker</th>
<th data-sort="rating">Bewertung</th>
<th data-sort="status">Status</th>
<th data-sort="summary">Zusammenfassung</th>
</tr>
</thead>
<tbody>
<?php foreach ($critiques as $c): ?>
<tr>
<td><?= $c['round'] ?? '-' ?></td>
<td><?= htmlspecialchars($c['critic_name'] ?? '-') ?></td>
<td><?= $c['rating'] ?? '-' ?>/10</td>
<td><span class="badge badge--<?= ($c['passed'] ?? false) ? 'completed' : 'failed' ?>"><?= ($c['passed'] ?? false) ? 'Bestanden' : 'Offen' ?></span></td>
<td><?= htmlspecialchars($c['summary'] ?? '-') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php if (!empty($sources)): ?>
<h2>Quellen (RAG)</h2>
<table data-sortable>
<thead>
<tr>
<th data-sort="document">Dokument</th>
<th data-sort="score">Relevanz</th>
</tr>
</thead>
<tbody>
<?php foreach ($sources as $s): ?>
<tr>
<td><?= htmlspecialchars($s['document_name'] ?? 'Unbekannt') ?></td>
<td><?= round(($s['relevance_score'] ?? 0) * \Domain\Constants::PERCENT_FULL) ?>%</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php if (count($versions) > 1): ?>
<h2>Versionshistorie</h2>
<table data-sortable>
<thead>
<tr>
<th data-sort="version">Version</th>
<th data-sort="created">Erstellt</th>
</tr>
</thead>
<tbody>
<?php foreach ($versions as $v): ?>
<tr>
<td>V<?= $v['version_number'] ?></td>
<td><?= date('d.m.Y H:i', strtotime($v['created_at'])) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<p class="back-link"><a href="/content">← Zurück zur Übersicht</a></p>
<script>
document.body.addEventListener('htmx:beforeRequest', function(evt) {
var form = evt.detail.elt;
var btnClass = null;
if (form.classList.contains('generate-form')) btnClass = '.generate-btn';
if (form.classList.contains('critique-form')) btnClass = '.critique-btn';
if (form.classList.contains('revise-form')) btnClass = '.revise-btn';
if (btnClass) {
var btn = form.querySelector(btnClass);
if (btn) {
btn.disabled = true;
btn.classList.add('is-loading');
}
}
});
</script>
<?php $content = ob_get_clean(); ?>
<?php require VIEW_PATH . '/layout.php'; ?>