{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/partials\/form\/collections-select.php",
"content": "<?php\n\n\/**\n * Collections Multi-Select Partial\n *\n * Einheitliches Dropdown für RAG-Collection-Auswahl.\n * Verwendet in: Chat, Content Studio\n *\n * @param array $collections Array von Collection-Daten aus CollectionRepository\n * @param array $selected Array von ausgewählten collection_ids\n * @param string $name Form-Feldname (default: 'collections[]')\n * @param string $variant 'default' oder 'inline' für Styling\n * @param bool $required Mindestens eine Auswahl erforderlich\n *\/\n\n$collections = $collections ?? [];\n$selected = $selected ?? [];\n\n\/\/ JSON-String zu Array konvertieren (Abwärtskompatibilität)\nif (is_string($selected)) {\n $selected = json_decode($selected, true) ?: [];\n}\n\n$name = $name ?? 'collections[]';\n$variant = $variant ?? 'default';\n$required = $required ?? false;\n\n$class = match ($variant) {\n 'inline' => 'form-select form-select--inline',\n 'checkbox' => '', \/\/ Für Checkbox-Variante\n default => 'form-select',\n};\n?>\n<?php if ($variant === 'checkbox'): ?>\n<div class=\"checkbox-group collections-select\">\n <?php foreach ($collections as $col):\n $colId = $col['collection_id'];\n $isSelected = in_array($colId, $selected, true);\n $points = (int) ($col['points_count'] ?? 0);\n ?>\n <label class=\"checkbox-label\" title=\"<?= number_format($points) ?> Dokumente\">\n <input type=\"checkbox\" name=\"<?= htmlspecialchars($name) ?>\"\n value=\"<?= htmlspecialchars($colId) ?>\"\n <?= $isSelected ? 'checked' : '' ?>>\n <?= htmlspecialchars($col['display_name']) ?>\n <span class=\"checkbox-meta\">(<?= number_format($points) ?>)<\/span>\n <\/label>\n <?php endforeach; ?>\n<\/div>\n<?php else: ?>\n<select name=\"<?= htmlspecialchars($name) ?>\"\n multiple\n class=\"<?= $class ?> collections-select\"\n title=\"Collections für RAG auswählen\"\n <?= $required ? 'required' : '' ?>>\n <?php foreach ($collections as $col):\n $colId = $col['collection_id'];\n $isSelected = in_array($colId, $selected, true);\n $points = (int) ($col['points_count'] ?? 0);\n ?>\n <option value=\"<?= htmlspecialchars($colId) ?>\"\n <?= $isSelected ? 'selected' : '' ?>\n title=\"<?= number_format($points) ?> Dokumente\">\n <?= htmlspecialchars($col['display_name']) ?>\n <\/option>\n <?php endforeach; ?>\n<\/select>\n<?php endif; ?>\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/partials\/form\/collections-select.php",
"content": "<?php\n\n\/**\n * Collections Multi-Select Partial\n *\n * Einheitliches Dropdown für RAG-Collection-Auswahl.\n * Verwendet in: Chat, Content Studio\n *\n * @param array $collections Array von Collection-Daten aus CollectionRepository\n * @param array $selected Array von ausgewählten collection_ids\n * @param string $name Form-Feldname (default: 'collections[]')\n * @param string $variant 'default' oder 'inline' für Styling\n * @param bool $required Mindestens eine Auswahl erforderlich\n *\/\n\n$collections = $collections ?? [];\n$selected = $selected ?? [];\n\n\/\/ JSON-String zu Array konvertieren (Abwärtskompatibilität)\nif (is_string($selected)) {\n $selected = json_decode($selected, true) ?: [];\n}\n\n$name = $name ?? 'collections[]';\n$variant = $variant ?? 'default';\n$required = $required ?? false;\n\n$class = match ($variant) {\n 'inline' => 'form-select form-select--inline',\n 'checkbox' => '', \/\/ Für Checkbox-Variante\n default => 'form-select',\n};\n?>\n<?php if ($variant === 'checkbox'): ?>\n<div class=\"checkbox-group collections-select\">\n <?php foreach ($collections as $col):\n $colId = $col['collection_id'];\n $isSelected = in_array($colId, $selected, true);\n $points = (int) ($col['points_count'] ?? 0);\n ?>\n <label class=\"checkbox-label\" title=\"<?= number_format($points) ?> Dokumente\">\n <input type=\"checkbox\" name=\"<?= htmlspecialchars($name) ?>\"\n value=\"<?= htmlspecialchars($colId) ?>\"\n <?= $isSelected ? 'checked' : '' ?>>\n <?= htmlspecialchars($col['display_name']) ?>\n <span class=\"checkbox-meta\">(<?= number_format($points) ?>)<\/span>\n <\/label>\n <?php endforeach; ?>\n<\/div>\n<?php else: ?>\n<select name=\"<?= htmlspecialchars($name) ?>\"\n multiple\n class=\"<?= $class ?> collections-select\"\n title=\"Collections für RAG auswählen\"\n <?= $required ? 'required' : '' ?>>\n <?php foreach ($collections as $col):\n $colId = $col['collection_id'];\n $isSelected = in_array($colId, $selected, true);\n $points = (int) ($col['points_count'] ?? 0);\n ?>\n <option value=\"<?= htmlspecialchars($colId) ?>\"\n <?= $isSelected ? 'selected' : '' ?>\n title=\"<?= number_format($points) ?> Dokumente\">\n <?= htmlspecialchars($col['display_name']) ?>\n <\/option>\n <?php endforeach; ?>\n<\/select>\n<?php endif; ?>\n",
"structuredPatch": [],
"originalFile": null
}
}