function sendNotification($aUsers, $eventType, $targetName, $objectId, $parentId) { $content = new SubscriptionContent(); // needed for i18n //$aUsers = $this->_getSubscribers($oDocument->getId(), $this->subscriptionTypes["Document"]); $locationName = Folder::generateFullFolderPath($parentId); $userId = $_SESSION['userID']; foreach ($aUsers as $oSubscriber) { $emailAddress = $oSubscriber->getEmail(); if ($oSubscriber->getEmailNotification() && !empty($emailAddress)) { // notification object first. $aNotificationOptions = array(); $aNotificationOptions['target_user'] = $oSubscriber->getID(); $aNotificationOptions['actor_id'] = $userId; $aNotificationOptions['target_name'] = $targetName; $aNotificationOptions['location_name'] = $locationName; $aNotificationOptions['object_id'] = $objectId; $aNotificationOptions['event_type'] = $eventType; $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions); // now the email content. $emailContent = $content->getEmailAlertContent($oNotification); $emailSubject = $content->getEmailAlertSubject($oNotification); $oEmail = new EmailAlert($emailAddress, $emailSubject, $emailContent); $oEmail->send(); } } }
function handleNotification($oKTNotification) { $oSubscriptionContent = new SubscriptionContent(); return $oSubscriptionContent->getNotificationAlertContent($oKTNotification); }