ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
Notification.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
30 use ILIAS\UI\Component as C;
31 
33 {
35 
36  protected ?Legacy $additional_content = null;
37  protected Icon $lead_icon;
38  protected ?string $close_action = null;
39 
43  protected array $aggregate_notifications = [];
44 
49  public function __construct($title, Icon $icon)
50  {
51  $this->lead_icon = $icon;
52  parent::__construct($title);
53  }
54 
58  public function withAdditionalContent(Legacy $additional_content): INotification
59  {
60  $clone = clone $this;
61  $clone->additional_content = $additional_content;
62  return $clone;
63  }
64 
68  public function getAdditionalContent(): ?Legacy
69  {
70  return $this->additional_content;
71  }
72 
76  public function withCloseAction(string $url): INotification
77  {
78  $clone = clone $this;
79  $clone->close_action = $url;
80  return $clone;
81  }
82 
86  public function getCloseAction(): ?string
87  {
88  return $this->close_action;
89  }
90 
94  public function withAggregateNotifications(array $aggregate_notifications): INotification
95  {
96  $classes = [
97  INotification::class
98  ];
99  $this->checkArgListElements("Notification Item", $aggregate_notifications, $classes);
100  $clone = clone $this;
101  $clone->aggregate_notifications = $aggregate_notifications;
102  return $clone;
103  }
104 
108  public function getAggregateNotifications(): array
109  {
110  return $this->aggregate_notifications;
111  }
112 
116  public function withLeadIcon(Icon $icon): INotification
117  {
118  $clone = clone $this;
119  $clone->lead_icon = $icon;
120  return $clone;
121  }
122 
126  public function getLeadIcon(): Icon
127  {
128  return $this->lead_icon;
129  }
130 
134  public function withActions(C\Dropdown\Standard $actions): C\Item\Notification
135  {
136  $clone = clone $this;
137  $clone->actions = $actions;
138  return $clone;
139  }
140 
144  public function getActions(): ?C\Dropdown\Standard
145  {
146  return $this->actions;
147  }
148 }
withCloseAction(string $url)
Get an Item like this with an url to consulted async, when to close button is pressed.With this url, information may be stored persistently in the DB without interrupting the workflow of the user (e.g. setting a flag, that the message was consulted).
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAdditionalContent()
Get the additional content of the item or null.
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
withAdditionalContent(Legacy $additional_content)
Get a Notification Item like this but with additional content bellow the description.Note this should only be used, if the content section needs to hold legacy content that currently does not have a place in the UI components.
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:34
getLeadIcon()
Get icon as lead.Note that Notifications only accept Icons as lead, this is different from the standa...
Common interface to all items.
Definition: Item.php:31
This describes a standard button.
Definition: Standard.php:26
withAggregateNotifications(array $aggregate_notifications)
Get an Notification Item like this, but with a set of Notifications, this Notification Item will aggr...
getCloseAction()
Get the url attached to this Notification Item.
__construct(Container $dic, ilPlugin $plugin)
$url
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
getAggregateNotifications()
Get the list of Notification Items, this Notification Item aggregates or an empty list...