Ejemplo n.º 1
0
 function &newNotificationForDocument($oDocument, $oUser, $oState, $oActor, $sComments)
 {
     $aInfo = array();
     $aInfo['sData1'] = $oState->getName();
     $aInfo['sData2'] = $sComments;
     $aInfo['iData1'] = $oDocument->getId();
     $aInfo['iData2'] = $oActor->getId();
     $aInfo['sType'] = 'ktcore/workflow';
     $aInfo['dCreationDate'] = getCurrentDateTime();
     $aInfo['iUserId'] = $oUser->getId();
     $aInfo['sLabel'] = $oDocument->getName();
     $oNotification = KTNotification::createFromArray($aInfo);
     $handler = new KTWorkflowNotification();
     if ($oUser->getEmailNotification() && strlen($oUser->getEmail()) > 0) {
         $emailContent = $handler->handleNotification($oNotification);
         $emailSubject = sprintf(_kt('Workflow Notification: %s'), $oDocument->getName());
         $oEmail = new EmailAlert($oUser->getEmail(), $emailSubject, $emailContent);
         $oEmail->send();
     }
     return $oNotification;
 }
Ejemplo n.º 2
0
 function &newNotificationForDocument($oDocument, $oUser, $oActor, $sSubject, $sDetails)
 {
     $aInfo = array();
     $aInfo['sData1'] = $sSubject;
     $aInfo['sText1'] = $sDetails;
     $aInfo['iData1'] = $oDocument->getId();
     $aInfo['iData2'] = $oActor->getId();
     $aInfo['sType'] = 'ktcore/assist';
     $aInfo['dCreationDate'] = getCurrentDateTime();
     $aInfo['iUserId'] = $oUser->getId();
     $aInfo['sLabel'] = $oDocument->getName();
     $oNotification = KTNotification::createFromArray($aInfo);
     $handler = new KTAssistNotification();
     if ($oUser->getEmailNotification() && strlen($oUser->getEmail()) > 0) {
         $emailContent = $handler->handleNotification($oNotification);
         $emailSubject = sprintf(_kt('Assistance request: %s'), $oDocument->getName());
         $oEmail = new EmailAlert($oUser->getEmail(), $emailSubject, $emailContent);
         $oEmail->send();
     }
     return $oNotification;
 }