19declare(strict_types=1);
52 $sign_file = [ilWACSignedPath::class,
'signFile'],
56 $this->
modal = $modal ??
new Modal($this->container);
57 $this->sign_file = Closure::fromCallable(
$sign_file);
59 class_exists(ilDateTime::class);
75 $badge_sections[] = $this->
profileButton($badge, $assignment, $gui);
78 $card = $this->
card($content);
80 $image = $this->
image($modal, $badge);
81 $card = $card->withSections($badge_sections)
83 ->withTitleAction(
$modal->getShowSignal());
112 $this->
image($modal, $content->
badge(), $size),
130 return $this->container
134 ->standard($content->
badge()->getTitle())
135 ->withHiddenSections($this->
modal->components($content));
140 return $this->container->ui()->factory()->modal()->lightbox(
141 $this->container->ui()->factory()->modal()->lightboxCardPage($card)
147 $image_src = $this->badge_image_service->getImageFromBadge($badge, $size);
148 return $this->container
152 ->responsive($image_src, $badge->
getTitle())
153 ->withAction(
$modal->getShowSignal());
158 return $this->container
167 $awarded_by = $this->parent->asProperty($badge);
170 ...($awarded_by !==
null ? [$this->txt(
'awarded_by') => $awarded_by] : []),
183 $this->
txt(
'badge_issued_on') => ($this->format_date)($assignment->
getTimestamp()),
187 private function txt(
string $key): string
189 return $this->container->language()->txt($key);
195 return $this->
txt(
'endless');
209 $this->container->ctrl()->setParameterByClass($gui,
'badge_id', $badge->
getId());
211 $url = $this->container->ctrl()->getLinkTargetByClass(
213 $active ?
'deactivateInCard' :
'activateInCard'
216 $this->container->ctrl()->setParameterByClass($gui,
'badge_id',
'');
218 return $this->container->ui()->factory()->button()->standard(
219 $this->
txt($active ?
'badge_remove_from_profile' :
'badge_add_to_profile'),
asComponent(ilBadge $badge)
withAdditionalProperties(array $properties)
title(Component $modal, ilBadge $badge)
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,)
profileButton(ilBadge $badge, ilBadgeAssignment $assignment, string $gui)
asImage(ModalContent $content, int $size=ilBadgeImage::IMAGE_SIZE_M)
image(Component $modal, ilBadge $badge, int $size=ilBadgeImage::IMAGE_SIZE_M)
asTitleWithLeadingImage(ModalContent $content)
inDeck(ilBadge $badge, ilBadgeAssignment $assignment, string $gui)
readonly Closure $sign_file
addAssignment(ModalContent $content, ilBadgeAssignment $assignment)
modalContent(ilBadge $badge)
asTitle(ModalContent $content)
readonly BadgeParent $parent
readonly Closure $format_date
readonly ilBadgeImage $badge_image_service
tryFormating(string $valid)
Customizing of pimple-DIC for ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class for date presentation.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
@classDescription Date and time handling
A component is the most general form of an entity in the UI.