ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
NotificationCenter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27
32{
39
46
51 private array $notifications = [];
52
56 public function __construct(IdentificationInterface $provider_identification)
57 {
58 parent::__construct($provider_identification);
60 }
61
65 public function withNotifications(array $notifications): self
66 {
67 $clone = clone($this);
68 $clone->notifications = $notifications;
69
70 return $clone;
71 }
72
76 public function getNotifications(): array
77 {
79 }
80
84 public function withSymbol(Symbol $symbol): hasSymbol
85 {
86 return $this;
87 }
88
92 public function hasSymbol(): bool
93 {
94 return true;
95 }
96
100 public function getSymbol(): Symbol
101 {
102 global $DIC;
103
104 $f = $DIC->ui()->factory();
105 $new = $this->getAmountOfNewNotifications();
106 $old = $this->getAmountOfOldNotifications() - $new;
107 $glyph = $f->symbol()->glyph()->notification()->withCounter($f->counter()->novelty($new));
108 if ($old > 0) {
109 return $glyph->withCounter($f->counter()->status($old));
110 }
111 return $glyph;
112 }
113
117 #[\Override]
118 public function getPosition(): int
119 {
120 return 1;
121 }
122
126 public function withAmountOfOldNotifications(int $amount): self
127 {
128 $clone = clone($this);
129 $clone->amount_of_old_notifications = $amount;
130
131 return $clone;
132 }
133
139 {
141 }
142
146 public function withAmountOfNewNotifications(int $amount): self
147 {
148 $clone = clone($this);
149 $clone->amount_of_new_notifications = $amount;
150
151 return $clone;
152 }
153
159 {
161 }
162}
renderer()
getAmountOfNewNotifications()
Get the amount of new notifications.
getAmountOfOldNotifications()
Get the amount of old notifications.
__construct(IdentificationInterface $provider_identification)
@inheritDoc
withAmountOfNewNotifications(int $amount)
Get a Center like this, but with a given amount of new notifications.
withAmountOfOldNotifications(int $amount)
Get a Center like this, but with a given amount of old notifications.
This describes a symbol.
Definition: Symbol.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26