Open Journal Systems  3.3.0
NotificationDAO Class Reference
Inheritance diagram for NotificationDAO:
DAO

Public Member Functions

 _fromRow ($row)
 
 build ($contextId, $level, $type, $assocType, $assocId, $userId=null)
 
 deleteByAssoc ($assocType, $assocId, $userId=null, $type=null, $contextId=null)
 
 deleteById ($notificationId, $userId=null)
 
 deleteObject ($notification)
 
 getByAssoc ($assocType, $assocId, $userId=null, $type=null, $contextId=null)
 
 getById ($notificationId, $userId=null)
 
 getByUserId ($userId, $level=NOTIFICATION_LEVEL_NORMAL, $type=null, $contextId=null, $rangeInfo=null)
 
 getInsertId ()
 
 getNotificationCount ($read=true, $userId, $contextId=null, $level=NOTIFICATION_LEVEL_NORMAL)
 
 insertObject ($notification)
 
 newDataObject ()
 
 setDateRead ($notificationId, $dateRead)
 
 transferNotifications ($oldUserId, $newUserId)
 
- Public Member Functions inherited from DAO
 __construct ($dataSource=null, $callHooks=true)
 
 concat ()
 
 convertFromDB ($value, $type)
 
 convertToDB ($value, &$type)
 
 dateFromDB ($d)
 
 datetimeFromDB ($dt)
 
 datetimeToDB ($dt)
 
 dateToDB ($d)
 
 flushCache ()
 
 formatDateToDB ($date, $defaultNumWeeks=null, $acceptPastDate=true)
 
 getAdditionalFieldNames ()
 
 getAffectedRows ()
 
 getDataObjectSettings ($tableName, $idFieldName, $idFieldValue, $dataObject)
 
 getDataSource ()
 
 getDirectionMapping ($direction)
 
 getDriver ()
 
 getLocaleFieldNames ()
 
 getType ($value)
 
 handleError ($dataSource, $sql)
 
 nullOrInt ($value)
 
 replace ($table, $arrFields, $keyCols)
 
retrieve ($sql, $params=false, $callHooks=true)
 
retrieveCached ($sql, $params=false, $secsToCache=3600, $callHooks=true)
 
retrieveLimit ($sql, $params=false, $numRows=false, $offset=false, $callHooks=true)
 
retrieveRange ($sql, $params=false, $dbResultRange=null, $callHooks=true)
 
 setCacheDir ()
 
 setDataSource ($dataSource)
 
 update ($sql, $params=false, $callHooks=true, $dieOnError=true)
 
 updateDataObjectSettings ($tableName, $dataObject, $idArray)
 

Additional Inherited Members

- Static Public Member Functions inherited from DAO
static getDataChangedEvent ($elementId=null, $parentElementId=null, $content='')
 
- Data Fields inherited from DAO
 $_dataSource
 
- Protected Member Functions inherited from DAO
 _getInsertId ($table='', $id='')
 

Detailed Description

Operations for retrieving and modifying Notification objects.

See also
Notification

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

Member Function Documentation

◆ _fromRow()

NotificationDAO::_fromRow (   $row)

Creates and returns an notification object from a row

Parameters
$rowarray
Returns
Notification object

Definition at line 291 of file NotificationDAO.inc.php.

References HookRegistry\call(), DAO\datetimeFromDB(), and newDataObject().

Referenced by getById().

◆ build()

NotificationDAO::build (   $contextId,
  $level,
  $type,
  $assocType,
  $assocId,
  $userId = null 
)

Inserts or update a notification into notifications table.

Parameters
$levelint
$typeint
$assocTypeint
$assocIdint
$userIdint (optional)
$contextIdint (optional)
Returns
mixed Notification or null

Definition at line 160 of file NotificationDAO.inc.php.

References insertObject(), newDataObject(), and DAO\update().

◆ deleteByAssoc()

NotificationDAO::deleteByAssoc (   $assocType,
  $assocId,
  $userId = null,
  $type = null,
  $contextId = null 
)

Delete notification(s) by association

Parameters
$assocTypeint
$assocIdint
$userIdint optional
$typeint optional
$contextIdint optional
Returns
boolean

Definition at line 235 of file NotificationDAO.inc.php.

References deleteObject(), and getByAssoc().

◆ deleteById()

NotificationDAO::deleteById (   $notificationId,
  $userId = null 
)

Delete Notification by notification id

Parameters
$notificationIdint
$userIdint
Returns
boolean

Definition at line 200 of file NotificationDAO.inc.php.

References DAO\getAffectedRows(), DAORegistry\getDAO(), and DAO\update().

Referenced by deleteObject().

◆ deleteObject()

NotificationDAO::deleteObject (   $notification)

Delete Notification

Parameters
$notificationNotification
Returns
boolean

Definition at line 222 of file NotificationDAO.inc.php.

References deleteById().

Referenced by deleteByAssoc().

◆ getByAssoc()

NotificationDAO::getByAssoc (   $assocType,
  $assocId,
  $userId = null,
  $type = null,
  $contextId = null 
)

Retrieve Notifications by assoc. Note that this method will not return fully-fledged notification objects. Use NotificationManager::getNotificationsForUser() to get notifications with URL, and contents

Parameters
$assocTypeint ASSOC_TYPE_...
$assocIdint
$userIdint User ID (optional)
$typeint
$contextIdint Context (journal/press/etc.) ID (optional)
Returns
object DAOResultFactory containing matching Notification objects

Definition at line 80 of file NotificationDAO.inc.php.

References DAO\retrieveRange().

Referenced by deleteByAssoc().

◆ getById()

NotificationDAO::getById (   $notificationId,
  $userId = null 
)

Retrieve Notification by notification id

Parameters
$notificationIdint
$userIdint optional
Returns
object Notification

Definition at line 28 of file NotificationDAO.inc.php.

References _fromRow(), and DAO\retrieve().

◆ getByUserId()

NotificationDAO::getByUserId (   $userId,
  $level = NOTIFICATION_LEVEL_NORMAL,
  $type = null,
  $contextId = null,
  $rangeInfo = null 
)

Retrieve Notifications by user id Note that this method will not return fully-fledged notification objects. Use NotificationManager::getNotificationsForUser() to get notifications with URL, and contents

Parameters
$userIdint
$levelint
$typeint
$contextIdint
$rangeInfoObject
Returns
object DAOResultFactory containing matching Notification objects

Definition at line 56 of file NotificationDAO.inc.php.

References DAO\retrieveRange().

◆ getInsertId()

NotificationDAO::getInsertId ( )

Get the ID of the last inserted notification

Returns
int

Definition at line 246 of file NotificationDAO.inc.php.

References DAO\_getInsertId().

Referenced by insertObject().

◆ getNotificationCount()

NotificationDAO::getNotificationCount (   $read = true,
  $userId,
  $contextId = null,
  $level = NOTIFICATION_LEVEL_NORMAL 
)

Get the number of unread messages for a user

Parameters
$readboolean Whether to check for read (true) or unread (false) notifications
$contextIdint
$userIdint
$levelint
Returns
int

Definition at line 258 of file NotificationDAO.inc.php.

References DAO\retrieve().

◆ insertObject()

NotificationDAO::insertObject (   $notification)

Inserts a new notification into notifications table

Parameters
$notificationobject
Returns
int Notification Id

Definition at line 129 of file NotificationDAO.inc.php.

References DAO\datetimeToDB(), Core\getCurrentDate(), getInsertId(), and DAO\update().

Referenced by build().

◆ newDataObject()

NotificationDAO::newDataObject ( )

Instantiate and return a new data object.

Returns
Notification

Definition at line 120 of file NotificationDAO.inc.php.

Referenced by _fromRow(), and build().

◆ setDateRead()

NotificationDAO::setDateRead (   $notificationId,
  $dateRead 
)

Retrieve Notifications by notification id

Parameters
$notificationIdint
$dateReaddate
Returns
boolean

Definition at line 104 of file NotificationDAO.inc.php.

References DAO\datetimeToDB(), and DAO\update().

◆ transferNotifications()

NotificationDAO::transferNotifications (   $oldUserId,
  $newUserId 
)

Transfer the notifications for a user.

Parameters
$oldUserIdint
$newUserIdint

Definition at line 279 of file NotificationDAO.inc.php.

References DAO\update().


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