private static function getInstance() { if (!self::$instance) { self::$instance = new self(); } return self::$instance; }
public final function notifyByRoles(array $roles, $processAsync = false) { require_once 'Services/Notifications/classes/class.ilNotificationSystem.php'; //$this->beforeSendToListeners(); ilNotificationSystem::sendNotificationToRoles($this, $roles, $processAsync); //$this->afterSendToListeners(); }
/** * Removes a notifcation and triggers a follow up notification to remove * the notification from the browser view of the original recipient * * @global ilDB $ilDB * @param integer $notification_osd_id */ public static function removeNotification($notification_osd_id) { global $ilDB; $query = 'SELECT usr_id FROM ' . ilNotificationSetupHelper::$tbl_notification_osd_handler . ' WHERE notification_osd_id = %s'; $types = array('integer'); $values = array($notification_osd_id); $rset = $ilDB->queryF($query, $types, $values); if ($row = $ilDB->fetchAssoc($rset)) { $query = 'DELETE FROM ' . ilNotificationSetupHelper::$tbl_notification_osd_handler . ' WHERE notification_osd_id = %s'; $types = array('integer'); $values = array($notification_osd_id); $ilDB->manipulateF($query, $types, $values); // sends a "delete the given notification" notification using the // osd_maint channel $deletedNotification = new ilNotificationConfig('osd_maint'); $deletedNotification->setValidForSeconds(120); $deletedNotification->setTitleVar('deleted'); $deletedNotification->setShortDescriptionVar($notification_osd_id); $deletedNotification->setLongDescriptionVar('dummy'); require_once 'Services/Notifications/classes/class.ilNotificationSystem.php'; ilNotificationSystem::sendNotificationToUsers($deletedNotification, array($row['usr_id'])); } }