19 declare(strict_types=1);
34 $lng = $this->dic->language();
35 $ui = $this->dic->ui();
36 $user = $this->dic->user();
37 $ctrl = $this->dic->ctrl();
39 $lng->loadLanguageModule(
"badge");
41 $factory = $this->
globalScreen()->notifications()->factory();
43 return $this->
if->identifier(
$id);
47 if ($new_badges === 0) {
52 $badge_icon = $this->dic->ui()->factory()->symbol()->icon()->standard(
"bdga",
$lng->txt(
"badge_badge"));
53 $badge_title = $ui->factory()->link()->standard(
54 $lng->txt(
"mm_badges"),
55 $ctrl->getLinkTargetByClass([
"ilDashboardGUI"],
"jumpToBadges")
59 $badge_notification_item = $ui->factory()->item()->notification($badge_title, $badge_icon)
60 ->withDescription(str_replace(
"%1", (
string) $new_badges,
$lng->txt(
"badge_new_badges")))
63 $osd_notification_handler =
new ilNotificationOSDHandler(
new ilNotificationOSDRepository($this->dic->database()));
65 $group = $factory->standardGroup(
$id(
'badge_bucket_group'))->withTitle(
$lng->txt(
'badge_badge'))
67 $factory->standard(
$id(
'badge_bucket'))->withNotificationItem($badge_notification_item)
69 function () use ($user, $osd_notification_handler):
void {
71 $noti_repo = new \ILIAS\Badge\Notification\BadgeNotificationPrefRepository($user);
72 $noti_repo->updateLastCheckedTimestamp();
74 $osd_notification_handler->deleteStaleNotificationsForUserAndType(
75 $this->dic->user()->getId(),
76 self::NOTIFICATION_TYPE
80 ->withNewAmount($new_badges)
82 ->withOpenedCallable(
static function () {
final const NOTIFICATION_TYPE
static getNewCounter(int $a_user_id)
Interface IdentificationInterface.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static getLatestTimestamp(int $a_user_id)