PHP Class PKPNotificationOperationManager, pkp-lib

Inheritance: implements INotificationInfoProvider
Show file Open project: pkp/pkp-lib Class Usage Examples

Public Methods

Method Description
__construct ( ) Constructor.
createNotification ( $request, $userId = null, $notificationType, $contextId = null, $assocType = null, $assocId = null, $level = NOTIFICATION_LEVEL_NORMAL, $params = null, $suppressEmail = false ) : Notification Create a new notification with the specified arguments and insert into DB
createTrivialNotification ( $userId, $notificationType = NOTIFICATION_TYPE_SUCCESS, $params = null ) : Notification Create a new notification with the specified arguments and insert into DB This is a static method
deleteTrivialNotifications ( array $notifications ) Deletes trivial notifications from database.
formatToGeneralNotification ( $request, array $notifications ) : array General notification data formating.
formatToInPlaceNotification ( $request, $notifications ) : array In place notification data formating.
getFormattedNotificationsForUser ( $request, $userId, $level = NOTIFICATION_LEVEL_NORMAL, $contextId = null, $rangeInfo = null, $notificationTemplate = 'notification/notification.tpl' ) : object Construct a set of notifications and return them as a formatted string
getIconClass ( $notification )
getNotificationContents ( $request, $notification ) Provide the notification message as default content.
getNotificationMessage ( $request, $notification )
getNotificationTitle ( $notification )
getNotificationUrl ( $request, $notification )
getParamsForCurrentLocale ( $params ) : array Iterate through the localized params for a notification's locale key.
getStyleClass ( $notification )
isVisibleToAllUsers ( $notificationType, $assocType, $assocId )
sendMailingListEmail ( $request, $email, $token, $template ) Static function to send an email to a mailing list user e.g. regarding signup
sendToMailingList ( $request, $notification ) Send an update to all users on the mailing list

Protected Methods

Method Description
fetchLinkActionNotificationContent ( $linkAction, $request ) : string Get a notification content with a link action.
getMailTemplate ( $emailKey = null ) : MailTemplate Get a template mail instance.
getUserBlockedEmailedNotifications ( $userId, $contextId ) : array Get set of notification types user will also be notified by email.
getUserBlockedNotifications ( $userId, $contextId ) : array Get set of notifications types user does not want to be notified of.

Private Methods

Method Description
formatNotification ( $request, $notification, $notificationTemplate = 'notification/notification.tpl' ) : string Return a fully formatted notification for display
formatNotifications ( $request, $notifications, $notificationTemplate = 'notification/notification.tpl' ) * Return a string of formatted notifications for display
sendNotificationEmail ( $request, $notification ) Send an email to a user regarding the notification

Method Details

__construct() public method

Constructor.
public __construct ( )

createNotification() public method

Create a new notification with the specified arguments and insert into DB
public createNotification ( $request, $userId = null, $notificationType, $contextId = null, $assocType = null, $assocId = null, $level = NOTIFICATION_LEVEL_NORMAL, $params = null, $suppressEmail = false ) : Notification
$request PKPRequest
$userId int (optional)
$notificationType int
$contextId int
$assocType int
$assocId int
$level int
$params array
$suppressEmail boolean Whether or not to suppress the notification email.
return Notification object

createTrivialNotification() public method

Create a new notification with the specified arguments and insert into DB This is a static method
public createTrivialNotification ( $userId, $notificationType = NOTIFICATION_TYPE_SUCCESS, $params = null ) : Notification
$userId int
$notificationType int
$params array
return Notification object

deleteTrivialNotifications() public method

Deletes trivial notifications from database.
public deleteTrivialNotifications ( array $notifications )
$notifications array

fetchLinkActionNotificationContent() protected method

Get a notification content with a link action.
protected fetchLinkActionNotificationContent ( $linkAction, $request ) : string
$linkAction LinkAction
$request Request
return string

formatToGeneralNotification() public method

General notification data formating.
public formatToGeneralNotification ( $request, array $notifications ) : array
$request PKPRequest
$notifications array
return array

formatToInPlaceNotification() public method

In place notification data formating.
public formatToInPlaceNotification ( $request, $notifications ) : array
$request PKPRequest
$notifications array
return array

getFormattedNotificationsForUser() public method

Construct a set of notifications and return them as a formatted string
public getFormattedNotificationsForUser ( $request, $userId, $level = NOTIFICATION_LEVEL_NORMAL, $contextId = null, $rangeInfo = null, $notificationTemplate = 'notification/notification.tpl' ) : object
$request PKPRequest
$userId int
$level int optional
$contextId int optional
$rangeInfo object optional
$notificationTemplate string optional Template to use for constructing an individual notification for display
return object DAOResultFactory containing matching Notification objects

getIconClass() public method

public getIconClass ( $notification )

getMailTemplate() protected method

Get a template mail instance.
See also: MailTemplate
protected getMailTemplate ( $emailKey = null ) : MailTemplate
$emailKey string
return MailTemplate

getNotificationContents() public method

Provide the notification message as default content.
public getNotificationContents ( $request, $notification )

getNotificationMessage() public method

public getNotificationMessage ( $request, $notification )

getNotificationTitle() public method

public getNotificationTitle ( $notification )

getNotificationUrl() public method

public getNotificationUrl ( $request, $notification )

getParamsForCurrentLocale() public method

For each parameter, return (in preferred order) a value for the user's current locale, a param for the journal's default locale, or the first value (in case the value is not localized)
public getParamsForCurrentLocale ( $params ) : array
$params array
return array

getStyleClass() public method

public getStyleClass ( $notification )

getUserBlockedEmailedNotifications() protected method

Get set of notification types user will also be notified by email.
protected getUserBlockedEmailedNotifications ( $userId, $contextId ) : array
return array

getUserBlockedNotifications() protected method

Get set of notifications types user does not want to be notified of.
protected getUserBlockedNotifications ( $userId, $contextId ) : array
$userId int The notification user
$contextId int
return array

isVisibleToAllUsers() public method

public isVisibleToAllUsers ( $notificationType, $assocType, $assocId )

sendMailingListEmail() public method

Static function to send an email to a mailing list user e.g. regarding signup
public sendMailingListEmail ( $request, $email, $token, $template )
$request PKPRequest
$email string
$token string the user's token (for confirming and unsubscribing)
$template string The mail template to use

sendToMailingList() public method

Send an update to all users on the mailing list
public sendToMailingList ( $request, $notification )
$request PKPRequest
$notification object Notification