- Bilder im Text folgen dem Recht am Text; eine eigene Fähigkeit für Bilder ist nicht nötig (ADR-51, fachliche Entscheidung zur Bestätigung). - Bildadresse und PDF-Adresse des Dokuments laufen nicht ab; jeder Abruf entscheidet neu. - Die Fähigkeit text:laden ist im Rechteprofil wählbar. - Dokumentkapitel in der Medienansicht verweisen auf ihr Dokument; die Pille nennt jetzt auch Dokumentkapitel (MedienFilterDialogTest bewusst angepasst). - Abnahmeprotokoll mit Bildern unter docs/ux/verwaltung/abnahme/dokumente. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
65 lines
2.0 KiB
PHP
65 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Support;
|
|
|
|
use App\Domain\Catalog\OfferVersion;
|
|
|
|
/**
|
|
* Lesbare Bezeichnungen für Katalogangaben, gemeinsam für Listen und Objektseiten (Rechteprofil, Angebot).
|
|
*/
|
|
final class CatalogLabels
|
|
{
|
|
/** Fähigkeiten eines Rechteprofils; dieselben Werte wie im Anlegedialog. */
|
|
public const FAEHIGKEITEN = [
|
|
'film:streamen' => 'Film ansehen',
|
|
'film:laden' => 'Film herunterladen',
|
|
'audio:streamen' => 'Hörstück ansehen',
|
|
'document:ansehen' => 'Dokument ansehen',
|
|
'document:laden' => 'Dokument herunterladen',
|
|
'pdf:ansehen' => 'PDF ansehen',
|
|
'pdf:laden' => 'PDF herunterladen',
|
|
'text:ansehen' => 'Text ansehen',
|
|
'text:laden' => 'Text als PDF herunterladen (Übung, Dokument)',
|
|
'bild:ansehen' => 'Bild ansehen',
|
|
];
|
|
|
|
/**
|
|
* @param array<string, mixed>|null $capabilities ['film' => ['streamen'], …]
|
|
* @return list<string>
|
|
*/
|
|
public static function faehigkeiten(?array $capabilities): array
|
|
{
|
|
$labels = [];
|
|
|
|
foreach ($capabilities ?? [] as $class => $actions) {
|
|
foreach ((array) $actions as $action) {
|
|
$labels[] = self::FAEHIGKEITEN[$class.':'.$action] ?? $class.': '.$action;
|
|
}
|
|
}
|
|
|
|
return $labels;
|
|
}
|
|
|
|
public static function zweck(?string $purpose): string
|
|
{
|
|
return match ((string) $purpose) {
|
|
'ehrenamtlich' => 'Ehrenamtlich',
|
|
'kommerziell' => 'Kommerziell',
|
|
'institutionell' => 'Institutionell',
|
|
default => (string) $purpose,
|
|
};
|
|
}
|
|
|
|
public static function vergabe(OfferVersion $version): string
|
|
{
|
|
$kind = match ($version->grant_kind) {
|
|
'kauf' => 'Kauf',
|
|
'auf_abruf' => 'Auf Abruf',
|
|
'bei_registrierung' => 'Bei Registrierung',
|
|
default => (string) $version->grant_kind,
|
|
};
|
|
|
|
return $version->price_cents === null ? $kind : $kind.' · '.number_format($version->price_cents / 100, 2, ',', '.').' €';
|
|
}
|
|
}
|