ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
Notification.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
30 use ILIAS\UI\Component as C;
31 
33 {
35 
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;
53  }
54 
58  public function withAdditionalContent(Content $additional_content): INotification
59  {
60  $clone = clone $this;
61  $clone->additional_content = $additional_content;
62  return $clone;
63  }
64 
68  public function getAdditionalContent(): ?Content
69  {
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  {
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 
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).
withAdditionalContent(Content $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.
getAdditionalContent()
Get the additional content of the item or null.
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
$url
Definition: shib_logout.php:68
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:34
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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
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)
getAggregateNotifications()
Get the list of Notification Items, this Notification Item aggregates or an empty list...