19declare(strict_types=1);
52 $this->
modal = $modal ??
new Modal($this->container);
54 class_exists(ilDateTime::class);
70 $badge_sections[] = $this->
profileButton($badge, $assignment, $gui);
73 $card = $this->
card($content);
75 $image = $this->
image($modal, $badge);
76 $card = $card->withSections($badge_sections)
78 ->withTitleAction(
$modal->getShowSignal());
109 $this->
image($modal, $content->
badge(), $size),
128 return $this->container
132 ->standard($content->
badge()->getTitle())
133 ->withHiddenSections($this->
modal->components($content));
138 return $this->container->ui()->factory()->modal()->lightbox(
139 $this->container->ui()->factory()->modal()->lightboxCardPage($card)
145 $image_src = $this->badge_image_service->getImageFromBadge($badge, $size);
147 return $this->container
151 ->responsive($image_src, $badge->
getTitle())
152 ->withAction(
$modal->getShowSignal());
157 return $this->container
166 $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)
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)
addAssignment(ModalContent $content, ilBadgeAssignment $assignment)
modalContent(ilBadge $badge)
__construct(private readonly Container $container, ?BadgeParent $parent=null, ?Modal $modal=null, ?Closure $format_date=null,)
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.