Elgg  Version 2.3
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Elgg\Notifications\NotificationsService Class Reference

Public Member Functions

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

Public Attributes

const QUEUE_NAME = 'notifications'
 

Protected Member Functions

 sendNotifications ($event, $subscriptions, array $params=[])
 Sends the notifications based on subscriptions. More...
 
 sendNotification (NotificationEvent $event, $guid, $method, array $params=[])
 Send a notification to a subscriber. More...
 
 getDeprecatedNotificationBody (Notification $notification, NotificationEvent $event, $method)
 Get the notification body using a pre-Elgg 1.9 plugin hook. More...
 
 getDeprecatedNotificationSubject ($type, $subtype)
 Get the deprecated subject. More...
 
 existsDeprecatedNotificationOverride (NotificationEvent $event)
 Is someone using the deprecated override. More...
 

Protected Attributes

 $subscriptions
 
 $queue
 
 $hooks
 
 $session
 
 $translator
 
 $entities
 
 $logger
 
 $events = array()
 
 $methods = array()
 
 $deprHandlers = array()
 
 $deprSubjects = array()
 

Detailed Description

Definition at line 26 of file NotificationsService.php.

Constructor & Destructor Documentation

Elgg\Notifications\NotificationsService::__construct ( SubscriptionsService  $subscriptions,
Queue  $queue,
PluginHooksService  $hooks,
ElggSession  $session,
Translator  $translator,
EntityTable  $entities,
Logger  $logger 
)

Constructor.

Parameters
SubscriptionsService$subscriptionsSubscription service
Queue$queueQueue
PluginHooksService$hooksPlugin hook service
ElggSession$sessionSession service
Translator$translatorTranslator
EntityTable$entitiesEntity table
Logger$loggerLogger

Definition at line 74 of file NotificationsService.php.

Member Function Documentation

Elgg\Notifications\NotificationsService::enqueueEvent (   $action,
  $type,
  $object 
)

Add a notification event to the queue.

Parameters
string$actionAction name
string$typeType of the object of the action
ElggData$objectThe object of the action
Returns
void private

Definition at line 170 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::existsDeprecatedNotificationOverride ( NotificationEvent  $event)
protected

Is someone using the deprecated override.

Parameters
NotificationEvent$eventEvent
Returns
boolean

Definition at line 750 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::getDeprecatedHandler (   $method)

Get a deprecated notification handler callback.

Parameters
string$methodMethod name
Returns
callback|null

Definition at line 643 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::getDeprecatedNotificationBody ( Notification  $notification,
NotificationEvent  $event,
  $method 
)
protected

Get the notification body using a pre-Elgg 1.9 plugin hook.

Parameters
Notification$notificationNotification
NotificationEvent$eventEvent
string$methodMethod
Returns
Notification

Definition at line 673 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::getDeprecatedNotificationSubject (   $type,
  $subtype 
)
protected

Get the deprecated subject.

Parameters
string$typeEntity type
string$subtypeEntity subtype
Returns
string

Definition at line 725 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::getEvents ( )

private

Definition at line 130 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::getMethods ( )

private

Definition at line 157 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::getMethodsAsDeprecatedGlobal ( )

Provides a way to incrementally wean Elgg's notifications code from the global $NOTIFICATION_HANDLERS.

Returns
array

Definition at line 657 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::processQueue (   $stopTime,
  $matrix = false 
)

Pull notification events from queue until stop time is reached.

Parameters
int$stopTimeThe Unix time to stop sending notifications
bool$matrixIf true, will return delivery matrix instead of a notifications event count
Returns
int|array The number of notification events handled, or a delivery matrix private

Definition at line 203 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::registerDeprecatedHandler (   $method,
  $handler 
)

Register a deprecated notification handler.

Parameters
string$methodMethod name
string$handlerHandler callback
Returns
void

Definition at line 633 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::registerEvent (   $type,
  $subtype,
array  $actions = array() 
)
See also
elgg_register_notification_event() private

Definition at line 95 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::registerMethod (   $name)
See also
elgg_register_notification_method() private

Definition at line 138 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::sendInstantNotifications ( \ElggEntity  $sender,
array  $recipients = [],
array  $params = [] 
)

Notify a user via their preferences.

Returns an array in the form: [ 25 => [ 'email' => true, 'sms' => false, ], 55 => [], ]

Parameters
ElggEntity$senderSender of the notification
ElggUser[]$recipients An array of entities to notify
array$paramsNotification parameters

$params['subject'] string Default message subject $params['body'] string Default message body $params['object'] null|| The object that is triggering the notification. $params['action'] null|string Word that describes the action that is triggering the notification (e.g. "create" or "update"). Defaults to "notify_user" $params['summary'] null|string Summary that notification plugins can use alongside the notification title and body. $params['methods_override'] string|array A string, or an array of strings specifying the delivery methods to use - or leave blank for delivery using the user's chosen delivery methods.

Returns
array private

Definition at line 338 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::sendNotification ( NotificationEvent  $event,
  $guid,
  $method,
array  $params = [] 
)
protected

Send a notification to a subscriber.

Parameters
NotificationEvent$eventThe notification event
int$guidThe guid of the subscriber
string$methodThe notification method
array$paramsDefault notification params
Returns
bool private

Definition at line 416 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::sendNotifications (   $event,
  $subscriptions,
array  $params = [] 
)
protected

Sends the notifications based on subscriptions.

Returns an array in the form: [ 25 => [ 'email' => true, 'sms' => false, ], 55 => [], ]

Parameters
NotificationEvent$eventNotification event
array$subscriptionsSubscriptions for this event
array$paramsDefault notification parameters
Returns
array private

Definition at line 281 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::setDeprecatedNotificationSubject (   $type,
  $subtype,
  $subject 
)

Set message subject for deprecated notification code.

Parameters
string$typeEntity type
string$subtypeEntity subtype
string$subjectSubject line
Returns
void

Definition at line 703 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::unregisterEvent (   $type,
  $subtype 
)
See also
elgg_unregister_notification_event() private

Definition at line 116 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::unregisterMethod (   $name)
See also
elgg_unregister_notification_method() private

Definition at line 146 of file NotificationsService.php.

Member Data Documentation

Elgg\Notifications\NotificationsService::$deprHandlers = array()
protected

Definition at line 58 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$deprSubjects = array()
protected

Definition at line 61 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$entities
protected

Definition at line 46 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$events = array()
protected

Definition at line 52 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$hooks
protected

Definition at line 37 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$logger
protected

Definition at line 49 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$methods = array()
protected

Definition at line 55 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$queue
protected

Definition at line 34 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$session
protected

Definition at line 40 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$subscriptions
protected

Definition at line 31 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$translator
protected

Definition at line 43 of file NotificationsService.php.

const Elgg\Notifications\NotificationsService::QUEUE_NAME = 'notifications'

Definition at line 28 of file NotificationsService.php.


The documentation for this class was generated from the following file: