Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions components/ILIAS/Dashboard/classes/class.ilDashboardGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions components/ILIAS/Notifications/Notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
42 changes: 42 additions & 0 deletions components/ILIAS/Notifications/classes/MyProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\Notifications;

use ILIAS\Notifications\Interfaces\PushProviderInterface;
use ilLanguage;

class MyProvider implements PushProviderInterface
{
public function getIdentifier(): string
{
return 'my_prov1';
}

public function getName(ilLanguage $lng): string
{
return 'Personal Test Provider';
}

public function getDescription(ilLanguage $lng): string
{
return 'This is a personal test provider for presentation purposes';
}
}