ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
Notification.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2019 Timon Amstutz <timon.amstutz@ilub.unibe.ch> Extended GPL, see docs/LICENSE */
3
5
6use ILIAS\UI\Component\Item\Notification as INotification;
7use \ILIAS\UI\Component\Legacy\Legacy;
10
11class Notification extends Item implements INotification, IJavaScriptBindable
12{
17 protected $additional_content = null;
21 protected $lead_icon;
25 protected $close_action;
30
35 public function __construct($title, \ILIAS\UI\Component\Symbol\Icon\Icon $icon)
36 {
37 $this->lead_icon = $icon;
39 }
40
44 public function withAdditionalContent(Legacy $additional_content) : INotification
45 {
46 $clone = clone $this;
47 $clone->additional_content = $additional_content;
48 return $clone;
49 }
50
54 public function getAdditionalContent() : ?Legacy
55 {
57 }
58
62 public function withCloseAction(string $url) : INotification
63 {
64 $clone = clone $this;
65 $clone->close_action = $url;
66 return $clone;
67 }
68
72 public function getCloseAction() : ?string
73 {
75 }
76
80 public function withAggregateNotifications(array $aggregate_notifications) : INotification
81 {
82 $classes = [
83 INotification::class
84 ];
85 $this->checkArgListElements("Notification Item", $aggregate_notifications, $classes);
86 $clone = clone $this;
87 $clone->aggregate_notifications = $aggregate_notifications;
88 return $clone;
89 }
90
94 public function getAggregateNotifications() : array
95 {
97 }
98
102 public function withLeadIcon(\ILIAS\UI\Component\Symbol\Icon\Icon $icon) : INotification
103 {
104 $clone = clone $this;
105 $clone->lead_icon = $icon;
106 return $clone;
107 }
108
112 public function getLeadIcon() : \ILIAS\UI\Component\Symbol\Icon\Icon
113 {
114 return $this->lead_icon;
115 }
116}
An exception for terminatinating execution or to throw for unit testing.
Common interface to all items.
Definition: Item.php:14
withLeadIcon(\ILIAS\UI\Component\Symbol\Icon\Icon $icon)
__construct($title, \ILIAS\UI\Component\Symbol\Icon\Icon $icon)
getLeadIcon()
Get icon as lead.Note that Notifications only accept Icons as lead, this is different from the standa...
getAdditionalContent()
Get the additional content of the item or null.
withAggregateNotifications(array $aggregate_notifications)
Get an Notification Item like this, but with a set of Notifications, this Notification Item will aggr...
getAggregateNotifications()
Get the list of Notification Items, this Notification Item aggregates or an empty list....
getCloseAction()
Get the url attached to this Notification Item.
withCloseAction(string $url)
Get an Item like this with an url to consulted async, when to close button is pressed....
withAdditionalContent(Legacy $additional_content)
Get a Notification Item like this but with additional content bellow the description....
A component is the most general form of an entity in the UI.
Definition: Component.php:14
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
checkArgListElements($which, array &$values, $classes)
Check every element of the list if it is an instance of one of the given classes.
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
$url