Backup #688
| ID | 688 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/Controller/DocsController.php |
| Version | 13 |
| Typ |
modified |
| Größe | 4.0 KB |
| Hash | 9b48c23f1515188b98bc1e077452fedb363f8a9d7205ad70f2a494b68d43acbb |
| Datum | 2025-12-23 07:52:10 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php
namespace Controller;
use Domain\Repository\DokumentationRepositoryInterface;
use Domain\Repository\TaskRepositoryInterface;
use Framework\Controller;
use Infrastructure\Persistence\DokumentationRepository;
use Infrastructure\Persistence\KiProtokollRepository;
use Infrastructure\Persistence\TaskAssignmentRepository;
use Infrastructure\Persistence\TaskCommentRepository;
use Infrastructure\Persistence\TaskRepository;
use Infrastructure\Persistence\TaskResultRepository;
class DocsController extends Controller
{
private DokumentationRepositoryInterface $docsRepo;
private KiProtokollRepository $protokollRepo;
private TaskRepositoryInterface $taskRepo;
private TaskAssignmentRepository $assignmentRepo;
private TaskResultRepository $resultRepo;
private TaskCommentRepository $commentRepo;
public function __construct(
DokumentationRepository $docsRepo,
KiProtokollRepository $protokollRepo,
TaskRepository $taskRepo,
TaskAssignmentRepository $assignmentRepo,
TaskResultRepository $resultRepo,
TaskCommentRepository $commentRepo
) {
$this->docsRepo = $docsRepo;
$this->protokollRepo = $protokollRepo;
$this->taskRepo = $taskRepo;
$this->assignmentRepo = $assignmentRepo;
$this->resultRepo = $resultRepo;
$this->commentRepo = $commentRepo;
}
public function index(): void
{
$this->view('docs.index', [
'title' => 'Dokumentation',
'hierarchy' => $this->docsRepo->getHierarchy(),
]);
}
public function redirectBySlug(string $slug): void
{
$doc = $this->docsRepo->findDocBySlug($slug);
if ($doc === null) {
$this->notFound('Dokumentation nicht gefunden: ' . $slug);
}
header('Location: /docs' . $doc['path'], true, 301);
exit;
}
public function show(string $path): void
{
$path = '/' . ltrim($path, '/');
$doc = $this->docsRepo->findByPath($path);
if ($doc === null) {
$this->notFound('Dokumentation nicht gefunden: ' . $path);
}
$data = [
'title' => $doc['title'],
'doc' => $doc,
'breadcrumb' => $this->docsRepo->getBreadcrumb((int) $doc['id']),
'children' => $this->docsRepo->findChildren((int) $doc['id']),
'siblings' => $this->docsRepo->getSiblings((int) $doc['id']),
];
// Modul-spezifische Daten laden
if ($doc['slug'] === 'ki-protokoll') {
$data['entries'] = $this->protokollRepo->findLatest(20);
}
$this->view('docs.show', $data);
}
public function tasksIndex(): void
{
$this->view('tasks.index', [
'title' => 'Tasks',
'stats' => $this->taskRepo->getStatistics(),
'tasks' => array_map(fn ($t) => $t->toArray(), $this->taskRepo->findAll([], 50, 0)),
]);
}
public function tasksNew(): void
{
$this->view('tasks.new', [
'title' => 'Neuer Task',
]);
}
public function tasksEdit(string $id): void
{
$task = $this->taskRepo->findById((int) $id);
if ($task === null) {
$this->notFound('Task nicht gefunden');
}
$this->view('tasks.edit', [
'title' => 'Task bearbeiten',
'task' => $task->toArray(),
]);
}
public function taskShow(string $id): void
{
$task = $this->taskRepo->findById((int) $id);
if ($task === null) {
$this->notFound('Task nicht gefunden');
}
$this->view('tasks.show', [
'title' => 'Task #' . $id,
'task' => $task->toArray(),
'assignments' => array_map(fn ($a) => $a->toArray(), $this->assignmentRepo->findByTaskId((int) $id)),
'results' => array_map(fn ($r) => $r->toArray(), $this->resultRepo->findByTaskId((int) $id)),
'comments' => array_map(fn ($c) => $c->toArray(), $this->commentRepo->findByTaskId((int) $id)),
]);
}
}
Vollständig herunterladen
Aktionen
Andere Versionen dieser Datei
| ID |
Version |
Typ |
Größe |
Datum |
| 1271 |
14 |
modified |
4.1 KB |
2025-12-25 12:52 |
| 688 |
13 |
modified |
4.0 KB |
2025-12-23 07:52 |
| 611 |
12 |
modified |
4.3 KB |
2025-12-23 04:42 |
| 408 |
11 |
modified |
4.1 KB |
2025-12-22 08:59 |
| 384 |
10 |
modified |
4.3 KB |
2025-12-22 08:27 |
| 383 |
9 |
modified |
4.3 KB |
2025-12-22 08:27 |
| 382 |
8 |
modified |
4.4 KB |
2025-12-22 08:27 |
| 381 |
7 |
modified |
4.4 KB |
2025-12-22 08:27 |
| 380 |
6 |
modified |
3.5 KB |
2025-12-22 08:26 |
| 243 |
5 |
modified |
3.6 KB |
2025-12-22 01:46 |
| 242 |
4 |
modified |
3.6 KB |
2025-12-22 01:46 |
| 241 |
3 |
modified |
3.7 KB |
2025-12-22 01:46 |
| 240 |
2 |
modified |
3.8 KB |
2025-12-22 01:46 |
| 1 |
1 |
modified |
1.1 KB |
2025-12-20 01:50 |
← Zurück zur Übersicht