19 declare(strict_types=1);
43 return $this->renderNotification($component, $default_renderer);
44 } elseif ($component instanceof
Group) {
45 return $this->
renderGroup($component, $default_renderer);
46 } elseif ($component instanceof
Standard) {
48 } elseif ($component instanceof
Shy) {
49 return $this->
renderShy($component, $default_renderer);
56 $tpl = $this->
getTemplate(
"tpl.group.html",
true,
true);
57 $title = $component->getTitle();
58 $items = $component->getItems();
61 foreach ($items as $item) {
62 $tpl->setCurrentBlock(
"item");
63 $tpl->setVariable(
"ITEM", $default_renderer->render($item));
64 $tpl->parseCurrentBlock();
68 $tpl->setCurrentBlock(
"title");
69 $tpl->setVariable(
"TITLE", $title);
70 $tpl->parseCurrentBlock();
74 $actions = $component->getActions();
75 if ($actions !==
null) {
76 $tpl->setVariable(
"ACTIONS", $default_renderer->render($actions));
78 $tpl->setVariable(
"ACTIONS",
"");
86 $tpl = $this->
getTemplate(
"tpl.item_standard.html",
true,
true);
88 $this->
renderTitle($component, $default_renderer, $tpl);
93 $color = $component->getColor();
94 if ($color !==
null) {
95 $tpl->setCurrentBlock(
"color");
96 $tpl->setVariable(
"COLOR", $color->asHex());
97 $tpl->parseCurrentBlock();
101 $lead = $component->getLead();
102 $progress = $component->getProgress();
104 if (is_string($lead)) {
105 if ($progress !=
null) {
106 $tpl->setCurrentBlock(
"lead_text_with_progress");
107 $tpl->touchBlock(
"item_with_lead_and_progress");
109 $tpl->setCurrentBlock(
"lead_text");
110 $tpl->touchBlock(
"item_with_lead_only");
112 $tpl->setVariable(
"LEAD_TEXT", $lead);
113 $tpl->parseCurrentBlock();
115 if ($lead instanceof
Image) {
116 if ($progress !=
null) {
117 $tpl->setCurrentBlock(
"lead_image_with_progress");
118 $tpl->touchBlock(
"item_with_lead_and_progress");
120 $tpl->setCurrentBlock(
"lead_image");
121 $tpl->touchBlock(
"item_with_lead_only");
123 $tpl->setVariable(
"LEAD_IMAGE", $default_renderer->render($lead));
124 $tpl->parseCurrentBlock();
126 if ($lead instanceof
Icon || $lead instanceof
Avatar) {
127 $tpl->setCurrentBlock(
"lead_icon");
128 $tpl->setVariable(
"LEAD_ICON", $default_renderer->render($lead));
129 $tpl->parseCurrentBlock();
130 $tpl->setCurrentBlock(
"lead_start_icon");
131 $tpl->parseCurrentBlock();
133 $tpl->setCurrentBlock(
"lead_start");
134 $tpl->parseCurrentBlock();
136 if ($progress !=
null && ($lead instanceof
Icon || $lead instanceof Avatar)) {
137 $tpl->setCurrentBlock(
"progress_end_with_lead_icon");
138 $tpl->setVariable(
"PROGRESS", $default_renderer->render($progress));
139 $tpl->parseCurrentBlock();
140 } elseif ($progress !=
null) {
141 $tpl->setCurrentBlock(
"progress_end");
142 $tpl->setVariable(
"PROGRESS", $default_renderer->render($progress));
143 $tpl->parseCurrentBlock();
145 $tpl->touchBlock(
"lead_end");
147 } elseif ($progress !=
null) {
148 $tpl->touchBlock(
"item_with_progress_only");
149 $tpl->setCurrentBlock(
"progress_end");
150 $tpl->setVariable(
"PROGRESS", $default_renderer->render($progress));
151 $tpl->parseCurrentBlock();
155 $main_action = $component->getMainAction();
156 if ($main_action !==
null) {
157 $tpl->setCurrentBlock(
"main_action");
158 $tpl->setVariable(
"MAIN_ACTION", $default_renderer->render($main_action));
159 $tpl->parseCurrentBlock();
163 $actions = $component->getActions();
164 if ($actions !==
null) {
165 $tpl->setCurrentBlock(
"actions");
166 $tpl->setVariable(
"ACTIONS", $default_renderer->render($actions));
167 $tpl->parseCurrentBlock();
175 $tpl = $this->
getTemplate(
"tpl.item_shy.html",
true,
true);
177 $this->
renderTitle($component, $default_renderer, $tpl);
180 if ($component->getProperties() !== []) {
181 foreach ($component->getProperties() as $name => $value) {
182 $name = htmlentities($name);
184 $value = $default_renderer->render($value);
186 $value = htmlentities($value);
188 $tpl->setCurrentBlock(
"property_row");
189 $tpl->setVariable(
"PROP_NAME_A", $name);
190 $tpl->setVariable(
"PROP_VAL_A", $value);
191 $tpl->parseCurrentBlock();
193 $tpl->setCurrentBlock(
"properties");
194 $tpl->parseCurrentBlock();
197 if ($component->getLeadIcon() !==
null) {
198 $tpl->setCurrentBlock(
"lead_icon");
199 $tpl->setVariable(
"LEAD_ICON", $default_renderer->render($component->getLeadIcon()));
200 $tpl->parseCurrentBlock();
203 if ($component->getClose() !==
null) {
204 $tpl->setCurrentBlock(
"close");
205 $tpl->setVariable(
"CLOSE", $default_renderer->render($component->getClose()));
206 $tpl->parseCurrentBlock();
210 $tpl->setCurrentBlock(
"id");
212 $tpl->parseCurrentBlock();
220 $tpl = $this->
getTemplate(
"tpl.item_notification.html",
true,
true);
221 $this->
renderTitle($component, $default_renderer, $tpl);
223 if (!is_null($desc) && trim($desc) !=
"") {
224 $tpl->setCurrentBlock(
"desc");
225 $tpl->setVariable(
"DESC", $desc);
226 $tpl->parseCurrentBlock();
229 $tpl->setVariable(
"LEAD_ICON", $default_renderer->render($component->
getLeadIcon()));
233 if ($actions !==
null) {
234 $tpl->setVariable(
"ACTIONS", $default_renderer->render($actions));
239 $tpl->setCurrentBlock(
"additional_content");
240 $tpl->setVariable(
"ADDITIONAL_CONTENT", $default_renderer->render($component->
getAdditionalContent()));
241 $tpl->parseCurrentBlock();
246 $aggregates_html = $default_renderer->render(
258 $component = $component->withAdditionalOnLoadCode(
259 fn(
$id) =>
"il.UI.item.notification.getNotificationItemObject($('#$id')).registerAggregates($toggleable);" 265 $tpl->setCurrentBlock(
"aggregate_notifications");
266 $tpl->setVariable(
"AGGREGATES", $aggregates_html);
267 $tpl->setVariable(
"PARENT_ID", $item_id);
268 $tpl->parseCurrentBlock();
276 $close_action = $this->
getUIFactory()->button()->close()->withAdditionalOnLoadCode(
277 fn(
$id) =>
"il.UI.item.notification.getNotificationItemObject($('#$id')).registerCloseAction('$url',1);" 279 $tpl->setVariable(
"CLOSE_ACTION", $default_renderer->render($close_action));
282 $tpl->setCurrentBlock(
"id");
283 $tpl->setVariable(
'ID', $item_id);
284 $tpl->parseCurrentBlock();
292 if ($title instanceof
Button\
Shy || $title instanceof
Link) {
293 $title = $default_renderer->render($title);
295 $title = htmlentities($title);
304 if (!is_null($desc) && trim($desc) !=
"") {
317 $audio = $component->getAudioPlayer();
318 if (!is_null($audio)) {
320 $tpl->
setVariable(
"AUDIO", $default_renderer->render($audio));
328 if (count($props) > 0) {
330 foreach ($props as $name => $value) {
331 $name = htmlentities($name);
333 $value = $default_renderer->render($value);
363 parent::registerResources($registry);
364 $registry->
register(
'assets/js/notification.js');
Registry for resources required by rendered output like Javascript or CSS.
getTitle()
Gets the title of the item.
getActions()
Get the actions of the item.
renderGroup(Group $component, RendererInterface $default_renderer)
getAggregateNotifications()
Get the list of Notification Items, this Notification Item aggregates or an empty list...
getAdditionalContent()
Get the additional content of the item or null.
renderShy(Shy $component, RendererInterface $default_renderer)
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $id)
Get a text from the language file.
renderAudioPlayer(Item $component, RendererInterface $default_renderer, Template $tpl)
renderTitle(Item $component, RendererInterface $default_renderer, Template $tpl)
setCurrentBlock(string $name)
Set the block to work on.
notification()
description: > Example for rendring a notification glyph.
back()
description: > Example for rendring a back glyph.
setVariable(string $name, $value)
Set a variable in the current block.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This describes how a letter or a picture avatar could be modified during construction of UI...
render(Component $component, RendererInterface $default_renderer)
Common interface to all items.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
getOnLoadCode()
Get the currently bound on load code.
renderStandard(Item $component, RendererInterface $default_renderer)
cannotHandleComponent(Component $component)
This method MUST be called by derived component renderers, if.
getDescription()
Get the description of the item.
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.
register(string $name)
Add a dependency.
renderDescription(Item $component, Template $tpl)
parseCurrentBlock()
Parse the block that is currently worked on.
getProperties()
Get the properties of the appointment.
renderProperties(Item $component, RendererInterface $default_renderer, Template $tpl)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getCloseAction()
Get the url attached to this Notification Item.
getUIFactory()
Get a UI factory.
Base class for all component renderers.
getLeadIcon()
Get icon as lead.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.