Backup #391
| ID | 391 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/Controller/SystemExplorerController.php |
| Version | 27 |
| Typ |
modified |
| Größe | 7.6 KB |
| Hash | 89eb7340c2eb51dbb9b2a0aed0f3bcd663f83c26747f6be583acf3a7fddf720c |
| Datum | 2025-12-22 08:40:11 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php
namespace Controller;
use Domain\ValueObject\Pagination;
use Framework\Controller;
use Infrastructure\Config\DatabaseFactory;
use Infrastructure\Docs\HybridSearchService;
use Infrastructure\Persistence\SystemExplorerRepository;
/**
* SystemExplorerController - Interne System-Dokumentation
*
* Zeigt Code-Dokumentation, Seiten und Chunks aus der dokumentation_chunks Pipeline.
* Für Admin/Entwickler - System-Wissen.
*/
class SystemExplorerController extends Controller
{
private \PDO $db;
private SystemExplorerRepository $repository;
public function __construct()
{
$this->repository = new SystemExplorerRepository();
$this->db = DatabaseFactory::dev();
}
/**
* GET /explorer
* Dashboard mit Statistiken
*/
public function index(): void
{
$this->view('system-explorer.index', [
'title' => 'Doc2Vector Explorer',
'dokumenteCount' => $this->repository->countDokumente(),
'seitenCount' => $this->repository->countSeiten(),
'chunkStats' => $this->repository->getChunkStats(),
'taxonomyCategories' => $this->repository->getTopTaxonomyCategories(10),
'dokumente' => $this->repository->getDokumenteWithStats(),
'recentChunks' => $this->repository->getRecentChunks(5),
]);
}
/**
* GET /explorer/dokumente
* Liste aller Hauptbereiche (depth=0)
*/
public function dokumente(): void
{
$this->view('system-explorer.dokumente.index', [
'title' => 'Dokumente',
'dokumente' => $this->repository->getDokumenteWithFullStats(),
]);
}
/**
* GET /explorer/dokumente/{id}
* Dokument-Details mit Seiten und Chunks
*/
public function dokumentShow(int $id): void
{
$dokument = $this->repository->getDokumentRoot($id);
if ($dokument === null) {
$this->notFound('Dokument nicht gefunden');
}
$this->view('system-explorer.dokumente.show', [
'title' => $dokument['title'],
'dokument' => $dokument,
'seiten' => $this->repository->getSeitenWithStatsForParent($id),
'chunks' => $this->repository->getChunksForDokument($id),
'taxonomy' => $this->repository->getTaxonomyForDokumentTree($id),
]);
}
/**
* GET /explorer/seiten
* Liste aller Seiten (depth>0)
*/
public function seiten(): void
{
$search = $this->getString('search');
$parentId = $this->getString('parent');
$this->view('system-explorer.seiten.index', [
'title' => 'Seiten',
'seiten' => $this->repository->getSeitenFiltered($search, $parentId),
'dokumente' => $this->repository->getDokumenteForFilter(),
'currentSearch' => $search,
'currentParent' => $parentId,
]);
}
/**
* GET /explorer/seiten/{id}
* Seiten-Details mit Chunks
*/
public function seiteShow(int $id): void
{
$seite = $this->repository->getSeiteWithParent($id);
if ($seite === null) {
$this->notFound('Seite nicht gefunden');
}
$this->view('system-explorer.seiten.show', [
'title' => $seite['title'],
'seite' => $seite,
'chunks' => $this->repository->getChunksDetailedForDokument($id),
'unterseiten' => $this->repository->getUnterseiten($id),
'breadcrumb' => $this->repository->buildBreadcrumb($seite),
]);
}
/**
* GET /explorer/chunks
* Liste aller Chunks mit Filtern
*/
public function chunks(): void
{
$category = $this->getString('category');
$status = $this->getString('status');
$search = $this->getString('search');
$pagination = Pagination::fromRequest(50);
$totalCount = $this->repository->countChunksFiltered($category, $status, $search);
$pagination = $pagination->withTotal($totalCount);
$this->view('system-explorer.chunks.index', [
'title' => 'Chunks',
'chunks' => $this->repository->getChunksFilteredPaginated(
$category,
$status,
$search,
$pagination->limit,
$pagination->offset
),
'categories' => $this->repository->getDistinctCategories(),
'currentCategory' => $category,
'currentStatus' => $status,
'currentSearch' => $search,
'currentPage' => $pagination->page,
'totalCount' => $pagination->totalCount,
'totalPages' => $pagination->totalPages(),
]);
}
/**
* GET /explorer/chunks/{id}
* Chunk-Details
*/
public function chunkShow(int $id): void
{
$chunk = $this->repository->getChunk($id);
if ($chunk === null) {
$this->notFound('Chunk nicht gefunden');
}
// Nachbar-Chunks
$prevChunk = $this->repository->getChunkByDokumentAndIndex(
$chunk['dokumentation_id'],
$chunk['chunk_index'] - 1
);
$nextChunk = $this->repository->getChunkByDokumentAndIndex(
$chunk['dokumentation_id'],
$chunk['chunk_index'] + 1
);
$this->view('system-explorer.chunks.show', [
'title' => 'Chunk #' . $chunk['id'],
'chunk' => $chunk,
'prevChunk' => $prevChunk,
'nextChunk' => $nextChunk,
]);
}
/**
* GET /explorer/taxonomie
* Taxonomie-Übersicht
*/
public function taxonomie(): void
{
$this->view('system-explorer.taxonomie', [
'title' => 'Taxonomie & Entities',
'categories' => $this->repository->getCategoriesWithStats(),
'topKeywords' => $this->repository->getTopKeywords(30),
'topEntities' => $this->repository->getTopEntitiesRaw(30),
]);
}
/**
* GET /explorer/suche
* Suche-Formular
*/
public function suche(): void
{
$query = $this->getString('q');
$category = $this->getString('category');
$limit = $this->getLimit(20, 10);
$results = [];
$suggestions = [];
if ($query !== '') {
$filters = [];
if ($category !== '') {
$filters['taxonomy_category'] = $category;
}
$search = new HybridSearchService();
$results = $search->search($query, $filters, $limit);
$suggestions = $search->suggestRelatedSearches($results);
}
$this->view('system-explorer.suche', [
'title' => 'Dokumentation durchsuchen',
'query' => $query,
'results' => $results,
'suggestions' => $suggestions,
'categories' => $this->repository->getDistinctCategories(),
'currentCategory' => $category,
'limit' => $limit,
]);
}
/**
* Breadcrumb aufbauen
*/
private function buildBreadcrumb(array $seite): array
{
$breadcrumb = [];
$current = $seite;
while ($current !== null && $current !== false) {
array_unshift($breadcrumb, [
'id' => $current['id'],
'title' => $current['title'],
'path' => $current['path'],
'depth' => $current['depth'],
]);
if ($current['parent_id'] === null) {
break;
}
$stmt = $this->db->prepare('SELECT * FROM dokumentation WHERE id = :id');
$stmt->execute(['id' => $current['parent_id']]);
$current = $stmt->fetch();
}
return $breadcrumb;
}
}
Vollständig herunterladen
Aktionen
Andere Versionen dieser Datei
| ID |
Version |
Typ |
Größe |
Datum |
| 1231 |
35 |
modified |
6.8 KB |
2025-12-25 12:32 |
| 697 |
34 |
modified |
6.9 KB |
2025-12-23 07:53 |
| 642 |
33 |
modified |
6.9 KB |
2025-12-23 04:47 |
| 637 |
32 |
modified |
6.9 KB |
2025-12-23 04:46 |
| 636 |
31 |
modified |
6.8 KB |
2025-12-23 04:46 |
| 608 |
30 |
modified |
6.8 KB |
2025-12-23 04:39 |
| 587 |
29 |
modified |
6.8 KB |
2025-12-23 04:24 |
| 392 |
28 |
modified |
7.5 KB |
2025-12-22 08:40 |
| 391 |
27 |
modified |
7.6 KB |
2025-12-22 08:40 |
| 390 |
26 |
modified |
9.4 KB |
2025-12-22 08:39 |
| 389 |
25 |
modified |
10.4 KB |
2025-12-22 08:39 |
| 388 |
24 |
modified |
12.0 KB |
2025-12-22 08:37 |
| 362 |
23 |
modified |
13.0 KB |
2025-12-22 08:22 |
| 361 |
22 |
modified |
13.2 KB |
2025-12-22 08:22 |
| 360 |
21 |
modified |
14.9 KB |
2025-12-22 08:22 |
| 357 |
20 |
modified |
16.0 KB |
2025-12-22 08:20 |
| 349 |
19 |
modified |
16.7 KB |
2025-12-22 08:15 |
| 348 |
18 |
modified |
18.5 KB |
2025-12-22 08:14 |
| 347 |
17 |
modified |
18.4 KB |
2025-12-22 08:14 |
| 346 |
16 |
modified |
18.3 KB |
2025-12-22 08:14 |
| 342 |
15 |
modified |
18.2 KB |
2025-12-22 08:11 |
| 341 |
14 |
modified |
18.3 KB |
2025-12-22 08:11 |
| 340 |
13 |
modified |
18.2 KB |
2025-12-22 08:11 |
| 316 |
12 |
modified |
18.2 KB |
2025-12-22 08:06 |
| 315 |
11 |
modified |
18.2 KB |
2025-12-22 08:06 |
| 314 |
10 |
modified |
18.2 KB |
2025-12-22 08:06 |
| 297 |
9 |
modified |
18.2 KB |
2025-12-22 08:03 |
| 296 |
8 |
modified |
18.2 KB |
2025-12-22 08:03 |
| 290 |
7 |
modified |
18.3 KB |
2025-12-22 08:00 |
| 228 |
6 |
modified |
18.3 KB |
2025-12-22 01:44 |
| 227 |
5 |
modified |
18.4 KB |
2025-12-22 01:44 |
| 226 |
4 |
modified |
18.4 KB |
2025-12-22 01:44 |
| 136 |
3 |
modified |
18.2 KB |
2025-12-20 19:56 |
| 30 |
2 |
modified |
18.9 KB |
2025-12-20 17:23 |
| 25 |
1 |
modified |
18.9 KB |
2025-12-20 17:07 |
← Zurück zur Übersicht