Ordne Übungsabschnitte im Medienbestand ein und filtere Materialarten mehrfach
- Medium anlegen: Pflichtfeld Fachliche Materialart (serverseitig geprüft) - Materialart Übungsabschnitt (automatisch) für Abschnitte im Übungseditor und aus Shinkan, mit Verweis auf die Übung - Medienmanager: Checkboxen statt Dropdown, Start ohne Übungsabschnitte, persönlicher Standard je Konto - Zuordnung des Bestands nur bei belegter Herkunft; Übungsabschnitte nie öffentlich Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
99122ddfee
commit
ad581cb545
29 files changed
+1321
-25
No files matched your search
@@ -16,6 +16,7 @@
|
||||
use App\Domain\Catalog\ReleaseContent;
|
||||
use App\Domain\Media\ThumbnailRef;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Resources\Practices\PracticeResource;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -78,7 +79,7 @@ public function classifications(array $selectedIds = []): array
|
||||
*/
|
||||
public function cardFor(ContentElement $element, bool $canEdit): array
|
||||
{
|
||||
$element->loadMissing(['versions', 'pillars', 'editorialContentKind']);
|
||||
$element->loadMissing(['versions', 'pillars', 'editorialContentKind', 'originComposition']);
|
||||
$versionIds = $element->versions->pluck('id')->all();
|
||||
|
||||
return $this->card(
|
||||
@@ -98,7 +99,7 @@ public function cards(array $filters, bool $canEdit): array
|
||||
{
|
||||
$filters = $this->normalize($filters);
|
||||
$elements = ContentElement::query()
|
||||
->with(['versions', 'pillars', 'editorialContentKind'])
|
||||
->with(['versions', 'pillars', 'editorialContentKind', 'originComposition'])
|
||||
->orderBy('working_title')
|
||||
->get();
|
||||
$versionIds = $elements->flatMap(fn (ContentElement $element) => $element->versions->pluck('id'))->all();
|
||||
@@ -152,6 +153,8 @@ private function normalize(array $filters): array
|
||||
'saeule' => $saeule,
|
||||
'einordnung' => $einordnung,
|
||||
'inhaltsart' => ctype_digit($filters['inhaltsart'] ?? '') ? $filters['inhaltsart'] : '',
|
||||
// Mehrfachauswahl der Materialarten (MaterialKindSelection); leer = keine Einschränkung.
|
||||
'arten' => trim((string) ($filters['arten'] ?? '')),
|
||||
'verarbeitung' => $this->choice($filters['verarbeitung'] ?? '', ['fehler', 'uebernahme']),
|
||||
'archiv' => $this->choice($filters['archiv'] ?? '', ['aktiv', 'archiviert', 'alle'], 'aktiv'),
|
||||
];
|
||||
@@ -449,6 +452,14 @@ private function matches(ContentElement $element, array $portrait, array $uses,
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['arten'] !== '') {
|
||||
$keys = MaterialKindSelection::decode($filters['arten']) ?? [];
|
||||
|
||||
if (! in_array(MaterialKindSelection::key($element->editorial_content_kind_id === null ? null : (int) $element->editorial_content_kind_id), $keys, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filters['verarbeitung'] === 'fehler' && $portrait['processing'] !== 'Verarbeitungsfehler') {
|
||||
return false;
|
||||
}
|
||||
@@ -516,6 +527,7 @@ private function card(ContentElement $element, array $portrait, array $uses, arr
|
||||
'title' => $element->working_title,
|
||||
'type' => $this->catalog->outputLabel((string) $element->output_class),
|
||||
'editorialKind' => $element->editorialContentKind?->label,
|
||||
'exercise' => $this->exerciseOf($element, $canEdit),
|
||||
'typeKey' => $typeKey,
|
||||
'description' => $description === '' ? null : $description,
|
||||
'usageNote' => $usageNote === '' ? null : $usageNote,
|
||||
@@ -544,6 +556,25 @@ private function card(ContentElement $element, array $portrait, array $uses, arr
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Die Übung, für die ein Textabschnitt angelegt wurde: Titel und, für die Redaktion, der Weg zum Übungseditor.
|
||||
*
|
||||
* @return array{title: string, url: string|null}|null
|
||||
*/
|
||||
private function exerciseOf(ContentElement $element, bool $canEdit): ?array
|
||||
{
|
||||
$exercise = $element->originComposition;
|
||||
|
||||
if (! $exercise instanceof Composition) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return [
|
||||
'title' => (string) ($exercise->display_title ?: $exercise->designation),
|
||||
'url' => $canEdit ? PracticeResource::getUrl('edit', ['record' => $exercise]) : null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $uses
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user