19 declare(strict_types=1);
44 return $this->
if->identifier(
$id);
47 if (0 === $this->dic->user()->getId() || $this->dic->user()->isAnonymous()) {
51 $hasInternalMailAccess = $this->dic->rbac()->system()->checkAccess(
55 if (!$hasInternalMailAccess) {
59 $leftIntervalTimestamp = $this->dic->user()->getPref(self::MUTED_UNTIL_PREFERENCE_KEY);
62 is_numeric($leftIntervalTimestamp) ? (
int) $leftIntervalTimestamp : 0
65 $numberOfNewMessages = $newMailData[
'count'];
66 if (0 === $numberOfNewMessages) {
70 $this->dic->language()->loadLanguageModule(
'mail');
74 $mailUrl =
'ilias.php?baseClass=ilMailGUI';
76 if (1 === $numberOfNewMessages) {
77 $linkText = $this->dic->language()->txt(
'nc_mail_unread_messages_number_s');
80 $this->dic->language()->txt(
'nc_mail_unread_messages_number_p'),
86 $this->dic->language()->txt(
'nc_mail_unread_messages'),
87 $this->dic->ui()->renderer()->render(
88 $this->dic->ui()->factory()
90 ->standard($linkText, $mailUrl)
94 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(
Standard::MAIL,
'mail');
95 $title = $this->dic->ui()->factory()->link()->standard(
96 $this->dic->language()->txt(
'nc_mail_noti_item_title'),
101 $notificationItem = $this->dic->ui()->factory()
103 ->notification($title, $icon)
104 ->withDescription($body);
107 $dateTime = DateTimeImmutable::createFromFormat(
'Y-m-d H:i:s', $newMailData[
'max_time']);
108 $notificationItem = $notificationItem->withProperties([
116 $group =
$factory->standardGroup(
$id(
'mail_bucket_group'))
117 ->withTitle($this->dic->language()->txt(
'mail'))
120 ->withNotificationItem($notificationItem)
121 ->withClosedCallable(
123 $this->dic->user()->writePref(self::MUTED_UNTIL_PREFERENCE_KEY, (
string) time());
Interface AbstractNotificationProvider.
Interface IdentificationInterface.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const MUTED_UNTIL_PREFERENCE_KEY
static getNewMailsData(ilObjUser $user, int $leftInterval=0)
Class MailNotificationProvider.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static getMailObjectRefId()