ILIAS  release_7 Revision v7.30-3-g800a261c036
BTNotificationProvider.php
Go to the documentation of this file.
2
7
14{
15
19 public function getNotifications() : array
20 {
21 $nr_buckets = count($this->dic->backgroundTasks()->persistence()->getBucketIdsOfUser($this->dic->user()->getId()));
22 if (!$nr_buckets) {
23 return [];
24 }
25
26 $this->dic->ui()->mainTemplate()->addJavaScript("./Services/BackgroundTasks/js/background_task_refresh.js");
27 $this->dic->language()->loadLanguageModule('background_tasks');
28
29 $id = function (string $id) : IdentificationInterface {
30 return $this->if->identifier($id);
31 };
32
33 $factory = $this->globalScreen()->notifications()->factory();
34
35 $item_source = new ilBTPopOverGUI($this->dic);
36 $group = $factory->standardGroup($id('bg_task_bucket_group'))
37 ->withTitle($this->txt('background_tasks'))
38 ->addNotification(
39 $factory->standard($id('bg_task_bucket'))
40 ->withNotificationItem($item_source->getNotificationItem($nr_buckets))
41 ->withNewAmount(1)
42 );
43
44 return [
45 $group,
46 ];
47 }
48
49
50 private function txt(string $id) : string
51 {
52 return $this->dic->language()->txt($id);
53 }
54}
An exception for terminatinating execution or to throw for unit testing.
Class ilBTPopOverGUI.
$factory
Definition: metadata.php:58