Gestalte den Mitgliederbereich nach Brand-UI-Kit 14 neu

Eine Navigation (Meine Bibliothek, Programme, Meine Lizenzen, Konto-Menü) mit der freigegebenen Wortmarke,
Startseite ohne erfundene Inhalte, Bibliothek mit Inhaltsart-Filter und einer Karte je Medienidentität
(„Verwendet in“), Programm-/Moduldetail, Film und Material im Zusammenhang mit Begleitmaterial und Weg zurück,
Lizenzübersicht mit Detailseite je Berechtigung. Alle Größen aus der Größenskala (ADR-44, neues Token --card-min).

Tests bewusst angepasst: Der Film spielt auf der Kontextseite statt eingebettet im Programm, Download-Links tragen
ein Symbol, der Platzhalter ist ein dekoratives Element, die Wortmarke ist das freigegebene Logo. Die Vorschau der
Bibliothekskarte in der Verwaltung nutzt dieselbe Komponente.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-22 17:56:16 +01:00
1 parent 9f070fbab2
commit 2e6260acca
41 files changed
+3742 -1093

No files matched your search

@@ -39,7 +39,7 @@ public function claim(Request $request, Offer $offer, GrantIssuer $issuer): Redi
return back()->withErrors(['offer' => $exception->getMessage()]);
}
return redirect()->route('member.library')->with('status', 'Das Angebot liegt in Ihrer Bibliothek.');
return redirect()->route('member.library')->with('status', 'Das Angebot liegt in deiner Bibliothek.');
}
public function place(Request $request, Offer $offer, Checkout $checkout): RedirectResponse
+111 -88
View File
@@ -21,8 +21,10 @@
use App\Http\Controllers\Controller;
use App\Http\CourseOutline;
use App\Http\LibraryCatalog;
use App\Http\MemberLicenses;
use App\Http\SignedLink;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Collection;
@@ -32,12 +34,28 @@
class LibraryController extends Controller
{
/** Inhaltsarten der Bibliothek (Schlüssel der Adresse und des Filters). */
public const TYPES = [
'programm' => 'Programme',
'modul' => 'Module',
'film' => 'Filme',
'material' => 'Materialien',
];
public function index(Request $request, ?string $sicht = null): View
{
$catalog = app(LibraryCatalog::class)->index($request->user());
$untouched = $catalog['programs'] === [] && $catalog['modules'] === [] && $catalog['materials'] === [];
$items = [...$catalog['programs'], ...$catalog['modules'], ...$catalog['materials']];
$untouched = $items === [];
$query = trim((string) $request->query('q', ''));
$nutzung = (string) $request->query('nutzung', '');
$sortierung = $request->query('sortierung') === 'titel' ? 'titel' : 'standard';
$art = match ($sicht) {
'programme' => 'programm',
'module' => 'modul',
default => (string) $request->query('art', ''),
};
$art = array_key_exists($art, self::TYPES) ? $art : '';
$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);
@@ -52,94 +70,60 @@ public function index(Request $request, ?string $sicht = null): View
$dimensionIds = array_values($dimensionIds);
$saeuleIds = array_values(array_unique($saeuleIds));
$pillarOptions = $this->visiblePillars($catalog, $saeuleIds);
$pillarOptions = $this->visiblePillars($items, $saeuleIds);
foreach (['programs', 'modules'] as $shelf) {
if ($query !== '') {
$catalog[$shelf] = array_values(array_filter(
$catalog[$shelf],
fn (array $card): bool => $this->matches($card, $query),
));
}
if ($dimensionIds !== []) {
$catalog[$shelf] = array_values(array_filter(
$catalog[$shelf],
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],
fn (array $card): bool => ($card['coverage'] ?? '') === $nutzung,
));
// Gemeinsame Filter für alle Inhaltsarten. Die Zahl je Art zeigt, was die übrigen Filter übrig lassen.
$matching = array_values(array_filter($items, function (array $card) use ($query, $nutzung, $dimensionIds, $saeuleIds, $dimensions): bool {
return ($query === '' || $this->matches($card, $query))
&& ($dimensionIds === [] || $dimensions->matches($card['subject'], $dimensionIds))
&& ($saeuleIds === [] || $this->hasPillar($card['subject'], $saeuleIds))
&& (! in_array($nutzung, ['nutzbar', 'teilweise', 'nicht enthalten'], true) || ($card['coverage'] ?? '') === $nutzung);
}));
$counts = array_fill_keys(array_keys(self::TYPES), 0);
foreach ($matching as $card) {
$counts[$card['type']]++;
}
$shown = $art === '' ? $matching : array_values(array_filter($matching, fn (array $card): bool => $card['type'] === $art));
if ($sortierung === 'titel') {
usort($shown, fn (array $left, array $right): int => strcoll(mb_strtolower($left['title']), mb_strtolower($right['title'])));
}
$shelves = [];
foreach (self::TYPES as $type => $label) {
$cards = array_values(array_filter($shown, fn (array $card): bool => $card['type'] === $type));
if ($cards !== []) {
$shelves[$type] = ['label' => $label, 'cards' => $cards];
}
}
if ($query !== '') {
$catalog['materials'] = array_values(array_filter(
$catalog['materials'],
fn (array $card): bool => $this->matches($card, $query),
));
}
if ($dimensionIds !== []) {
$catalog['materials'] = array_values(array_filter(
$catalog['materials'],
function (array $card) use ($dimensions, $dimensionIds): bool {
$release = $card['article']->currentRelease;
$subject = $release?->rootCompositionVersion?->composition
?? $release?->rootElementVersion?->element
?? $card['article'];
return $dimensions->matches($subject, $dimensionIds);
},
));
}
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'] = [];
}
$filterActive = $query !== '' || $nutzung !== '' || $dimensionIds !== [] || $saeuleIds !== [] || $art !== '';
return view('member.library', [
...$catalog,
'shelves' => $shelves,
'total' => count($shown),
'counts' => $counts,
'allCount' => count($matching),
'art' => $art,
'types' => self::TYPES,
'query' => $query,
'sicht' => $sicht,
'nutzung' => $nutzung,
'sortierung' => $sortierung,
'dimensionIds' => $dimensionIds,
'saeuleIds' => $saeuleIds,
'filterPillars' => $pillarOptions,
'filterDimensions' => app(EditorialVocabulary::class)->memberFilterDimensions(array_map(intval(...), $dimensionIds)),
'libraryEmpty' => $untouched,
'filterActive' => $filterActive,
'filterCount' => count($dimensionIds) + count($saeuleIds) + ($nutzung !== '' ? 1 : 0),
]);
}
/**
* 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.
*
@@ -154,22 +138,16 @@ private function hasPillar(Model $subject, array $pillarIds): bool
* 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<array<string, mixed>> $items
* @param list<int> $selected
* @return Collection<int, Pillar>
*/
private function visiblePillars(array $catalog, array $selected)
private function visiblePillars(array $items, 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) {
foreach ($items as $card) {
foreach ($card['subject']->pillars()->pluck('pillars.id') as $id) {
$used[(int) $id] = true;
}
}
@@ -193,20 +171,55 @@ public function program(Request $request, Composition $composition): View
return view('member.program', app(LibraryCatalog::class)->program($request->user(), $composition));
}
public function materials(Request $request): View
/**
* Film oder Material im Zusammenhang seines Programms oder Moduls. Die Seite zeigt nur Stellen, die in der
* angezeigten Fassung des Programms stehen; die Wiedergabe- und Downloadadressen kommen aus DecideAccess.
*/
public function content(Request $request, Composition $composition, int $version): View|Response
{
return view('member.materials', [
'grants' => $this->grantQuery($request)->with('article.currentRelease.contents.elementVersion.element')->get(),
]);
$data = app(LibraryCatalog::class)->content($request->user(), $composition, $version);
abort_if($data === null, 404);
return response()->view('member.content', $data, $data['allowed'] ? 200 : 403);
}
/** Die frühere Seite „Materialien“ ist ein Filter der Bibliothek (eine Navigation statt zwei). */
public function materials(): RedirectResponse
{
return redirect()->route('member.library', ['art' => 'material']);
}
public function grants(Request $request): View
{
$entries = app(MemberLicenses::class)->overview($request->user());
$filter = in_array($request->query('status'), ['aktiv', 'inaktiv'], true) ? (string) $request->query('status') : 'alle';
return view('member.grants', [
'grants' => $this->grantQuery($request)->get(),
'entries' => match ($filter) {
'aktiv' => $entries->where('active', true)->values(),
'inaktiv' => $entries->where('active', false)->values(),
default => $entries,
},
'filter' => $filter,
'counts' => [
'aktiv' => $entries->where('active', true)->count(),
'inaktiv' => $entries->where('active', false)->count(),
'alle' => $entries->count(),
],
]);
}
/** Eine einzelne Berechtigung. Nur eigene (oder die der eigenen Organisation mit Bestellrecht); sonst nicht gefunden. */
public function grant(Request $request, Grant $grant): View
{
abort_unless(
Grant::query()->usableBy($request->user())->whereKey($grant->id)->exists(),
404,
);
return view('member.grant', app(MemberLicenses::class)->detail($request->user(), $grant));
}
public function show(Request $request, LicenseArticle $article): View
{
$release = $article->currentRelease()->with('contents.elementVersion.element.pillars')->first();
@@ -219,6 +232,7 @@ public function show(Request $request, LicenseArticle $article): View
$metadata = is_array($version->metadata) ? $version->metadata : [];
$action = $class === 'film' || $class === 'audio' ? 'streamen' : 'ansehen';
$decision = app(DecideAccess::class)($request->user(), $article, $release, $version, $action);
$download = app(DecideAccess::class)($request->user(), $article, $release, $version, 'laden');
$file = $metadata['file'] ?? null;
$entries[] = [
'content' => $content,
@@ -232,6 +246,15 @@ public function show(Request $request, LicenseArticle $article): View
: null,
'playable' => $decision->allowed && is_string($file) && $file !== '' && ($class === 'film' || $class === 'audio'),
'playback' => app(FilmPlayback::class)->mode($version->id),
'download_url' => $download->allowed
? SignedLink::temporary('member.media', now()->addMinutes(10), [
'article' => $article->id,
'release' => $release->id,
'version' => $version->id,
'action' => 'laden',
'reader' => $request->user()->id,
])
: null,
'pillars' => $version->element->pillars->pluck('name')->all(),
'url' => $decision->allowed
? SignedLink::temporary('member.media', now()->addMinutes(10), [
@@ -352,7 +375,7 @@ public function thumbnail(Request $request, string $kind, int $subject): Streame
*/
private function matches(array $card, string $query): bool
{
$haystack = mb_strtolower(($card['title'] ?? '').' '.($card['summary'] ?? ''));
$haystack = mb_strtolower(($card['title'] ?? '').' '.($card['summary'] ?? '').' '.($card['subject']->search_terms ?? ''));
return str_contains($haystack, mb_strtolower($query));
}
@@ -5,6 +5,7 @@
use App\Domain\Identity\AccountStatus;
use App\Http\Controllers\Controller;
use App\Http\LibraryCatalog;
use App\Http\MemberLicenses;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
@@ -14,11 +15,17 @@ class MemberController extends Controller
public function dashboard(Request $request): View
{
$catalog = app(LibraryCatalog::class)->index($request->user());
$films = array_filter($catalog['materials'], fn (array $card): bool => $card['type'] === 'film');
return view('member.dashboard', [
'programCount' => count($catalog['programs']),
'moduleCount' => count($catalog['modules']),
'materialCount' => count($catalog['materials']),
'programs' => array_slice($catalog['programs'], 0, 4),
'counts' => [
'programm' => count($catalog['programs']),
'modul' => count($catalog['modules']),
'film' => count($films),
'material' => count($catalog['materials']) - count($films),
],
'licenseCount' => app(MemberLicenses::class)->overview($request->user())->where('active', true)->count(),
]);
}