XOOPS  2.6.0
NotificationsNotificationHandler Class Reference
Inheritance diagram for NotificationsNotificationHandler:
Inheritance graph

Public Member Functions

 __construct (Connection $db=null)
 
 doLoginMaintenance ($user_id)
 
 getByItemId ($module_id, $item_id, $order=null, $status=null)
 
 getByUser ($user_id)
 
 getNotification ($module_id, $category, $item_id, $event, $user_id)
 
 getObjectsArray (CriteriaElement $criteria=null, $id_as_key=false)
 
 getSubscribedEvents ($category, $item_id, $module_id, $user_id)
 
 isSubscribed ($category, $item_id, $event, $module_id, $user_id)
 
 subscribe ($category, $item_id, $events, $mode=null, $module_id=null, $user_id=null)
 
 triggerEvent ($category, $item_id, $event, $extra_tags=array(), $user_list=array(), $module_id=null, $omit_user_id=null)
 
 triggerEvents ($category, $item_id, $events, $extra_tags=array(), $user_list=array(), $module_id=null, $omit_user_id=null)
 
 unsubscribe ($category, $item_id, $events, $module_id=null, $user_id=null)
 
 unsubscribeByItem ($module_id, $category, $item_id)
 
 unsubscribeByModule ($module_id)
 
 unsubscribeByUser ($user_id)
 
 updateByField (NotificationsNotification $notification, $field_name, $field_value)
 
- Public Member Functions inherited from Xoops\Core\Kernel\XoopsPersistableObjectHandler
 __call ($name, $args)
 
 cleanOrphan ($table_link= '', $field_link= '', $field_object= '')
 
 create ($isNew=true)
 
 delete (XoopsObject $object, $force=false)
 
 deleteAll (CriteriaElement $criteria, $force=true, $asObject=false)
 
 deleteByLink (CriteriaElement $criteria=null)
 
 get ($id=null, $fields=null)
 
 getAll (CriteriaElement $criteria=null, $fields=null, $asObject=true, $id_as_key=true)
 
 getByLink (CriteriaElement $criteria=null, $fields=null, $asObject=true, $field_link=null, $field_object=null)
 
 getCount (CriteriaElement $criteria=null)
 
 getCountByLink (CriteriaElement $criteria=null)
 
 getCounts (CriteriaElement $criteria=null)
 
 getCountsByLink (CriteriaElement $criteria=null)
 
 getIds (CriteriaElement $criteria=null)
 
 getList (CriteriaElement $criteria=null, $limit=0, $start=0)
 
 getObjects (CriteriaElement $criteria=null, $id_as_key=false, $as_object=true)
 
 insert (XoopsObject $object, $force=true)
 
 loadHandler ($name, $args=null)
 
 setHandler ($handler=null, $args=null, $path=null)
 
 synchronization ($table_link= '', $field_link= '', $field_object= '')
 
 updateAll ($fieldname, $fieldvalue, CriteriaElement $criteria, $force=false)
 
 updateByLink ($data, CriteriaElement $criteria=null)
 
- Public Member Functions inherited from Xoops\Core\Kernel\XoopsObjectHandler
 create ()
 
 delete (XoopsObject $object, $force=true)
 
 get ($int_id)
 
 insert (XoopsObject $object, $force=true)
 

Additional Inherited Members

- Public Attributes inherited from Xoops\Core\Kernel\XoopsPersistableObjectHandler
 $className
 
 $field_link
 
 $field_object
 
 $identifierName
 
 $keyName
 
 $keyName_link
 
 $table
 
 $table_link
 
- Public Attributes inherited from Xoops\Core\Kernel\XoopsObjectHandler
 $db2
 
- Protected Member Functions inherited from Xoops\Core\Kernel\XoopsPersistableObjectHandler
 __construct (Connection $db=null, $table= '', $className= '', $keyName= '', $identifierName= '')
 
- Protected Member Functions inherited from Xoops\Core\Kernel\XoopsObjectHandler
 __construct (Connection $db=null)
 
- Protected Attributes inherited from Xoops\Core\Kernel\XoopsPersistableObjectHandler
 $handler
 

Detailed Description

Definition at line 137 of file notification.php.

Constructor & Destructor Documentation

NotificationsNotificationHandler::__construct ( Connection  $db = null)

Constructor

Parameters
Connection | null$dbConnection

Definition at line 144 of file notification.php.

Member Function Documentation

NotificationsNotificationHandler::doLoginMaintenance (   $user_id)

Perform notification maintenance activites at login time. In particular, any notifications for the newly logged-in user with mode NOTIFICATIONS_MODE_WAITFORLOGIN are switched to mode NOTIFICATIONS_MODE_SENDONCETHENWAIT.

Parameters
int$user_idID of the user being logged in
Returns
void

Definition at line 616 of file notification.php.

References $criteria, $user_id, getObjectsArray(), and Xoops\Core\Kernel\XoopsPersistableObjectHandler\insert().

Here is the call graph for this function:

NotificationsNotificationHandler::getByItemId (   $module_id,
  $item_id,
  $order = null,
  $status = null 
)

Retrieve items by their ID

Parameters
int$module_idModule ID
int$item_idItem ID
string$orderSort order
int$statusstatus
Returns
array Array of NotificationsNotification objects
Todo:
is this a useful function?? (Copied from comment_handler)

Definition at line 356 of file notification.php.

References $criteria, $module_id, $status, and getObjectsArray().

Here is the call graph for this function:

NotificationsNotificationHandler::getByUser (   $user_id)

Get a list of notifications by user ID

Parameters
int$user_idID of the user
Returns
array Array of NotificationsNotification objects
Todo:
this will be to provide a list of everything a particular user has subscribed to... e.g. for on the 'Profile' page, similar to how we see the various posts etc. that the user has made. We may also want to have a function where we can specify module id

Definition at line 308 of file notification.php.

References $criteria, $user_id, and getObjectsArray().

Here is the call graph for this function:

NotificationsNotificationHandler::getNotification (   $module_id,
  $category,
  $item_id,
  $event,
  $user_id 
)

getNotification

Parameters
int$module_idmodule
string$categorycategory
int$item_iditem
string$eventevent
int$user_iduser
Returns
NotificationsNotification|bool
Todo:

rename this

Also, should we have get by module, get by category, etc...??

Definition at line 197 of file notification.php.

References $criteria, $module_id, $user_id, and getObjectsArray().

Referenced by subscribe().

Here is the call graph for this function:

Here is the caller graph for this function:

NotificationsNotificationHandler::getObjectsArray ( CriteriaElement  $criteria = null,
  $id_as_key = false 
)

Get some NotificationsNotifications

Parameters
CriteriaElement | null$criteriacriteria object
bool$id_as_keyUse IDs as keys into the array?
Returns
array Array of NotificationsNotification objects

Definition at line 157 of file notification.php.

References $criteria, and $result.

Referenced by doLoginMaintenance(), getByItemId(), getByUser(), getNotification(), getSubscribedEvents(), and triggerEvent().

Here is the caller graph for this function:

NotificationsNotificationHandler::getSubscribedEvents (   $category,
  $item_id,
  $module_id,
  $user_id 
)

Get a list of notification events for the current item/mod/user

Parameters
string$categorycaategory
int$item_idid
int$module_idmodule
int$user_iduser
Returns
array
Todo:
rename this?

Definition at line 326 of file notification.php.

References $criteria, $module_id, $result, $user_id, and getObjectsArray().

Here is the call graph for this function:

NotificationsNotificationHandler::isSubscribed (   $category,
  $item_id,
  $event,
  $module_id,
  $user_id 
)

Determine if a user is subscribed to a particular event in a particular module.

Parameters
string$categoryCategory of notification event
int$item_idItem ID of notification event
string$eventEvent
int$module_idID of module (default current module)
int$user_idID of user (default current user)
Returns
int 0 if not subscribe; non-zero if subscribed

Definition at line 225 of file notification.php.

References $criteria, $module_id, $user_id, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\getCount().

Here is the call graph for this function:

NotificationsNotificationHandler::subscribe (   $category,
  $item_id,
  $events,
  $mode = null,
  $module_id = null,
  $user_id = null 
)

Subscribe for notification for an event(s)

Parameters
string$categorycategory of notification
int$item_idID of the item
mixed$eventsevent string or array of events
int$modeforce a particular notification mode (e.g. once_only) (default to current user preference)
int$module_idID of the module (default to current module)
int$user_idID of the user (default to current user)
Returns
bool
Todo:
: how about a function to subscribe a whole group of users??? e.g. if we want to add all moderators to be notified of subscription of new threads...

Definition at line 253 of file notification.php.

References $module_id, $user, $user_id, $xoops, Xoops\Core\Kernel\XoopsObjectHandler\create(), Xoops\getInstance(), getNotification(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\insert(), and updateByField().

Here is the call graph for this function:

NotificationsNotificationHandler::triggerEvent (   $category,
  $item_id,
  $event,
  $extra_tags = array(),
  $user_list = array(),
  $module_id = null,
  $omit_user_id = null 
)

triggerEvent

Parameters
int$categorynotification category
int$item_idID of the item
int$eventnotification event
array$extra_tagsarray of substitutions for template
array$user_listusers to notify
int$module_idmodule
int$omit_user_idusers to not notify
Returns
bool

Definition at line 421 of file notification.php.

References $criteria, $helper, $module, $module_id, $user, $xoops, _MD_NOTIFICATIONS_ITEMNAMENOTAVAILABLE, _MD_NOTIFICATIONS_ITEMTYPENOTAVAILABLE, _MD_NOTIFICATIONS_ITEMURLNOTAVAILABLE, XoopsBaseConfig\get(), Notifications\getInstance(), and getObjectsArray().

Referenced by triggerEvents().

Here is the call graph for this function:

Here is the caller graph for this function:

NotificationsNotificationHandler::triggerEvents (   $category,
  $item_id,
  $events,
  $extra_tags = array(),
  $user_list = array(),
  $module_id = null,
  $omit_user_id = null 
)

Send notifications to users

Parameters
string$categorynotification category
int$item_idID of the item
string$eventsnotification event
array$extra_tagsarray of substitutions for template to be merged with the one from function..
array$user_listonly notify the selected users
int$module_idID of the module
int$omit_user_idID of the user to omit from notifications. (default to current user). set to 0 for all users to receive notification.
Returns
void
Todo:
(?) - pass in an event LIST. This will help to avoid problem of sending people multiple emails for similar events. BUT, then we need an array of mail templates, etc... Unless mail templates can include logic in the future, then we can tailor the mail so it makes sense for any of the possible (or combination of) events.

Definition at line 391 of file notification.php.

References $module_id, and triggerEvent().

Here is the call graph for this function:

NotificationsNotificationHandler::unsubscribe (   $category,
  $item_id,
  $events,
  $module_id = null,
  $user_id = null 
)

Unsubscribe notifications for an event(s).

Parameters
string$categorycategory of the events
int$item_idID of the item
mixed$eventsevent string or array of events
int$module_idID of the module (default current module)
int$user_idUID of the user (default current user)
Returns
bool
Todo:
allow these to use current module, etc...

Definition at line 544 of file notification.php.

References $criteria, $module_id, $user_id, $xoops, Xoops\Core\Kernel\XoopsPersistableObjectHandler\deleteAll(), and Xoops\getInstance().

Here is the call graph for this function:

NotificationsNotificationHandler::unsubscribeByItem (   $module_id,
  $category,
  $item_id 
)

Delete all subscriptions for a particular item.

Parameters
int$module_idID of the module to which item belongs
string$categoryNotification category of the item
int$item_idID of the item
Returns
bool

Definition at line 597 of file notification.php.

References $criteria, $module_id, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\deleteAll().

Here is the call graph for this function:

NotificationsNotificationHandler::unsubscribeByModule (   $module_id)

Delete all notifications for a particular module

Parameters
int$module_idID of the module
Returns
bool
Todo:
When 'update' a module, may need to switch around some

Definition at line 582 of file notification.php.

References $criteria, $module_id, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\deleteAll().

Here is the call graph for this function:

NotificationsNotificationHandler::unsubscribeByUser (   $user_id)

Delete all notifications for one user

Parameters
int$user_idID of the user
Returns
bool

Definition at line 525 of file notification.php.

References $criteria, $user_id, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\deleteAll().

Here is the call graph for this function:

NotificationsNotificationHandler::updateByField ( NotificationsNotification  $notification,
  $field_name,
  $field_value 
)

Update

Parameters
NotificationsNotification$notificationNotificationsNotification object
string$field_nameName of the field
mixed$field_valueValue to write
Returns
bool

Definition at line 639 of file notification.php.

References Xoops\Core\Kernel\XoopsPersistableObjectHandler\insert(), Xoops\Core\Kernel\XoopsObject\setVar(), and Xoops\Core\Kernel\XoopsObject\unsetNew().

Referenced by subscribe().

Here is the call graph for this function:

Here is the caller graph for this function:


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