Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
PKPNotificationManager Class Reference

Inherited by NotificationManager.

Public Member Functions

 _getTranslatedKeyWithParameters ($key, $notificationId)
 
 createNotification (&$request, $userId=null, $notificationType, $contextId=null, $assocType=null, $assocId=null, $level=NOTIFICATION_LEVEL_NORMAL, $params=null)
 
 createTrivialNotification ($userId, $notificationType=NOTIFICATION_TYPE_SUCCESS, $params=null)
 
 deleteTrivialNotifications ($notifications)
 
 formatNotification (&$request, $notification, $notificationTemplate= 'notification/notification.tpl')
 
 formatToGeneralNotification (&$request, &$notifications)
 
 formatToInPlaceNotification (&$request, &$notifications)
 
 getAllUsersNotificationTypes ()
 
 getFormattedNotificationsForUser (&$request, $userId, $level=NOTIFICATION_LEVEL_NORMAL, $contextId=null, $rangeInfo=null, $notificationTemplate= 'notification/notification.tpl')
 
 getIconClass (&$notification)
 
 getNotificationContents (&$request, &$notification)
 
 getNotificationMessage (&$request, &$notification)
 
 getNotificationSettings ($notificationId)
 
 getNotificationTitle (&$notification)
 
 getNotificationUrl (&$request, &$notification)
 
 getParamsForCurrentLocale ($params)
 
 getStyleClass (&$notification)
 
 PKPNotificationManager ()
 
 sendMailingListEmail (&$request, $email, $token, $template)
 
 sendNotificationEmail (&$request, $notification)
 
 sendToMailingList (&$request, $notification)
 

Detailed Description

Class for Notification Manager.

See Also
NotificationDAO
Notification

Definition at line 20 of file PKPNotificationManager.inc.php.

Member Function Documentation

PKPNotificationManager::_getTranslatedKeyWithParameters (   $key,
  $notificationId 
)

Helper function to get a translated string from a notification with parameters

Parameters
$keystring
$notificationIdint
Returns
String

Definition at line 185 of file PKPNotificationManager.inc.php.

References getNotificationSettings(), and getParamsForCurrentLocale().

Referenced by getNotificationMessage().

PKPNotificationManager::createNotification ( $request,
  $userId = null,
  $notificationType,
  $contextId = null,
  $assocType = null,
  $assocId = null,
  $level = NOTIFICATION_LEVEL_NORMAL,
  $params = null 
)

Create a new notification with the specified arguments and insert into DB This is a static method

Parameters
$requestPKPRequest
$userIdint (optional)
$notificationTypeint
$contextIdint
$assocTypeint
$assocIdint
$levelint
$paramsarray
Returns
Notification object

Definition at line 316 of file PKPNotificationManager.inc.php.

References DAORegistry\getDAO(), and sendNotificationEmail().

PKPNotificationManager::createTrivialNotification (   $userId,
  $notificationType = NOTIFICATION_TYPE_SUCCESS,
  $params = null 
)

Create a new notification with the specified arguments and insert into DB This is a static method

Parameters
$userIdint
$notificationTypeint
$paramsarray
Returns
Notification object

Definition at line 362 of file PKPNotificationManager.inc.php.

References DAORegistry\getDAO().

PKPNotificationManager::deleteTrivialNotifications (   $notifications)

Deletes trivial notifications from database.

Parameters
array$notifications

Definition at line 386 of file PKPNotificationManager.inc.php.

References DAORegistry\getDAO().

PKPNotificationManager::formatNotification ( $request,
  $notification,
  $notificationTemplate = 'notification/notification.tpl' 
)

Return a fully formatted notification for display

Parameters
$requestPKPRequest
$notificationobject Notification
Returns
string

Definition at line 69 of file PKPNotificationManager.inc.php.

References DAORegistry\getDAO(), getIconClass(), getNotificationContents(), getNotificationTitle(), getNotificationUrl(), and getStyleClass().

Referenced by formatToInPlaceNotification().

PKPNotificationManager::formatToGeneralNotification ( $request,
$notifications 
)

General notification data formating.

Parameters
$requestPKPRequest
array$notifications
Returns
array

Definition at line 402 of file PKPNotificationManager.inc.php.

References getIconClass(), getNotificationContents(), getNotificationTitle(), and getStyleClass().

PKPNotificationManager::formatToInPlaceNotification ( $request,
$notifications 
)

In place notification data formating.

Parameters
$requestPKPRequest
$notificationsarray
Returns
array

Definition at line 422 of file PKPNotificationManager.inc.php.

References formatNotification().

PKPNotificationManager::getAllUsersNotificationTypes ( )

Return all notification types that don't need a userId to be created or fetched (all users can see them).

Returns
array

Definition at line 299 of file PKPNotificationManager.inc.php.

PKPNotificationManager::getFormattedNotificationsForUser ( $request,
  $userId,
  $level = NOTIFICATION_LEVEL_NORMAL,
  $contextId = null,
  $rangeInfo = null,
  $notificationTemplate = 'notification/notification.tpl' 
)

Construct a set of notifications and return them as a formatted string

Parameters
$requestPKPRequest
$userIdint
$levelint optional
$contextIdint optional
$rangeInfoobject optional
$notificationTemplatestring optional Template to use for constructing an individual notification for display
Returns
object DAOResultFactory containing matching Notification objects

Definition at line 37 of file PKPNotificationManager.inc.php.

References DAORegistry\getDAO().

PKPNotificationManager::getIconClass ( $notification)

get notification icon style class

Parameters
$notificationNotification
Returns
string

Definition at line 282 of file PKPNotificationManager.inc.php.

Referenced by formatNotification(), and formatToGeneralNotification().

PKPNotificationManager::getNotificationContents ( $request,
$notification 
)

Using the notification message, construct, if needed, any additional content for the notification body. If a specific notification type is not defined, it will return the string from getNotificationMessage method for that type. Define a notification type case on this method only if you need to present more than just text in notification. If you need to define just a locale key, use the getNotificationMessage method only.

Parameters
$requestRequest
$notificationNotification
Returns
String

Definition at line 157 of file PKPNotificationManager.inc.php.

References getNotificationMessage().

Referenced by formatNotification(), formatToGeneralNotification(), sendNotificationEmail(), and sendToMailingList().

PKPNotificationManager::getNotificationMessage ( $request,
$notification 
)

Return a message string for the notification based on its type and associated object.

Parameters
$requestPKPRequest
$notificationNotification
Returns
string

Definition at line 113 of file PKPNotificationManager.inc.php.

References _getTranslatedKeyWithParameters(), and getNotificationSettings().

Referenced by getNotificationContents().

PKPNotificationManager::getNotificationSettings (   $notificationId)

Return notification settings.

Parameters
$notificationIdint
Returns
Array

Definition at line 195 of file PKPNotificationManager.inc.php.

References DAORegistry\getDAO().

Referenced by _getTranslatedKeyWithParameters(), and getNotificationMessage().

PKPNotificationManager::getNotificationTitle ( $notification)

Get the notification's title value

Parameters
$notification
Returns
string

Definition at line 210 of file PKPNotificationManager.inc.php.

Referenced by formatNotification(), and formatToGeneralNotification().

PKPNotificationManager::getNotificationUrl ( $request,
$notification 
)

Construct a URL for the notification based on its type and associated object

Parameters
$requestPKPRequest
$notificationNotification
Returns
string

Definition at line 102 of file PKPNotificationManager.inc.php.

Referenced by formatNotification(), sendNotificationEmail(), and sendToMailingList().

PKPNotificationManager::getParamsForCurrentLocale (   $params)

Iterate through the localized params for a notification's locale key. 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)

Parameters
$paramsarray
Returns
array

Definition at line 231 of file PKPNotificationManager.inc.php.

References AppLocale\getLocale(), AppLocale\getPrimaryLocale(), and AppLocale\getSupportedLocales().

Referenced by _getTranslatedKeyWithParameters().

PKPNotificationManager::getStyleClass ( $notification)

get notification style class

Parameters
$notificationNotification
Returns
string

Definition at line 265 of file PKPNotificationManager.inc.php.

Referenced by formatNotification(), and formatToGeneralNotification().

PKPNotificationManager::PKPNotificationManager ( )

Constructor.

Definition at line 24 of file PKPNotificationManager.inc.php.

PKPNotificationManager::sendMailingListEmail ( $request,
  $email,
  $token,
  $template 
)

Static function to send an email to a mailing list user e.g. regarding signup

Parameters
$requestPKPRequest
$emailstring
$tokenstring the user's token (for confirming and unsubscribing)
$templatestring The mail template to use

Definition at line 496 of file PKPNotificationManager.inc.php.

PKPNotificationManager::sendNotificationEmail ( $request,
  $notification 
)

Send an email to a user regarding the notification

Parameters
$requestPKPRequest
$notificationobject Notification

Definition at line 440 of file PKPNotificationManager.inc.php.

References DAORegistry\getDAO(), getNotificationContents(), getNotificationUrl(), and AppLocale\requireComponents().

Referenced by createNotification().

PKPNotificationManager::sendToMailingList ( $request,
  $notification 
)

Send an update to all users on the mailing list

Parameters
$requestPKPRequest
$notificationobject Notification

Definition at line 464 of file PKPNotificationManager.inc.php.

References DAORegistry\getDAO(), getNotificationContents(), getNotificationUrl(), and AppLocale\requireComponents().


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