Backup #643

ID643
Dateipfad/var/www/dev.campus.systemische-tools.de/src/Controller/ProtokollController.php
Version14
Typ modified
Größe2.1 KB
Hashfd4c9a2bdda02ea1bd26dc159bd8e6ac65ac9a763cb284a0f62cf3d86aa62e2a
Datum2025-12-23 04:47:34
Geändert vonclaude-code-hook
GrundClaude Code Pre-Hook Backup vor Edit-Operation
Datei existiert Ja

Dateiinhalt

<?php

namespace Controller;

use Domain\ValueObject\Pagination;
use Framework\Controller;
use UseCases\Protokoll\ViewProtokollUseCase;

class ProtokollController extends Controller
{
    private ViewProtokollUseCase $protokollUseCase;

    public function __construct(?ViewProtokollUseCase $protokollUseCase = null)
    {
        $this->protokollUseCase = $protokollUseCase ?? new ViewProtokollUseCase();
    }

    public function index(): void
    {
        $pagination = Pagination::fromRequest(50);

        $search = $this->getString('search');
        $status = $this->getString('status');
        $model = $this->getString('model');

        $searchVal = $search !== '' ? $search : null;
        $statusVal = $status !== '' ? $status : null;
        $modelVal = $model !== '' ? $model : null;

        $result = $this->protokollUseCase->getPaginated($searchVal, $statusVal, $modelVal, $pagination);
        $updatedPagination = $result['pagination'];

        $this->view('protokoll.index', [
            'title' => 'KI-Protokoll',
            'stats' => $this->protokollUseCase->getStatistics(),
            'entries' => array_map(fn ($dto) => $dto->toArray(), $result['entries']),
            'models' => $this->protokollUseCase->getDistinctModels(),
            'currentSearch' => $search,
            'currentStatus' => $status,
            'currentModel' => $model,
            'currentPage' => $updatedPagination->page,
            'totalCount' => $updatedPagination->totalCount,
            'totalPages' => $updatedPagination->totalPages(),
        ]);
    }

    public function show(string $id): void
    {
        $entry = $this->protokollUseCase->getById((int) $id);
        if ($entry === null) {
            $this->notFound('Protokoll-Eintrag nicht gefunden');
        }

        $nav = $this->protokollUseCase->getNavigation((int) $id);

        $this->view('protokoll.show', [
            'title' => 'Protokoll #' . $id,
            'entry' => $entry->toArray(),
            'prevEntry' => $nav['prevId'] !== null ? ['id' => $nav['prevId']] : false,
            'nextEntry' => $nav['nextId'] !== null ? ['id' => $nav['nextId']] : false,
        ]);
    }
}

Vollständig herunterladen

Aktionen

Herunterladen

Andere Versionen dieser Datei

ID Version Typ Größe Datum
699 15 modified 2.1 KB 2025-12-23 07:53
643 14 modified 2.1 KB 2025-12-23 04:47
469 13 modified 2.1 KB 2025-12-22 10:32
468 12 modified 2.1 KB 2025-12-22 10:32
453 11 modified 2.9 KB 2025-12-22 10:27
448 10 modified 5.3 KB 2025-12-22 10:19
407 9 modified 5.2 KB 2025-12-22 08:55
345 8 modified 5.1 KB 2025-12-22 08:12
344 7 modified 5.1 KB 2025-12-22 08:12
343 6 modified 5.1 KB 2025-12-22 08:12
306 5 modified 5.1 KB 2025-12-22 08:05
246 4 modified 5.2 KB 2025-12-22 01:46
135 3 modified 4.9 KB 2025-12-20 19:56
34 2 modified 5.7 KB 2025-12-20 17:23
3 1 modified 5.7 KB 2025-12-20 16:08

← Zurück zur Übersicht