19 declare(strict_types=1);
45 return $this->renderNotification($component, $default_renderer);
46 } elseif ($component instanceof
Group) {
47 return $this->
renderGroup($component, $default_renderer);
48 } elseif ($component instanceof
Standard) {
50 } elseif ($component instanceof
Shy) {
51 return $this->
renderShy($component, $default_renderer);
58 $tpl = $this->
getTemplate(
"tpl.group.html",
true,
true);
63 foreach ($items as $item) {
64 $tpl->setCurrentBlock(
"item");
65 $tpl->setVariable(
"ITEM", $default_renderer->render($item));
66 $tpl->parseCurrentBlock();
70 $tpl->setCurrentBlock(
"title");
71 $tpl->setVariable(
"TITLE", $title);
72 $tpl->parseCurrentBlock();
77 if ($actions !== null) {
78 $tpl->setVariable(
"ACTIONS", $default_renderer->render($actions));
80 $tpl->setVariable(
"ACTIONS",
"");
88 $tpl = $this->
getTemplate(
"tpl.item_standard.html",
true,
true);
90 $this->
renderTitle($component, $default_renderer, $tpl);
95 $color = $component->getColor();
96 if ($color !== null) {
97 $tpl->setCurrentBlock(
"color");
98 $tpl->setVariable(
"COLOR", $color->asHex());
99 $tpl->parseCurrentBlock();
103 $lead = $component->getLead();
104 $progress = $component->getProgress();
106 if (is_string($lead)) {
107 if ($progress != null) {
108 $tpl->setCurrentBlock(
"lead_text_with_progress");
109 $tpl->touchBlock(
"item_with_lead_and_progress");
111 $tpl->setCurrentBlock(
"lead_text");
112 $tpl->touchBlock(
"item_with_lead_only");
114 $tpl->setVariable(
"LEAD_TEXT", $lead);
115 $tpl->parseCurrentBlock();
117 if ($lead instanceof
Image) {
118 if ($progress != null) {
119 $tpl->setCurrentBlock(
"lead_image_with_progress");
120 $tpl->touchBlock(
"item_with_lead_and_progress");
122 $tpl->setCurrentBlock(
"lead_image");
123 $tpl->touchBlock(
"item_with_lead_only");
125 $tpl->setVariable(
"LEAD_IMAGE", $default_renderer->render($lead));
126 $tpl->parseCurrentBlock();
128 if ($lead instanceof
Icon || $lead instanceof
Avatar) {
129 $tpl->setCurrentBlock(
"lead_icon");
130 $tpl->setVariable(
"LEAD_ICON", $default_renderer->render($lead));
131 $tpl->parseCurrentBlock();
132 $tpl->setCurrentBlock(
"lead_start_icon");
133 $tpl->parseCurrentBlock();
135 $tpl->setCurrentBlock(
"lead_start");
136 $tpl->parseCurrentBlock();
138 if ($progress != null && ($lead instanceof
Icon || $lead instanceof Avatar)) {
139 $tpl->setCurrentBlock(
"progress_end_with_lead_icon");
140 $tpl->setVariable(
"PROGRESS", $default_renderer->render($progress));
141 $tpl->parseCurrentBlock();
142 } elseif ($progress != null) {
143 $tpl->setCurrentBlock(
"progress_end");
144 $tpl->setVariable(
"PROGRESS", $default_renderer->render($progress));
145 $tpl->parseCurrentBlock();
147 $tpl->touchBlock(
"lead_end");
149 } elseif ($progress != null) {
150 $tpl->touchBlock(
"item_with_progress_only");
151 $tpl->setCurrentBlock(
"progress_end");
152 $tpl->setVariable(
"PROGRESS", $default_renderer->render($progress));
153 $tpl->parseCurrentBlock();
157 $main_action = $component->getMainAction();
158 if ($main_action !== null) {
159 $tpl->setCurrentBlock(
"main_action");
160 $tpl->setVariable(
"MAIN_ACTION", $default_renderer->render($main_action));
161 $tpl->parseCurrentBlock();
165 $actions = $component->getActions();
166 if ($actions !== null) {
167 $tpl->setCurrentBlock(
"actions");
168 $tpl->setVariable(
"ACTIONS", $default_renderer->render($actions));
169 $tpl->parseCurrentBlock();
177 $tpl = $this->
getTemplate(
"tpl.item_shy.html",
true,
true);
179 $this->
renderTitle($component, $default_renderer, $tpl);
182 if ($component->getProperties() !== []) {
183 foreach ($component->getProperties() as $name => $value) {
184 $name = htmlentities($name);
186 $value = $default_renderer->render($value);
188 $value = htmlentities($value);
190 $tpl->setCurrentBlock(
"property_row");
191 $tpl->setVariable(
"PROP_NAME_A", $name);
192 $tpl->setVariable(
"PROP_VAL_A", $value);
193 $tpl->parseCurrentBlock();
195 $tpl->setCurrentBlock(
"properties");
196 $tpl->parseCurrentBlock();
199 if ($component->getLeadIcon() !== null) {
200 $tpl->setCurrentBlock(
"lead_icon");
201 $tpl->setVariable(
"LEAD_ICON", $default_renderer->render($component->getLeadIcon()));
202 $tpl->parseCurrentBlock();
205 if ($component->getClose() !== null) {
206 $tpl->setCurrentBlock(
"close");
207 $tpl->setVariable(
"CLOSE", $default_renderer->render($component->getClose()));
208 $tpl->parseCurrentBlock();
212 $tpl->setCurrentBlock(
"id");
214 $tpl->parseCurrentBlock();
222 $tpl = $this->
getTemplate(
"tpl.item_notification.html",
true,
true);
223 $this->
renderTitle($component, $default_renderer, $tpl);
225 if (!is_null($desc) && trim($desc) !=
"") {
226 $tpl->setCurrentBlock(
"desc");
227 $tpl->setVariable(
"DESC", $desc);
228 $tpl->parseCurrentBlock();
231 $tpl->setVariable(
"LEAD_ICON", $default_renderer->render($component->
getLeadIcon()));
235 if ($actions !== null) {
236 $tpl->setVariable(
"ACTIONS", $default_renderer->render($actions));
241 $tpl->setCurrentBlock(
"additional_content");
242 $tpl->setVariable(
"ADDITIONAL_CONTENT", $default_renderer->render($component->
getAdditionalContent()));
243 $tpl->parseCurrentBlock();
248 $aggregates_html = $default_renderer->render(
260 $component = $component->withAdditionalOnLoadCode(
261 fn(
$id) =>
"il.UI.item.notification.getNotificationItemObject($($id)).registerAggregates($toggleable);" 267 $tpl->setCurrentBlock(
"aggregate_notifications");
268 $tpl->setVariable(
"AGGREGATES", $aggregates_html);
269 $tpl->setVariable(
"PARENT_ID", $item_id);
270 $tpl->parseCurrentBlock();
278 $close_action = $this->
getUIFactory()->button()->close()->withAdditionalOnLoadCode(
279 fn(
$id) =>
"il.UI.item.notification.getNotificationItemObject($($id)).registerCloseAction('$url',1);" 281 $tpl->setVariable(
"CLOSE_ACTION", $default_renderer->render($close_action));
284 $tpl->setCurrentBlock(
"id");
285 $tpl->setVariable(
'ID', $item_id);
286 $tpl->parseCurrentBlock();
294 if ($title instanceof
Button\
Shy || $title instanceof
Link) {
295 $title = $default_renderer->render($title);
297 $title = htmlentities($title);
306 if (!is_null($desc) && trim($desc) !=
"") {
319 $audio = $component->getAudioPlayer();
320 if (!is_null($audio)) {
322 $tpl->
setVariable(
"AUDIO", $default_renderer->render($audio));
330 if (count($props) > 0) {
332 foreach ($props as $name => $value) {
333 $name = htmlentities($name);
335 $value = $default_renderer->render($value);
365 parent::registerResources($registry);
366 $registry->
register(
'./src/UI/templates/js/Item/dist/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...
getTitle()
Gets the title of the group.
getAdditionalContent()
Get the additional content of the item or null.
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
renderShy(Shy $component, RendererInterface $default_renderer)
Class ChatMainBarProvider .
This describes how an icon could be modified during construction of UI.
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.
setVariable(string $name, $value)
Set a variable in the current block.
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.
getActions()
Get the actions Dropdown of the group.
getOnLoadCode()
Get the currently bound on load code.
getItems()
Gets item of the group.
renderStandard(Item $component, RendererInterface $default_renderer)
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)
getComponentInterfaceName()
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Base class for all component renderers.
getLeadIcon()
Get icon as lead.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.