PHP Class Elgg\Notifications\SubscriptionsService

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

Méthodes publiques

Свойство Type Description
$methods Array of strings. Delivery names as registered with elgg_register_notification_method()

Protected Properties

Свойство Type Description
$db Elgg\Database

Méthodes publiques

Méthode Description
__construct ( Database $db, array $methods = [] ) Constructor
addSubscription ( integer $userGuid, string $method, integer $targetGuid ) : boolean Subscribe a user to notifications about a target entity
getSubscriptions ( Elgg\Notifications\NotificationEvent $event ) : array Get the subscriptions for this notification event
getSubscriptionsForContainer ( integer $container_guid ) : array Get the subscriptions for the content created inside this container.
removeSubscription ( integer $userGuid, string $method, integer $targetGuid ) : boolean Unsubscribe a user to notifications about a target entity

Méthodes protégées

Méthode Description
getMethodRelationships ( ) : array Get the relationship names for notifications
getSubscriptionRecords ( integer $container_guid ) : array Get subscription records from the database

Method Details

__construct() public méthode

Constructor
public __construct ( Database $db, array $methods = [] )
$db Elgg\Database Database object
$methods array Notification delivery method names

addSubscription() public méthode

This method will return false if the subscription already exists.
public addSubscription ( integer $userGuid, string $method, integer $targetGuid ) : boolean
$userGuid integer The GUID of the user to subscribe to notifications
$method string The delivery method of the notifications
$targetGuid integer The entity to receive notifications about
Résultat boolean

getMethodRelationships() protected méthode

Get the relationship names for notifications
protected getMethodRelationships ( ) : array
Résultat array

getSubscriptionRecords() protected méthode

Records are an object with two vars: guid and methods with the latter being a comma-separated list of subscription relationship names.
protected getSubscriptionRecords ( integer $container_guid ) : array
$container_guid integer The GUID of the subscription target
Résultat array

getSubscriptions() public méthode

The return array is of the form: array( => array('email', 'sms', 'ajax'), );
public getSubscriptions ( Elgg\Notifications\NotificationEvent $event ) : array
$event Elgg\Notifications\NotificationEvent Notification event
Résultat array

getSubscriptionsForContainer() public méthode

The return array is of the form: array( => array('email', 'sms', 'ajax'), );
public getSubscriptionsForContainer ( integer $container_guid ) : array
$container_guid integer GUID of the entity acting as a container
Résultat array User GUIDs (keys) and their subscription types (values).

removeSubscription() public méthode

Unsubscribe a user to notifications about a target entity
public removeSubscription ( integer $userGuid, string $method, integer $targetGuid ) : boolean
$userGuid integer The GUID of the user to unsubscribe to notifications
$method string The delivery method of the notifications to stop
$targetGuid integer The entity to stop receiving notifications about
Résultat boolean

Property Details

$db protected_oe property

protected Database,Elgg $db
Résultat Elgg\Database

$methods public_oe property

Array of strings. Delivery names as registered with elgg_register_notification_method()
public $methods