diff --git a/components/ILIAS/Dashboard/classes/class.ilDashboardGUI.php b/components/ILIAS/Dashboard/classes/class.ilDashboardGUI.php index 8b7db58c2df0..311a0022699e 100755 --- a/components/ILIAS/Dashboard/classes/class.ilDashboardGUI.php +++ b/components/ILIAS/Dashboard/classes/class.ilDashboardGUI.php @@ -263,11 +263,24 @@ public function show(): void } $content .= $this->getCenterColumnHTML(); + global $DIC; + $content = $DIC->ui()->renderer()->render( + $DIC->ui()->factory()->button()->standard('Notify me!', $this->ctrl->getLinkTarget($this, 'notify')), + ) . $content; + $this->tpl->setContent($content); $this->tpl->setRightContent($this->getRightColumnHTML()); $this->tpl->printToStdout(); } + public function notify(): void + { + $provider = new \ILIAS\Notifications\MyProvider(); + $handler = new \ILIAS\Notifications\Provider\NotificationsPushProvider($provider); + $handler->push($this->user, 'You pushed a button. Congrats!'); + $this->show(); + } + public function getCenterColumnHTML(): string { $ilCtrl = $this->ctrl; diff --git a/components/ILIAS/Notifications/Notifications.php b/components/ILIAS/Notifications/Notifications.php index b1119e2e2b94..32d51cc418cf 100644 --- a/components/ILIAS/Notifications/Notifications.php +++ b/components/ILIAS/Notifications/Notifications.php @@ -49,5 +49,7 @@ public function init( new Component\Resource\OfComponent($this, "receive.mp3", "assets/sounds"); $contribute[Component\Resource\PublicAsset::class] = fn() => new Component\Resource\OfComponent($this, "receive.ogg", "assets/sounds"); + $contribute[\ILIAS\Notifications\Interfaces\PushProviderInterface::class] = fn() => + new \ILIAS\Notifications\MyProvider(); } } diff --git a/components/ILIAS/Notifications/classes/MyProvider.php b/components/ILIAS/Notifications/classes/MyProvider.php new file mode 100644 index 000000000000..432460669bef --- /dev/null +++ b/components/ILIAS/Notifications/classes/MyProvider.php @@ -0,0 +1,42 @@ +