ILIAS  release_7 Revision v7.30-3-g800a261c036
NotificationCenterProvider.php
Go to the documentation of this file.
2
5
12{
16 public function getMetaBarItems() : array
17 {
18 $mb = $this->globalScreen()->metaBar();
19
20 $id = function (string $id) : IdentificationInterface {
21 return $this->if->identifier($id);
22 };
23
24 $nc = $this->dic->globalScreen()->collector()->notifications();
25
26 $new = $nc->getAmountOfNewNotifications();
27 $old = $nc->getAmountOfOldNotifications();
28
29 return [
30 $mb->notificationCenter($id('notification_center'))
31 ->withAmountOfOldNotifications($new + $old)
32 ->withAmountOfNewNotifications($new)
33 ->withNotifications($nc->getNotifications())
34 ->withAvailableCallable(function () : bool {
35 //This is a heavily incomplete fix for: #26586
36 //This should be fixed by the auth service
37 if ($this->dic->ctrl()->getCmd() == "showLogout") {
38 return false;
39 }
40
41 return true;
42 })
43 ->withVisibilityCallable(
44 function () : bool {
45 return (
46 !$this->dic->user()->isAnonymous() &&
47 $this->dic->globalScreen()->collector()->notifications()->hasItems()
48 );
49 }
50 ),
51 ];
52 }
53}
An exception for terminatinating execution or to throw for unit testing.