ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
StandardNotificationGroup.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25use ILIAS\UI\Factory as UIFactory;
26
33{
37 private array $notifications = [];
38
42 protected string $title = "";
43
44 public function withTitle(string $title): self
45 {
46 $clone = clone $this;
47 $clone->title = $title;
48
49 return $clone;
50 }
51
55 public function getTitle(): string
56 {
57 return $this->title;
58 }
59
60 public function addNotification(StandardNotification $notification): self
61 {
62 $this->notifications[] = $notification;
63
64 return $this;
65 }
66
70 public function getNotifications(): array
71 {
73 }
74
78 public function getNotificationsCount(): int
79 {
80 return count($this->notifications);
81 }
82
86 public function getOldNotificationsCount(): int
87 {
88 $count = 0;
89 foreach ($this->notifications as $notification) {
90 $count += $notification->getOldAmount();
91 }
92 return $count;
93 }
94
98 public function getNewNotificationsCount(): int
99 {
100 $count = 0;
101 foreach ($this->notifications as $notification) {
102 $count += $notification->getNewAmount();
103 }
104 return $count;
105 }
106
110 #[\Override]
111 public function getRenderer(UIFactory $factory): NotificationRenderer
112 {
113 return new StandardNotificationGroupRenderer($factory);
114 }
115}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Class StandardNotificationGroup Groups a set of Notification.
Class Notification The default Notification mapping currently to one UI Notification Item component.
Interface NotificationRenderer Every Notification should have a renderer, if you won't provide on in ...