1 <?php declare(strict_types=1);
29 return $this->
if->identifier($id);
38 0 === (
int) $this->dic->user()->getId() ||
39 $this->dic->user()->isAnonymous() ||
45 $leftIntervalTimestamp = $this->dic->user()->getPref(self::MUTED_UNTIL_PREFERENCE_KEY);
46 $latestRequestTimestamp = null;
50 $openRequests = $relations->filter(
51 function (\
ilBuddySystemRelation $relation) use ($leftIntervalTimestamp, &$latestRequestTimestamp, $relations) :
bool {
54 if ($timeStamp > $latestRequestTimestamp) {
55 $latestRequestTimestamp = $timeStamp;
58 $usrId = $relations->getKey($relation);
64 if (!is_numeric($leftIntervalTimestamp)) {
68 return $timeStamp > $leftIntervalTimestamp;
72 $contactRequestsCount = count($openRequests->getKeys());
73 if ($contactRequestsCount === 0) {
79 $icon = $this->dic->ui()->factory()
84 $title = $this->dic->ui()->factory()
87 $this->dic->language()->txt(
'nc_contact_requests_headline'),
88 $this->dic->ctrl()->getLinkTargetByClass([ilDashboardGUI::class, ilContactGUI::class],
'showContactRequests')
90 $description = sprintf(
91 $this->dic->language()->txt(
92 'nc_contact_requests_number' . (($contactRequestsCount > 1) ?
'_p' :
'_s')
96 $notificationItem = $this->dic->ui()->factory()
98 ->notification($title, $icon)
99 ->withDescription($description)
107 ->standardGroup($this->
getIdentifier(
'contact_bucket_group'))
108 ->withTitle($this->dic->language()->txt(
'nc_contact_requests_headline'))
110 $factory->standard($this->getIdentifier(
'contact_bucket'))
111 ->withNotificationItem($notificationItem)
112 ->withClosedCallable(
114 $this->dic->user()->writePref(self::MUTED_UNTIL_PREFERENCE_KEY, time());
static getInstanceByGlobalUser()
Interface AbstractNotificationProvider.
Interface IdentificationInterface.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Interface NotificationProvider.
Class ilBuddySystemRelation.
static _lookupActive($a_usr_id)
Check user account active.