ILIAS  trunk Revision v11.0_alpha-2658-ge2404539063
BTNotificationProvider.php
Go to the documentation of this file.
1 <?php
2 
20 
21 use ilBTPopOverGUI;
25 
32 {
36  public function getNotifications(): array
37  {
38  $nr_buckets = count($this->dic->backgroundTasks()->persistence()->getBucketIdsOfUser($this->dic->user()->getId()));
39  if ($nr_buckets === 0) {
40  return [];
41  }
42 
43  $this->dic->ui()->mainTemplate()->addJavaScript("assets/js/background_task_refresh.js");
44  $this->dic->language()->loadLanguageModule('background_tasks');
45 
46  $id = fn(string $id): IdentificationInterface => $this->if->identifier($id);
47 
48  $factory = $this->globalScreen()->notifications()->factory();
49 
50  $item_source = new ilBTPopOverGUI($this->dic);
51  $group = $factory->standardGroup($id('bg_task_bucket_group'))
52  ->withTitle($this->txt('background_tasks'))
53  ->addNotification(
54  $factory->standard($id('bg_task_bucket'))
55  ->withNotificationItem($item_source->getNotificationItem($nr_buckets))
56  ->withNewAmount(1)
57  );
58 
59  return [
60  $group,
61  ];
62  }
63 
64 
65  private function txt(string $id): string
66  {
67  return $this->dic->language()->txt($id);
68  }
69 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23