HumHub Documentation (unofficial)

NotificationManager
in package

The NotificationManager component is responsible for sending BaseNotifications to Users over different notification targets by using the send and sendBulk function.

A notification target may be disabled for a specific user and will be skipped.

Tags
author

buddha

Table of Contents

Constants

EVENT_SEARCH_MODULE_NOTIFICATIONS  = 'searchModuleNotifications'
Sends the notifications categories in the results
IS_TOUCHED_SETTINGS  = 'is_touched_settings'
User setting name to know if the user has modified default notification settings

Properties

$targets  : array<string|int, mixed>
$_categories  : array<string|int, NotificationCategory>
Cached array of NotificationCategories
$_notifications  : array<string|int, BaseNotification>
$_targets  : array<string|int, BaseTarget>

Methods

getContainerFollowers()  : ActiveQueryUser
Returns all notification followers for the given $container. If $public is set to false only members with send_notifications settings are returned.
getDesktopNoficationSettings()  : int
Determines the enable_html5_desktop_notifications setting either for the given user or global if no user is given.
getFollowers()  : ActiveQueryUser
Returns all notification followers for the given $content instance.
getNonNotificationSpaces()  : array<string|int, Space>
Returns all spaces this user is not following.
getNotificationCategories()  : mixed
Returns all available NotificationCategories as array with category id as key and a category instance as value.
getNotifications()  : array<string|int, BaseNotification>
Returns all available Notifications
getSpaces()  : array<string|int, Space>
Returns all spaces this user is following (including member spaces) with sent_notification setting.
getTarget()  : BaseTarget
Factory function for receiving a target instance for the given class.
getTargets()  : array<string|int, BaseTarget>
Returns all active targets for the given user.
hasSpace()  : bool
Check if notifications are sent from the given Space to the given or current user
isFollowingSpace()  : bool
Checks if the given user is following notifications for the given space.
isTouchedSettings()  : bool
resetSpaces()  : mixed
Reset the notification space settings for all users
send()  : mixed
Sends the given $notification to all enabled targets of a single user.
sendBulk()  : mixed
Sends the given $notification to all enabled targets of the given $users if possible as bulk message.
setDesktopNoficationSettings()  : mixed
Defines the enable_html5_desktop_notifications setting for the given user or global if no user is given.
setSpaces()  : mixed
Sets the notification space settings for this user (or global if no user is given).
setSpaceSetting()  : mixed
Sets the send_notifications settings for the given space and user.
createNotifications()  : mixed
searchModuleNotifications()  : array<string|int, mixed>
Searches for all Notifications exported by modules.
findFollowers()  : mixed
findNotExistingSettingSubQuery()  : mixed
isDefaultNotificationSpace()  : mixed

Constants

EVENT_SEARCH_MODULE_NOTIFICATIONS

Sends the notifications categories in the results

public mixed EVENT_SEARCH_MODULE_NOTIFICATIONS = 'searchModuleNotifications'

IS_TOUCHED_SETTINGS

User setting name to know if the user has modified default notification settings

public mixed IS_TOUCHED_SETTINGS = 'is_touched_settings'

Properties

Methods

getDesktopNoficationSettings()

Determines the enable_html5_desktop_notifications setting either for the given user or global if no user is given.

public getDesktopNoficationSettings([User $user = null ]) : int

By default the setting is enabled.

Parameters
$user : User = null
Return values
int

getFollowers()

Returns all notification followers for the given $content instance.

public getFollowers(Content $content) : ActiveQueryUser

This function includes ContentContainer followers only if the content visibility is set to public, else only space members with send_notifications settings are returned.

Parameters
$content : Content
Tags
throws
Exception
Return values
ActiveQueryUser

getNonNotificationSpaces()

Returns all spaces this user is not following.

public getNonNotificationSpaces([User $user = null ][, mixed $limit = 25 ]) : array<string|int, Space>
Parameters
$user : User = null
$limit : mixed = 25
Return values
array<string|int, Space>

getNotificationCategories()

Returns all available NotificationCategories as array with category id as key and a category instance as value.

public getNotificationCategories([mixed $user = null ]) : mixed
Parameters
$user : mixed = null

getSpaces()

Returns all spaces this user is following (including member spaces) with sent_notification setting.

public getSpaces(User $user) : array<string|int, Space>
Parameters
$user : User
Return values
array<string|int, Space>

getTargets()

Returns all active targets for the given user.

public getTargets([User $user = null ]) : array<string|int, BaseTarget>

If no user is given, all configured targets will be returned.

Parameters
$user : User = null

|null the user

Tags
throws
InvalidConfigException
Return values
array<string|int, BaseTarget>

the target

hasSpace()

Check if notifications are sent from the given Space to the given or current user

public hasSpace(Space $space[, User|null $user = null ]) : bool
Parameters
$space : Space
$user : User|null = null
Tags
since
1.15.6
Return values
bool

isFollowingSpace()

Checks if the given user is following notifications for the given space.

public isFollowingSpace(User $user, Space $space) : bool

This is the case for members and followers with the sent_notifications settings.

Parameters
$user : User
$space : Space
Return values
bool

isTouchedSettings()

public static isTouchedSettings(User $user) : bool
Parameters
$user : User
Tags
throws
Throwable
Return values
bool

resetSpaces()

Reset the notification space settings for all users

public resetSpaces() : mixed

setDesktopNoficationSettings()

Defines the enable_html5_desktop_notifications setting for the given user or global if no user is given.

public setDesktopNoficationSettings([int $value = 0 ][, User $user = null ]) : mixed
Parameters
$value : int = 0
$user : User = null

setSpaces()

Sets the notification space settings for this user (or global if no user is given).

public setSpaces(array<string|int, string> $spaceGuids[, User $user = null ]) : mixed

Those are the spaces for which the user want to receive ContentCreated Notifications.

Parameters
$spaceGuids : array<string|int, string>

array of space guids

$user : User = null

setSpaceSetting()

Sets the send_notifications settings for the given space and user.

public setSpaceSetting([User $user = null ], Space $space[, bool $follow = true ]) : mixed
Parameters
$user : User = null

user instance for which this settings will aplly

$space : Space

which notifications will be followed / unfollowed

$follow : bool = true

the setting value (true by default)

createNotifications()

protected createNotifications(mixed $notificationClasses) : mixed
Parameters
$notificationClasses : mixed

searchModuleNotifications()

Searches for all Notifications exported by modules.

protected searchModuleNotifications() : array<string|int, mixed>
Tags
throws
Exception
Return values
array<string|int, mixed>

findFollowers()

private findFollowers(mixed $container[, mixed $isDefault = false ]) : mixed
Parameters
$container : mixed
$isDefault : mixed = false

isDefaultNotificationSpace()

private isDefaultNotificationSpace(mixed $container) : mixed
Parameters
$container : mixed

        
On this page

Search results