19 declare(strict_types=1);
51 $sign_file = [ilWACSignedPath::class,
'signFile'],
54 $this->parent = $parent ??
new BadgeParent($this->container);
55 $this->
modal = $modal ??
new Modal($this->container);
56 $this->sign_file = Closure::fromCallable($sign_file);
58 class_exists(ilDateTime::class);
59 $format_date =
static fn($date,
int $format =
IL_CAL_UNIX):
string => (
71 $parent = $this->parent->asComponent($badge);
72 $badge_sections = $parent ? [
$parent] : [];
73 $badge_sections[] = $this->
profileButton($badge, $assignment, $gui);
76 $card = $this->
card($content);
77 $modal = $this->
modal($card);
78 $image = $this->
image($modal, $badge);
79 $card = $card->withSections($badge_sections)
81 ->withTitleAction($modal->getShowSignal());
94 $modal = $this->
modal($this->
card($content));
106 $modal = $this->
modal($this->
card($content));
116 return $this->container
120 ->standard($content->
badge()->getTitle())
121 ->withHiddenSections($this->
modal->components($content));
126 return $this->container->ui()->factory()->modal()->lightbox(
127 $this->container->ui()->factory()->modal()->lightboxCardPage($card)
133 return $this->container->ui()
137 ->withAction($modal->getShowSignal());
142 return $this->container->ui()
145 ->shy($badge->
getTitle(), $modal->getShowSignal());
150 $awarded_by = $this->parent->asProperty($badge);
153 ...(null !== $awarded_by ? [$this->
txt(
'awarded_by') => $awarded_by] : []),
166 $this->
txt(
'issued_on') => ($this->format_date)($assignment->
getTimestamp()),
172 return $this->container->language()->txt($key);
178 return $this->
txt(
'endless');
191 $this->container->ctrl()->setParameterByClass($gui,
'badge_id', $badge->
getId());
193 $url = $this->container->ctrl()->getLinkTargetByClass(
195 $active ?
'deactivateInCard' :
'activateInCard' 198 $this->container->ctrl()->setParameterByClass($gui,
'badge_id',
'');
200 return $this->container->ui()->factory()->button()->standard(
201 $this->
txt($active ?
'badge_remove_from_profile' :
'badge_add_to_profile'),
asImage(ModalContent $content)
addAssignment(ModalContent $content, ilBadgeAssignment $assignment)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
asTitle(ModalContent $content)
Customizing of pimple-DIC for ILIAS.
modalContent(ilBadge $badge)
image(Component $modal, ilBadge $badge)
tryFormating(string $valid)
getImagePath(bool $a_full_path=true)
readonly Closure $sign_file
profileButton(ilBadge $badge, ilBadgeAssignment $assignment, string $gui)
readonly Closure $format_date
readonly BadgeParent $parent
modalContentWithAssignment(ilBadge $badge, ilBadgeAssignment $assignment)
card(ModalContent $content)
__construct(private readonly Container $container, BadgeParent $parent=null, Modal $modal=null, $sign_file=[ilWACSignedPath::class, 'signFile'], Closure $format_date=null,)
withAdditionalProperties(array $properties)
inDeck(ilBadge $badge, ilBadgeAssignment $assignment, string $gui)
title(Component $modal, ilBadge $badge)