Pflege Übungen im Aufbauarbeitsplatz und weise Verwendung und Sperrfolgen nach
CI Feature / test (push) Successful in 2m34s
CI Feature / test (push) Successful in 2m34s
Eigener Eintrag Übungen unter Inhalte (Bestand, Anlegen, gemeinsamer Aufbau mit Varianten, Verwendung und Variantenauswahl im Modul und Programm), Verwendungsnachweis über verschachtelte und ältere Stände, Auswirkungsbericht einer Mediensperre, gesperrte Bestandteile verhindern die Angebotsaktivierung, Vorschaubilder gesperrter Medien werden nicht mehr ausgeliefert, Rückfalltest gegen die Daten des neuen Stands. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d1f97a351a
commit
bbee288e69
22 files changed
+1104
-26
No files matched your search
@@ -5,11 +5,13 @@
|
||||
use App\Domain\Catalog\ArticleRelease;
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionDisplayRelease;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\CompositionStructureReader;
|
||||
use App\Domain\Catalog\CompositionVersion;
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\EditorialProfileReader;
|
||||
use App\Domain\Catalog\ExerciseGuide;
|
||||
use App\Domain\Catalog\ReleaseStatus;
|
||||
use App\Domain\Catalog\StructureNode;
|
||||
use App\Domain\Entitlement\DecideAccess;
|
||||
@@ -389,7 +391,7 @@ private function present(User $user, StructureNode $node, bool $full, int $rootI
|
||||
'view_url' => $view,
|
||||
'poster_url' => $poster,
|
||||
'download_url' => $download,
|
||||
'program_url' => $this->programUrl($node),
|
||||
'program_url' => $this->exerciseUrl($user, $rootId, $node) ?? $this->programUrl($node),
|
||||
'composition_id' => $node->compositionId,
|
||||
'element_id' => $node->contentElementId,
|
||||
'version_id' => $node->contentElementVersionId,
|
||||
@@ -491,6 +493,46 @@ private function element(int $id): ?ContentElement
|
||||
return $this->elements[$id];
|
||||
}
|
||||
|
||||
/**
|
||||
* Eine Übung im Zusammenhang des erworbenen Moduls oder Programms: die im Stand gebundene Fassung und ihre Varianten,
|
||||
* nicht die jeweils neueste Fassung der Übung. Gefunden wird der jüngste auslieferbare Stand des Kontos, dessen
|
||||
* festgeschriebene Wurzel diese Fassung an einer Stelle einbindet.
|
||||
*/
|
||||
private function exerciseUrl(User $user, int $rootId, StructureNode $node): ?string
|
||||
{
|
||||
if ($node->compositionVersionId === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$nested = CompositionVersion::query()->with('composition')->find($node->compositionVersionId);
|
||||
|
||||
if ($nested?->composition?->kind !== CompositionKind::Exercise) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$guide = app(ExerciseGuide::class);
|
||||
|
||||
foreach ($this->grants($user) as $grant) {
|
||||
$releases = ArticleRelease::query()
|
||||
->where('license_article_id', $grant->license_article_id)
|
||||
->whereIn('status', [ReleaseStatus::Veroeffentlicht, ReleaseStatus::AbgeloestVerfuegbar])
|
||||
->whereHas('rootCompositionVersion', fn ($query) => $query->where('composition_id', $rootId))
|
||||
->with('rootCompositionVersion')
|
||||
->orderByDesc('number')
|
||||
->get();
|
||||
|
||||
foreach ($releases as $release) {
|
||||
$path = $guide->pathTo($release->rootCompositionVersion, $nested->id);
|
||||
|
||||
if ($path !== null) {
|
||||
return route('member.exercise', ['article' => $grant->license_article_id, 'release' => $release->id, 'path' => $path]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function programUrl(StructureNode $node): ?string
|
||||
{
|
||||
if ($node->compositionId === null || $node->compositionVersionId === null) {
|
||||
|
||||
Reference in new issue
Block a user