Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Elgg\Notifications\NotificationsService Class Reference

Public Member Functions

 __construct (\Elgg\Notifications\SubscriptionsService $subscriptions,\Elgg\Queue\Queue $queue,\Elgg\PluginHooksService $hooks,\ElggSession $session,\Elgg\I18n\Translator $translator,\Elgg\Database\EntityTable $entities)
 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)
 Pull notification events from queue until stop time is reached. 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)
 Sends the notifications based on subscriptions. More...
 
 sendNotification (\Elgg\Notifications\Event $event, $guid, $method)
 Send a notification to a subscriber. More...
 
 getDeprecatedNotificationBody (\Elgg\Notifications\Notification $notification,\Elgg\Notifications\Event $event, $method)
 Get the notification body using a pre-Elgg 1.9 plugin hook. More...
 
 getDeprecatedNotificationSubject ($type, $subtype)
 Get the deprecated subject. More...
 
 existsDeprecatedNotificationOverride (\Elgg\Notifications\Event $event)
 Is someone using the deprecated override. More...
 

Protected Attributes

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

Detailed Description

Definition at line 15 of file NotificationsService.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
\Elgg\Notifications\SubscriptionsService$subscriptionsSubscription service
\Elgg\Queue\Queue$queueQueue
\Elgg\PluginHooksService$hooksPlugin hook service
\ElggSession$sessionSession service
\Elgg\I18n\Translator$translatorTranslator
\Elgg\Database\EntityTable$entitiesEntity table

Definition at line 59 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 154 of file NotificationsService.php.

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

Is someone using the deprecated override.

Parameters
\Elgg\Notifications\Event$eventEvent
Returns
boolean

Definition at line 541 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 437 of file NotificationsService.php.

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

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

Parameters
\Elgg\Notifications\Notification$notificationNotification
\Elgg\Notifications\Event$eventEvent
string$methodMethod
Returns

Definition at line 467 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 516 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::getEvents ( )

private

Definition at line 114 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::getMethods ( )

private

Definition at line 141 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 451 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::processQueue (   $stopTime)

Pull notification events from queue until stop time is reached.

Parameters
int$stopTimeThe Unix time to stop sending notifications
Returns
int The number of notification events handled private

Definition at line 187 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 427 of file NotificationsService.php.

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

Definition at line 79 of file NotificationsService.php.

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

Definition at line 122 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::sendNotification ( \Elgg\Notifications\Event  $event,
  $guid,
  $method 
)
protected

Send a notification to a subscriber.

Parameters
\Elgg\Notifications\Event$eventThe notification event
int$guidThe guid of the subscriber
string$methodThe notification method
Returns
bool private

Definition at line 263 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::sendNotifications (   $event,
  $subscriptions 
)
protected

Sends the notifications based on subscriptions.

Parameters
\Elgg\Notifications\Event$eventNotification event
array$subscriptionsSubscriptions for this event
Returns
int The number of notifications handled private

Definition at line 235 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 494 of file NotificationsService.php.

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

Definition at line 100 of file NotificationsService.php.

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

Definition at line 130 of file NotificationsService.php.

Member Data Documentation

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

Definition at line 44 of file NotificationsService.php.

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

Definition at line 47 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$entities
protected

Definition at line 35 of file NotificationsService.php.

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

Definition at line 38 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$hooks
protected

Definition at line 26 of file NotificationsService.php.

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

Definition at line 41 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$queue
protected

Definition at line 23 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$session
protected

Definition at line 29 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$subscriptions
protected

Definition at line 20 of file NotificationsService.php.

Elgg\Notifications\NotificationsService::$translator
protected

Definition at line 32 of file NotificationsService.php.

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

Definition at line 17 of file NotificationsService.php.


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