ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
BTNotificationProvider.php
Go to the documentation of this file.
1 <?php
19 
20 use ilBTPopOverGUI;
24 
31 {
35  public function getNotifications(): array
36  {
37  $nr_buckets = count($this->dic->backgroundTasks()->persistence()->getBucketIdsOfUser($this->dic->user()->getId()));
38  if ($nr_buckets === 0) {
39  return [];
40  }
41 
42  $this->dic->ui()->mainTemplate()->addJavaScript("./Services/BackgroundTasks/js/background_task_refresh.js");
43  $this->dic->language()->loadLanguageModule('background_tasks');
44 
45  $id = fn (string $id): IdentificationInterface => $this->if->identifier($id);
46 
47  $factory = $this->globalScreen()->notifications()->factory();
48 
49  $item_source = new ilBTPopOverGUI($this->dic);
50  $group = $factory->standardGroup($id('bg_task_bucket_group'))
51  ->withTitle($this->txt('background_tasks'))
52  ->addNotification(
53  $factory->standard($id('bg_task_bucket'))
54  ->withNotificationItem($item_source->getNotificationItem($nr_buckets))
55  ->withNewAmount(1)
56  );
57 
58  return [
59  $group,
60  ];
61  }
62 
63 
64  private function txt(string $id): string
65  {
66  return $this->dic->language()->txt($id);
67  }
68 }
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
$factory
Definition: metadata.php:75