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
@@ -2,17 +2,49 @@
|
||||
|
||||
namespace App\Domain\Catalog;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
* Fachliche Materialart (FACH-56 bis FACH-58). Die Bezeichnung ist pflegbar, die Kennung (slug) bleibt nach dem Anlegen
|
||||
* fest. Zulässige Objektkontexte bestimmen, wo eine Materialart neu gewählt werden kann; vorhandene Zuordnungen bleiben
|
||||
* immer erhalten (siehe EditorialVocabulary).
|
||||
*/
|
||||
class EditorialContentKind extends Model
|
||||
{
|
||||
/** Objektkontexte aus dem Fachmodell: Medium (ContentElement), Modul und Programm (Composition), Lizenzartikel. */
|
||||
public const CONTEXTS = [
|
||||
'medium' => 'Medium',
|
||||
'modul' => 'Modul',
|
||||
'programm' => 'Programm',
|
||||
'lizenzartikel' => 'Lizenzartikel',
|
||||
];
|
||||
|
||||
/**
|
||||
* Kennungen, auf die der Code fachlich verweist: öffentliche Programmseiten und das Anlegen von Programmen und
|
||||
* Modulen (programm, modul), Vertraulichkeit von Traineranleitungen (traineranleitung). Ihre Bezeichnung bleibt
|
||||
* pflegbar; deaktivieren, Kontexte ändern und löschen sind gesperrt.
|
||||
*/
|
||||
public const SYSTEM_SLUGS = ['programm', 'modul', 'traineranleitung'];
|
||||
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
'label',
|
||||
'sort_order',
|
||||
'is_active',
|
||||
'contexts',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_active' => 'boolean',
|
||||
'contexts' => 'array',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function compositions(): HasMany
|
||||
{
|
||||
return $this->hasMany(Composition::class);
|
||||
@@ -23,11 +55,37 @@ public function contentElements(): HasMany
|
||||
return $this->hasMany(ContentElement::class);
|
||||
}
|
||||
|
||||
public function licenseArticles(): HasMany
|
||||
{
|
||||
return $this->hasMany(LicenseArticle::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<EditorialContentKind> $query
|
||||
*/
|
||||
public function scopeActive(Builder $query): void
|
||||
{
|
||||
$query->where('is_active', true);
|
||||
}
|
||||
|
||||
public function allows(string $context): bool
|
||||
{
|
||||
return in_array($context, (array) ($this->contexts ?? []), true);
|
||||
}
|
||||
|
||||
public function isSystem(): bool
|
||||
{
|
||||
return in_array($this->slug, self::SYSTEM_SLUGS, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alle Materialarten in Pflegereihenfolge (ohne Kontext- oder Aktivfilter). Für Auswahlstellen gilt
|
||||
* EditorialVocabulary.
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public static function selectOptions(): array
|
||||
{
|
||||
return static::query()->orderBy('sort_order')->pluck('label', 'id')->all();
|
||||
return static::query()->orderBy('sort_order')->orderBy('id')->pluck('label', 'id')->all();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user