Vereinheitliche die fachlichen Säulen auf die zentrale Säulenverwaltung
Module, Programme und Lizenzartikel verwenden wie Medien und Seiten die Tabelle pillars; die Kopie „Fachliche Säule“ in den redaktionellen Dimensionen wird nirgends mehr angeboten, geändert oder gefiltert und bleibt nur als Verlauf erhalten. - Migration (nur Ergänzungen): composition_pillar und license_article_pillar mit restrictOnDelete, pillar_id an den alten Dimensionswerten als dokumentierte Abbildung, einmalige wiederholbare Übernahme (LegacyPillarAdoption). - Übernahme nur über die gespeicherte Kennung pfeiler-<Nummer> und nur direkte Zuordnungen; mehrdeutige, abgeleitete und verwaiste Fälle werden gemeldet, nicht geraten. Medien bleiben bei ihrer Zuordnung. Alte Zeilen bleiben unverändert. Befehl: php artisan luf:saeulen-uebernehmen [--dry-run]. - Editoren von Modul, Programm und Lizenzartikel wählen Säulen aus der Säulenverwaltung; PillarService::assign gilt für alle Objektarten, Löschschutz zählt alle Objektarten. - Filter: Module und Programme, Aufbau-Picker und Mitgliederbibliothek nach der Säulenzuordnung; alte Adressen mit einem Säulenwert der Einordnung folgen der Säule. - Abgeleitete Säulen (aus enthaltenen Medien) bleiben getrennt von direkten. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d5c2b34b9d
commit
7c48a6480c
25 files changed
+1250
-44
No files matched your search
@@ -9,6 +9,8 @@
|
||||
use App\Domain\Catalog\EditorialVocabulary;
|
||||
use App\Domain\Catalog\IdentityDimension;
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Catalog\PillarFilterCompat;
|
||||
use App\Domain\Entitlement\DecideAccess;
|
||||
use App\Domain\Entitlement\Grant;
|
||||
use App\Domain\Entitlement\GrantStatus;
|
||||
@@ -20,8 +22,10 @@
|
||||
use App\Http\CourseOutline;
|
||||
use App\Http\LibraryCatalog;
|
||||
use App\Http\SignedLink;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\View\View;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
@@ -35,8 +39,21 @@ public function index(Request $request, ?string $sicht = null): View
|
||||
$query = trim((string) $request->query('q', ''));
|
||||
$nutzung = (string) $request->query('nutzung', '');
|
||||
$dimensionIds = array_values(array_filter(array_map(intval(...), (array) $request->query('dimension', []))));
|
||||
$saeuleIds = array_values(array_filter(array_map(intval(...), (array) $request->query('saeule', []))));
|
||||
$dimensions = app(IdentityDimension::class);
|
||||
|
||||
// Alte Adressen: Säulen waren ein Wert der Einordnung. Mit belastbarer Verknüpfung gilt der Filter der Säule.
|
||||
foreach ($dimensionIds as $index => $valueId) {
|
||||
if (is_int($pillarId = PillarFilterCompat::pillarOfLegacyValue($valueId))) {
|
||||
$saeuleIds[] = $pillarId;
|
||||
unset($dimensionIds[$index]);
|
||||
}
|
||||
}
|
||||
|
||||
$dimensionIds = array_values($dimensionIds);
|
||||
$saeuleIds = array_values(array_unique($saeuleIds));
|
||||
$pillarOptions = $this->visiblePillars($catalog, $saeuleIds);
|
||||
|
||||
foreach (['programs', 'modules'] as $shelf) {
|
||||
if ($query !== '') {
|
||||
$catalog[$shelf] = array_values(array_filter(
|
||||
@@ -50,6 +67,12 @@ public function index(Request $request, ?string $sicht = null): View
|
||||
fn (array $card): bool => $dimensions->matches($card['composition'], $dimensionIds),
|
||||
));
|
||||
}
|
||||
if ($saeuleIds !== []) {
|
||||
$catalog[$shelf] = array_values(array_filter(
|
||||
$catalog[$shelf],
|
||||
fn (array $card): bool => $this->hasPillar($card['composition'], $saeuleIds),
|
||||
));
|
||||
}
|
||||
if (in_array($nutzung, ['nutzbar', 'teilweise', 'nicht enthalten'], true)) {
|
||||
$catalog[$shelf] = array_values(array_filter(
|
||||
$catalog[$shelf],
|
||||
@@ -79,6 +102,13 @@ function (array $card) use ($dimensions, $dimensionIds): bool {
|
||||
));
|
||||
}
|
||||
|
||||
if ($saeuleIds !== []) {
|
||||
$catalog['materials'] = array_values(array_filter(
|
||||
$catalog['materials'],
|
||||
fn (array $card): bool => $this->hasPillar($this->materialSubject($card), $saeuleIds),
|
||||
));
|
||||
}
|
||||
|
||||
if ($nutzung === 'teilweise' || $nutzung === 'nicht enthalten') {
|
||||
$catalog['materials'] = [];
|
||||
}
|
||||
@@ -89,11 +119,65 @@ function (array $card) use ($dimensions, $dimensionIds): bool {
|
||||
'sicht' => $sicht,
|
||||
'nutzung' => $nutzung,
|
||||
'dimensionIds' => $dimensionIds,
|
||||
'saeuleIds' => $saeuleIds,
|
||||
'filterPillars' => $pillarOptions,
|
||||
'filterDimensions' => app(EditorialVocabulary::class)->memberFilterDimensions(array_map(intval(...), $dimensionIds)),
|
||||
'libraryEmpty' => $untouched,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subjekt eines Materialkarte: Programm oder Modul, Medium oder der Artikel selbst.
|
||||
*
|
||||
* @param array<string, mixed> $card
|
||||
*/
|
||||
private function materialSubject(array $card): Model
|
||||
{
|
||||
$release = $card['article']->currentRelease;
|
||||
|
||||
return $release?->rootCompositionVersion?->composition
|
||||
?? $release?->rootElementVersion?->element
|
||||
?? $card['article'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Direkte Säulenzuordnung des Objekts selbst; die Säulen enthaltener Medien zählen hier nicht.
|
||||
*
|
||||
* @param list<int> $pillarIds
|
||||
*/
|
||||
private function hasPillar(Model $subject, array $pillarIds): bool
|
||||
{
|
||||
return $subject->pillars()->whereIn('pillars.id', $pillarIds)->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Säulen für den Filter: nur solche, die ein sichtbares Objekt der Bibliothek tatsächlich trägt, und eine bereits
|
||||
* gewählte. So erscheinen neue oder interne Säulen ohne Zuordnung nicht in der Bibliothek.
|
||||
*
|
||||
* @param array<string, mixed> $catalog
|
||||
* @param list<int> $selected
|
||||
* @return Collection<int, Pillar>
|
||||
*/
|
||||
private function visiblePillars(array $catalog, array $selected)
|
||||
{
|
||||
$used = [];
|
||||
|
||||
foreach (array_merge($catalog['programs'], $catalog['modules']) as $card) {
|
||||
foreach ($card['composition']->pillars()->pluck('pillars.id') as $id) {
|
||||
$used[(int) $id] = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($catalog['materials'] as $card) {
|
||||
foreach ($this->materialSubject($card)->pillars()->pluck('pillars.id') as $id) {
|
||||
$used[(int) $id] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return Pillar::query()->whereIn('id', array_values(array_unique([...array_keys($used), ...$selected])))
|
||||
->orderBy('sort_order')->orderBy('name')->get();
|
||||
}
|
||||
|
||||
public function programs(Request $request): View
|
||||
{
|
||||
return $this->index($request, 'programme');
|
||||
|
||||
Reference in new issue
Block a user