19 declare(strict_types=1);
39 private readonly
string $gui,
40 private readonly
Tile $tile,
42 $assignments_of_user = [ilBadgeAssignment::class,
'getInstancesByUserId']
44 $this->assignments_of_user = Closure::fromCallable($assignments_of_user);
47 public function show(): string
49 $sort =
new Sorting($this->container->http()->request()->getQueryParams()[
'sort'] ??
'');
52 $this->head->show($this->container->language()->txt(
'tile_view'), $this->
sortComponent($sort));
54 return $this->container->ui()->renderer()->render($components);
63 foreach (($this->assignments_of_user)($this->container->user()->getId()) as $assignment) {
64 $badge =
new ilBadge($assignment->getBadgeId());
67 'assignment' => $assignment,
81 $components = array_column($cards_and_modals,
'modal');
84 ->deck(array_column($cards_and_modals,
'card'))
85 ->withNormalCardsSize();
96 return $this->tile->inDeck(
97 $badge_and_assignments[
'badge'],
98 $badge_and_assignments[
'assignment'],
105 $txt = [$this->container->language(),
'txt'];
106 $link = $this->container->ctrl()->getLinkTargetByClass($this->gui,
'listBadges');
107 return $this->container->ui()
111 ->withTargetURL($link,
'sort');
119 private function sort(
Sorting $sort, array $badges_and_assignments): array
121 usort($badges_and_assignments, [$sort,
'compare']);
123 return $badges_and_assignments;
sortComponent(Sorting $sort)
sort(Sorting $sort, array $badges_and_assignments)
Closure $assignments_of_user
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
cardsAndModals(array $badge_and_assignments)
componentsOfBadges(array $badge_and_assignments)
__construct(private readonly Container $container, private readonly string $gui, private readonly Tile $tile, private readonly PresentationHeader $head, $assignments_of_user=[ilBadgeAssignment::class, 'getInstancesByUserId'])