Mache die Inhaltsverwaltung fuer die Redaktion bedienbar
Deploy Test / test (push) Successful in 18s
Deploy Test / deploy (push) Successful in 22s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-16 08:59:30 +01:00
1 parent 9b52181be1
commit d6ff881e4e
10 files changed
+371 -49

No files matched your search

+46 -12
View File
@@ -30,23 +30,57 @@ public static function elements(): array
*/
public static function assignmentTargets(?int $exceptCompositionId = null): array
{
$options = [];
$media = [];
$structures = [];
foreach (ContentElementVersion::query()->where('status', ContentVersionStatus::Bereit)->with('element')->orderBy('id')->get() as $version) {
$options['element:'.$version->id] = 'Medium: '.$version->element->working_title.' · Fassung '.$version->number;
foreach (ContentElementVersion::query()->where('status', ContentVersionStatus::Bereit)->with('element.editorialContentKind')->orderBy('id')->get() as $version) {
$media['element:'.$version->id] = self::elementLabel($version);
}
foreach (CompositionVersion::query()->where('status', ContentVersionStatus::Bereit)->with('composition')->orderBy('id')->get() as $version) {
foreach (CompositionVersion::query()->where('status', ContentVersionStatus::Bereit)->with('composition.editorialContentKind')->orderBy('id')->get() as $version) {
if ($exceptCompositionId !== null && (int) $version->composition_id === $exceptCompositionId) {
continue;
}
$kind = $version->composition->kind;
$label = $kind instanceof CompositionKind ? $kind->label() : 'Zusammenstellung';
$options['composition:'.$version->id] = $label.': '.$version->composition->designation.' · Fassung '.$version->number;
$structures['composition:'.$version->id] = self::compositionLabel($version);
}
return $options;
return array_filter([
'Medien und Dokumente' => $media,
'Module und Programme' => $structures,
]);
}
public static function elementLabel(ContentElementVersion $version): string
{
$kind = $version->element->editorialContentKind?->label;
$kind = $kind ?: self::outputLabel((string) $version->element->output_class);
return $version->element->working_title.', '.$kind.', Fassung '.$version->number;
}
public static function compositionLabel(CompositionVersion $version): string
{
$editorial = $version->composition->editorialContentKind?->label;
$technical = $version->composition->kind;
$kind = $editorial ?: ($technical instanceof CompositionKind ? $technical->label() : 'Zusammenstellung');
$title = filled($version->composition->display_title)
? $version->composition->display_title
: $version->composition->designation;
return $title.', '.$kind.', Fassung '.$version->number;
}
private static function outputLabel(string $outputClass): string
{
return match ($outputClass) {
'film' => 'Film',
'audio' => 'Hörstück',
'bild' => 'Bild',
'document', 'pdf' => 'Dokument',
'text' => 'Text',
default => 'Medium',
};
}
/**
@@ -56,12 +90,12 @@ public static function readyTargets(): array
{
$options = [];
foreach (ContentElementVersion::query()->where('status', ContentVersionStatus::Bereit)->with('element')->orderBy('id')->get() as $version) {
$options['element:'.$version->id] = $version->element->working_title.' · Fassung '.$version->number;
foreach (ContentElementVersion::query()->where('status', ContentVersionStatus::Bereit)->with('element.editorialContentKind')->orderBy('id')->get() as $version) {
$options['element:'.$version->id] = self::elementLabel($version);
}
foreach (CompositionVersion::query()->where('status', ContentVersionStatus::Bereit)->with('composition')->orderBy('id')->get() as $version) {
$options['composition:'.$version->id] = $version->composition->designation.' · Fassung '.$version->number;
foreach (CompositionVersion::query()->where('status', ContentVersionStatus::Bereit)->with('composition.editorialContentKind')->orderBy('id')->get() as $version) {
$options['composition:'.$version->id] = self::compositionLabel($version);
}
return $options;