PHP Class Elgg\Notifications\NotificationsService

Since: 1.9.0
Afficher le fichier Open project: elgg/elgg Class Usage Examples

Protected Properties

Свойство Type Description
$deprHandlers Deprecated notification handlers
$deprSubjects Deprecated message subjects
$entities Elgg\Database\EntityTable
$events Registered notification events
$hooks Elgg\PluginHooksService
$logger Elgg\Logger
$methods Registered notification methods
$queue Elgg\Queue\Queue
$session ElggSessio\ElggSession
$subscriptions SubscriptionsService
$translator Elgg\I18n\Translator

Méthodes publiques

Méthode Description
__construct ( SubscriptionsService $subscriptions, Elgg\Queue\Queue $queue, PluginHooksService $hooks, ElggSessio\ElggSession $session, Translator $translator, EntityTable $entities, Logger $logger ) Constructor
enqueueEvent ( string $action, string $type, ElggDat\ElggData $object ) : void Add a notification event to the queue
getDeprecatedHandler ( string $method ) : callback | null Get a deprecated notification handler callback
getEvents ( )
getMethods ( )
getMethodsAsDeprecatedGlobal ( ) : array Provides a way to incrementally wean Elgg's notifications code from the global $NOTIFICATION_HANDLERS
processQueue ( integer $stopTime, boolean $matrix = false ) : integer | array Pull notification events from queue until stop time is reached
registerDeprecatedHandler ( string $method, string $handler ) : void Register a deprecated notification handler
registerEvent ( $type, $subtype, array $actions = [] )
registerMethod ( $name )
sendInstantNotifications ( ElggEntity $sender, array $recipients = [], array $params = [] ) : array Notify a user via their preferences.
setDeprecatedNotificationSubject ( string $type, string $subtype, string $subject ) : void Set message subject for deprecated notification code
unregisterEvent ( $type, $subtype )
unregisterMethod ( $name )

Méthodes protégées

Méthode Description
getDeprecatedNotificationBody ( Notification $notification, Elgg\Notifications\NotificationEvent $event, string $method ) : Notification Get the notification body using a pre-Elgg 1.9 plugin hook
getDeprecatedNotificationSubject ( string $type, string $subtype ) : string Get the deprecated subject
sendNotification ( Elgg\Notifications\NotificationEvent $event, integer $guid, string $method, array $params = [] ) : boolean Send a notification to a subscriber
sendNotifications ( Elgg\Notifications\NotificationEvent $event, array $subscriptions, array $params = [] ) : array Sends the notifications based on subscriptions

Private Methods

Méthode Description
getNotificationBody ( Elgg\Notifications\NotificationEvent $event, ElggUse\ElggUser $recipient ) : string Get body for the notification
getNotificationSubject ( Elgg\Notifications\NotificationEvent $event, ElggUse\ElggUser $recipient ) : string Get subject for the notification

Method Details

__construct() public méthode

Constructor
public __construct ( SubscriptionsService $subscriptions, Elgg\Queue\Queue $queue, PluginHooksService $hooks, ElggSessio\ElggSession $session, Translator $translator, EntityTable $entities, Logger $logger )
$subscriptions SubscriptionsService Subscription service
$queue Elgg\Queue\Queue Queue
$hooks Elgg\PluginHooksService Plugin hook service
$session ElggSessio\ElggSession Session service
$translator Elgg\I18n\Translator Translator
$entities Elgg\Database\EntityTable Entity table
$logger Elgg\Logger Logger

enqueueEvent() public méthode

Add a notification event to the queue
public enqueueEvent ( string $action, string $type, ElggDat\ElggData $object ) : void
$action string Action name
$type string Type of the object of the action
$object ElggDat\ElggData The object of the action
Résultat void

getDeprecatedHandler() public méthode

Get a deprecated notification handler callback
public getDeprecatedHandler ( string $method ) : callback | null
$method string Method name
Résultat callback | null

getDeprecatedNotificationBody() protected méthode

Get the notification body using a pre-Elgg 1.9 plugin hook
protected getDeprecatedNotificationBody ( Notification $notification, Elgg\Notifications\NotificationEvent $event, string $method ) : Notification
$notification Notification Notification
$event Elgg\Notifications\NotificationEvent Event
$method string Method
Résultat Notification

getDeprecatedNotificationSubject() protected méthode

Get the deprecated subject
protected getDeprecatedNotificationSubject ( string $type, string $subtype ) : string
$type string Entity type
$subtype string Entity subtype
Résultat string

getEvents() public méthode

public getEvents ( )

getMethods() public méthode

public getMethods ( )

getMethodsAsDeprecatedGlobal() public méthode

Provides a way to incrementally wean Elgg's notifications code from the global $NOTIFICATION_HANDLERS
public getMethodsAsDeprecatedGlobal ( ) : array
Résultat array

processQueue() public méthode

Pull notification events from queue until stop time is reached
public processQueue ( integer $stopTime, boolean $matrix = false ) : integer | array
$stopTime integer The Unix time to stop sending notifications
$matrix boolean If true, will return delivery matrix instead of a notifications event count
Résultat integer | array The number of notification events handled, or a delivery matrix

registerDeprecatedHandler() public méthode

Register a deprecated notification handler
public registerDeprecatedHandler ( string $method, string $handler ) : void
$method string Method name
$handler string Handler callback
Résultat void

registerEvent() public méthode

See also: elgg_register_notification_event()
public registerEvent ( $type, $subtype, array $actions = [] )
$actions array

registerMethod() public méthode

See also: elgg_register_notification_method()
public registerMethod ( $name )

sendInstantNotifications() public méthode

Returns an array in the form: [ 25 => [ 'email' => true, 'sms' => false, ], 55 => [], ]
public sendInstantNotifications ( ElggEntity $sender, array $recipients = [], array $params = [] ) : array
$sender ElggEntity Sender of the notification
$recipients array An array of entities to notify
$params array Notification parameters
Résultat array

sendNotification() protected méthode

Send a notification to a subscriber
protected sendNotification ( Elgg\Notifications\NotificationEvent $event, integer $guid, string $method, array $params = [] ) : boolean
$event Elgg\Notifications\NotificationEvent The notification event
$guid integer The guid of the subscriber
$method string The notification method
$params array Default notification params
Résultat boolean

sendNotifications() protected méthode

Returns an array in the form: [ 25 => [ 'email' => true, 'sms' => false, ], 55 => [], ]
protected sendNotifications ( Elgg\Notifications\NotificationEvent $event, array $subscriptions, array $params = [] ) : array
$event Elgg\Notifications\NotificationEvent Notification event
$subscriptions array Subscriptions for this event
$params array Default notification parameters
Résultat array

setDeprecatedNotificationSubject() public méthode

Set message subject for deprecated notification code
public setDeprecatedNotificationSubject ( string $type, string $subtype, string $subject ) : void
$type string Entity type
$subtype string Entity subtype
$subject string Subject line
Résultat void

unregisterEvent() public méthode

See also: elgg_unregister_notification_event()
public unregisterEvent ( $type, $subtype )

unregisterMethod() public méthode

See also: elgg_unregister_notification_method()
public unregisterMethod ( $name )

Property Details

$deprHandlers protected_oe property

Deprecated notification handlers
protected $deprHandlers

$deprSubjects protected_oe property

Deprecated message subjects
protected $deprSubjects

$entities protected_oe property

protected EntityTable,Elgg\Database $entities
Résultat Elgg\Database\EntityTable

$events protected_oe property

Registered notification events
protected $events

$hooks protected_oe property

protected PluginHooksService,Elgg $hooks
Résultat Elgg\PluginHooksService

$logger protected_oe property

protected Logger,Elgg $logger
Résultat Elgg\Logger

$methods protected_oe property

Registered notification methods
protected $methods

$queue protected_oe property

protected Queue,Elgg\Queue $queue
Résultat Elgg\Queue\Queue

$session protected_oe property

protected ElggSession,ElggSessio $session
Résultat ElggSessio\ElggSession

$subscriptions protected_oe property

protected SubscriptionsService,Elgg\Notifications $subscriptions
Résultat SubscriptionsService

$translator protected_oe property

protected Translator,Elgg\I18n $translator
Résultat Elgg\I18n\Translator