52 $ui_factory = $this->dic->ui()->factory();
54 $title = $ui_factory->link()->standard($this->
txt(
'background_tasks'),
'#');
55 $icon = $ui_factory->symbol()->icon()->standard(
'bgtk', $this->
txt(
'background_tasks'));
57 return $this->dic->ui()->factory()
59 ->notification($title, $icon)
70 $persistence = $this->dic->backgroundTasks()->persistence();
72 $observer_ids = $persistence->getBucketIdsOfUser($this->dic->user()->getId(),
'id',
'DESC');
73 foreach ($persistence->loadBuckets($observer_ids) as $observer) {
83 $redirect_uri =
"//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
85 $f = $this->dic->ui()->factory();
90 $icon =
$f->symbol()->icon()->standard(
"bgtk", $this->
txt(
"bg_task"));
94 $actions = $this->getUserInteractionContent($observer, $redirect_uri);
95 $primary_action = array_pop($actions);
96 if ($primary_action instanceof
Button) {
97 $title = $primary_action->withLabel($title);
99 $item =
$f->item()->notification($title, $icon);
107 $item = $item->withActions(
$f->dropdown()->standard($actions));
108 $input = $current_task->getInput();
109 $message = $current_task->getMessage($input);
112 $item = $item->withDescription(
$message);
114 $item = $item->withAdditionalContent($this->
getProgressbar($observer));
117 return $item->withCloseAction(
122 $item =
$f->item()->notification($title, $icon);
127 $item = $item->withAdditionalOnLoadCode(fn(
$id):
string =>
"var notification_item = il.UI.item.notification.getNotificationItemObject($('#$id'));
128 il.BGTask.refreshItem(notification_item,'$url');");
132 if ($possibly_failed) {
133 $item = $item->withDescription($this->
txt(
'task_might_be_failed'));
134 $item = $item->withCloseAction(
153 public function getUserInteractionContent(
Bucket $observer,
string $redirect_uri): array
155 $factory = $this->dic->ui()->factory();
156 $language = $this->dic->language();
157 $persistence = $this->dic->backgroundTasks()->persistence();
158 $ctrl = $this->dic->ctrl();
161 return [$factory->legacy()->content(
'')];
165 $options = $userInteraction->getOptions($userInteraction->getInput());
168 function (
Option $option) use ($ctrl, $factory, $observer, $persistence, $redirect_uri, $language):
Shy {
169 $ctrl->setParameterByClass(
170 ControllerGUI::class,
174 $ctrl->setParameterByClass(
175 ControllerGUI::class,
179 $ctrl->setParameterByClass(
180 ControllerGUI::class,
182 $persistence->getBucketContainerId($observer)
184 $this->addFromUrlToNextRequest($redirect_uri);
186 return $factory->button()
202 case ($percentage === 100):
204 $content = $this->dic->language()->txt(
"completed");
208 $content = $this->dic->language()->txt(
"waiting");
212 $content =
"{$percentage}%";
216 return $this->dic->ui()->factory()->legacy()->content(
" <div class='progress'>
217 <div class='progress-bar progress-bar-striped {$running}' role='progressbar' aria-valuenow='{$percentage}'
218 aria-valuemin='0' aria-valuemax='100' style='width:{$percentage}%'>
227 $ctrl = $this->dic->ctrl();
228 $persistence = $this->dic->backgroundTasks()->persistence();
252 $ctrl = $this->dic->ctrl();
253 $persistence = $this->dic->backgroundTasks()->persistence();
268 return $this->dic->language()->txt(
$id);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
const CMD_USER_INTERACTION
const CMD_GET_REPLACEMENT_ITEM
getItemForObserver(Bucket $observer)
getRefreshUrl(Bucket $observer)
getDefaultCardContent(Bucket $observer)
__construct(protected Container $dic)
addFromUrlToNextRequest(string $redirect_uri)
getProgressbar(Bucket $observer)
getCloseButtonAction(Option $option, string $redirect_uri, Bucket $observer)
getNotificationItem(int $nr_buckets)
Get the Notification Items.
Customizing of pimple-DIC for ILIAS.
getLastHeartbeat()
When was the last time that something happened on this bucket?
getExpectedTimeOfTaskInSeconds()
withDescription(string $description)
Create a new item with an attached description.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...