Führe die zentrale Pflege redaktioneller Stammdaten ein
FACH-56 bis FACH-58: Arbeitsplatz „Redaktionelle Stammdaten“ für fachliche Materialarten, Altersbereich und Zielgruppe, Einsatzbereiche und Verwendungszwecke (bestehende Tabellen; Säulen bleiben in ihrer Verwaltung). - Migration (nur Ergänzungen): aktiv/inaktiv für Materialarten und Werte, Reihenfolge der Werte, zulässige Objektkontexte der Materialarten, einmalig aus dem Bestand abgeleitet; jede vorhandene Zuordnung bleibt zulässig. - EditorialVocabulary als eine Regelquelle für Redaktion (Medium, Modul, Programm, Lizenzartikel), Medien- und Kompositionsfilter, Picker und Mitgliederbibliothek: neu wählbar nur aktive, kontextgerechte Werte; vorhandene inaktive Zuordnungen sichtbar und beim Speichern erhalten; serverseitige Prüfung der Materialart. - Kennung fest, Bezeichnung pflegbar; verwendete Werte nur deaktivierbar; Systemkennungen (programm, modul, traineranleitung) geschützt. - „Inhaltsart“ heißt durchgängig „Fachliche Materialart“; der Picker trennt Medienart und fachliche Materialart und filtert danach. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c84ae10809
commit
f774d43647
24 files changed
+1543
-91
No files matched your search
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Redaktionelle Stammdaten zentral pflegen (FACH-56 bis FACH-58). Nur Ergänzungen, nichts wird umbenannt oder gelöscht:
|
||||
*
|
||||
* - Fachliche Materialarten: aktiv/inaktiv und zulässige Objektkontexte (medium, modul, programm, lizenzartikel).
|
||||
* - Werte der Einordnung (Zielgruppe, Einsatzbereich, Verwendungszweck): aktiv/inaktiv und Reihenfolge.
|
||||
*
|
||||
* Die Kontexte werden einmalig aus dem Bestand abgeleitet: Programm und Modul gelten für ihre Objektart, alle übrigen
|
||||
* Materialarten für Medien; Lizenzartikel behalten wie bisher die ganze Auswahl. Danach wird jeder Kontext ergänzt, in
|
||||
* dem eine Materialart tatsächlich verwendet wird, damit keine vorhandene Zuordnung unzulässig wird.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('editorial_content_kinds', function (Blueprint $table) {
|
||||
$table->boolean('is_active')->default(true)->after('sort_order');
|
||||
$table->json('contexts')->nullable()->after('is_active');
|
||||
});
|
||||
|
||||
Schema::table('editorial_dimension_values', function (Blueprint $table) {
|
||||
$table->unsignedInteger('sort_order')->default(0)->after('label');
|
||||
$table->boolean('is_active')->default(true)->after('sort_order');
|
||||
});
|
||||
|
||||
foreach (DB::table('editorial_dimension_values')->orderBy('editorial_dimension_id')->orderBy('id')->get(['id', 'editorial_dimension_id']) as $index => $value) {
|
||||
DB::table('editorial_dimension_values')->where('id', $value->id)->update(['sort_order' => ($index + 1) * 10]);
|
||||
}
|
||||
|
||||
$compositionContexts = ['kurs' => 'programm', 'uebung' => 'modul'];
|
||||
|
||||
foreach (DB::table('editorial_content_kinds')->get(['id', 'slug']) as $kind) {
|
||||
$contexts = match ($kind->slug) {
|
||||
'programm' => ['programm', 'lizenzartikel'],
|
||||
'modul' => ['modul', 'lizenzartikel'],
|
||||
default => ['medium', 'lizenzartikel'],
|
||||
};
|
||||
|
||||
if (DB::table('content_elements')->where('editorial_content_kind_id', $kind->id)->exists()) {
|
||||
$contexts[] = 'medium';
|
||||
}
|
||||
|
||||
foreach (DB::table('compositions')->where('editorial_content_kind_id', $kind->id)->distinct()->pluck('kind') as $compositionKind) {
|
||||
if (isset($compositionContexts[$compositionKind])) {
|
||||
$contexts[] = $compositionContexts[$compositionKind];
|
||||
}
|
||||
}
|
||||
|
||||
$order = ['medium', 'modul', 'programm', 'lizenzartikel'];
|
||||
$contexts = array_values(array_filter($order, fn (string $context): bool => in_array($context, $contexts, true)));
|
||||
|
||||
DB::table('editorial_content_kinds')->where('id', $kind->id)->update(['contexts' => json_encode($contexts)]);
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('editorial_dimension_values', function (Blueprint $table) {
|
||||
$table->dropColumn(['sort_order', 'is_active']);
|
||||
});
|
||||
|
||||
Schema::table('editorial_content_kinds', function (Blueprint $table) {
|
||||
$table->dropColumn(['is_active', 'contexts']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user