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, ]); } }