NotificationEvent

NotificationEvent

Notification Event

Raises an event and collects recipients. Looks for matching event listeners, then pushes resulting notifications to a sender.

Methods

__construct

Create a new notification event which correlates to an event type defined in gibbonNotificationEvents.

NotificationEvent::__construct( string $moduleName, string $event )

setNotificationText

Defines the body text of the notification, added to the notifications page and optionally emailed to recipients.

NotificationEvent::setNotificationText( string $text )

Sets the link that opens when the notification is viewed and archived.

NotificationEvent::setActionLink( string $actionLink )

addScope

Add a scopeType => scopeID pair to the list. This defines which filters will match when looking for event listeners.

NotificationEvent::addScope( string $type, integer|array $id )

Eg: a scopeType of gibbonYearGroupID will only match listeners for that specific year group ID. Prevent duplicates using a type+id array key


addRecipient

Adds a recipient to the list. Avoids duplicates by checking presence in the the array.

NotificationEvent::addRecipient( integer|string $gibbonPersonID ): boolean

Return Value: boolean


getRecipientCount

Gets the current recipient count for this event. If called after pushNotifications() it will all include listener count.

NotificationEvent::getRecipientCount( ): integer

Return Value: integer


sendNotifications

Collects and sends all notifications for this event, returning a send report array.

NotificationEvent::sendNotifications( \Gibbon\Contracts\Database\Connection $pdo, \Gibbon\session $session, boolean $bccMode = false ): array

Return Value: array Send report with success/fail counts.


sendNotificationsAsBcc

Send notifications for this event as BCC. Helper method to clarify the intent of the sending option.

NotificationEvent::sendNotificationsAsBcc( \Gibbon\Contracts\Database\Connection $pdo, \Gibbon\session $session ): array

Return Value: array Send report with success/fail counts.


pushNotifications

Adds event listeners to the recipients list, then pushes a notification for each recipient to the notification sender.

NotificationEvent::pushNotifications( \Gibbon\Domain\System\NotificationGateway $gateway, \Gibbon\Comms\NotificationSender $sender ): integer|boolean

Does not perform the sending of notifications (can be used for bulk processing).

Return Value: integer|boolean Final recipient count, false on failure


getEventDetails

Get the event row from the database (lazy-load)

NotificationEvent::getEventDetails( \Gibbon\Domain\System\NotificationGateway $gateway, $key = null ): array

Return Value: array Datbase row, null on failure


Last updated : September 15, 2018 b92362d