Mache Medien, Übungen und Kurse in der Verwaltung bearbeitbar.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4f2e5a5f3b
commit
3ee9f529ca
33 files changed
+1105
-284
No files matched your search
@@ -6,6 +6,7 @@
|
||||
use App\Domain\Catalog\BundleStatus;
|
||||
use App\Domain\Catalog\BundleVersion;
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\CompositionVersion;
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
@@ -24,6 +25,30 @@ public static function elements(): array
|
||||
return ContentElement::query()->orderBy('working_title')->pluck('working_title', 'id')->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function assignmentTargets(?int $exceptCompositionId = null): array
|
||||
{
|
||||
$options = [];
|
||||
|
||||
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 (CompositionVersion::query()->where('status', ContentVersionStatus::Bereit)->with('composition')->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;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user