ILIAS  release_7 Revision v7.30-3-g800a261c036
NotificationCenter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27
33{
41
48
53 private $notifications = [];
54
59 {
61 $this->renderer = new NotificationCenterRenderer();
62 }
63
67 public function withNotifications(array $notifications) : self
68 {
69 $clone = clone($this);
70 $clone->notifications = $notifications;
71
72 return $clone;
73 }
74
78 public function getNotifications() : array
79 {
81 }
82
86 public function withSymbol(Symbol $symbol) : hasSymbol
87 {
88 return $this;
89 }
90
94 public function hasSymbol() : bool
95 {
96 return true;
97 }
98
102 public function getSymbol() : Symbol
103 {
104 global $DIC;
105
106 $f = $DIC->ui()->factory();
107 $new = $this->getAmountOfNewNotifications();
108 $old = $this->getAmountOfOldNotifications() - $new;
109 $glyph = $f->symbol()->glyph()->notification()->withCounter($f->counter()->novelty($new));
110 if ($old > 0) {
111 $glyph = $glyph->withCounter($f->counter()->status($old));
112 }
113 return $glyph;
114 }
115
119 public function getPosition() : int
120 {
121 return 1;
122 }
123
127 public function withAmountOfOldNotifications(int $amount) : self
128 {
129 $clone = clone($this);
130 $clone->amount_of_old_notifications = $amount;
131
132 return $clone;
133 }
134
139 public function getAmountOfOldNotifications() : int
140 {
142 }
143
147 public function withAmountOfNewNotifications(int $amount) : self
148 {
149 $clone = clone($this);
150 $clone->amount_of_new_notifications = $amount;
151
152 return $clone;
153 }
154
159 public function getAmountOfNewNotifications() : int
160 {
162 }
163}
An exception for terminatinating execution or to throw for unit testing.
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.
global $DIC
Definition: goto.php:24
This describes a symbol.
Definition: Symbol.php:12
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc