Quelltext des aktuellen Standes
<?php
$this->layout('layouts/main', [
'page_title' => $page_title,
'current_route' => $current_route ?? '',
'full_width' => true,
]);
$topics = $topics ?? [];
/**
* Die Einrückung ergibt sich aus dem materialisierten Pfad: Jede Ebene trennt
* ein "/", die Wurzel liegt bei null.
*/
$tiefe = static function (array $t): int {
$pfad = trim((string)($t['path'] ?? ''), '/');
return $pfad === '' ? 0 : substr_count($pfad, '/');
};
?>
<div class="hb-wrap">
<div class="content-header">
<div>
<h1><?= $this->te('Handbuch erstellen') ?></h1>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/"><?= $this->te('Home') ?></a></li>
<li class="breadcrumb-item"><a href="/topics"><?= $this->te('Dokumentation') ?></a></li>
<li class="breadcrumb-item active"><?= $this->te('Handbuch') ?></li>
</ol>
</div>
</div>
<div class="page-body">
<?php if ($topics === []): ?>
<div class="empty-state">
<i class="fas fa-book" aria-hidden="true"></i>
<p><?= $this->te('Es gibt kein Themengebiet, das Sie als PDF ausgeben dürfen.') ?></p>
</div>
<?php else: ?>
<form method="POST" action="/export/handbook">
<input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
<div class="detail-card">
<div class="detail-card-header">
<span class="detail-card-title"><i class="fas fa-book" aria-hidden="true"></i> <?= $this->te('Umfang') ?></span>
</div>
<div class="detail-card-body">
<div class="form-group">
<label for="hb-title"><?= $this->te('Titel auf dem Deckblatt') ?></label>
<input type="text" id="hb-title" name="title" class="form-control form-control-sm"
maxlength="150" value="Handbuch" autocomplete="off">
</div>
<div class="form-group">
<label><?= $this->te('Themengebiete') ?> <span class="text-danger">*</span></label>
<div class="hb-liste">
<?php foreach ($topics as $t): ?>
<label class="hb-zeile" style="padding-left:<?= (int)($tiefe($t) * 18) ?>px;">
<input type="checkbox" name="topics[]" value="<?= (int)$t['id'] ?>">
<span><?= $this->e((string)$t['name']) ?></span>
</label>
<?php endforeach; ?>
</div>
<small class="form-text text-muted">
<?= $this->te('Die Reihenfolge im Handbuch folgt dem Themenbaum, nicht der Reihenfolge des Anhakens.') ?>
</small>
</div>
<div class="form-group">
<label style="display:flex;gap:.5rem;align-items:flex-start;font-weight:normal;cursor:pointer;">
<input type="checkbox" name="include_subtopics" value="1" checked>
<span><?= $this->te('Unterthemen der Auswahl mitnehmen') ?></span>
</label>
</div>
</div>
</div>
<div class="detail-card">
<div class="detail-card-body" style="display:flex;gap:.75rem;align-items:center;flex-wrap:wrap;">
<button type="submit" class="btn btn-primary">
<i class="fas fa-file-pdf" aria-hidden="true"></i> <?= $this->te('Handbuch erzeugen') ?>
</button>
<a href="/topics" class="btn btn-default"><?= $this->te('Abbrechen') ?></a>
<small class="text-muted">
<?= $this->te('Bei vielen Seiten dauert die Erzeugung einen Moment – das PDF kommt als Download.') ?>
</small>
</div>
</div>
</form>
<?php endif; ?>
</div>
</div>
<style>
/* Wie auf den uebrigen Modulseiten: Kopfzeile oben, Inhalt darunter. */
.hb-wrap { display: flex; flex-direction: column; }
/* Auswahlliste des Handbuchs: eine eingerückte Baumliste, die es sonst nirgends gibt. */
.hb-liste {
border: 1px solid var(--gray-300);
border-radius: var(--radius-sm);
max-height: 22rem;
overflow-y: auto;
background: var(--color-bg);
}
.hb-zeile {
display: flex;
gap: .5rem;
align-items: center;
font-weight: normal;
cursor: pointer;
margin: 0;
padding: .35rem .6rem;
border-bottom: 1px solid var(--gray-200);
}
.hb-zeile:last-child { border-bottom: 0; }
.hb-zeile:hover { background: var(--gray-100); }
</style>