public static function sendAddMessage($messageData, $taskData, $fromUser, $toUsers, array $eventData = array()) { IncludeModuleLangFile(__FILE__); $user = CTaskNotifications::getUser($fromUser); $messageTemplate = CTaskNotifications::getGenderMessage($fromUser, "TASKS_COMMENT_MESSAGE_ADD"); //$strMsgEditComment = CTaskNotifications::getGenderMessage($occurAsUserId, "TASKS_COMMENT_MESSAGE_EDIT"); $messageTemplatePush = CTaskNotifications::getGenderMessage($fromUser, "TASKS_COMMENT_MESSAGE_ADD_PUSH"); // in comment messages we can get BBCODEs that are not supported by IM. rip them out. also limit text length to 100 $message = CTaskNotifications::clearNotificationText($messageData['POST_MESSAGE']); $messageCropped = self::cropMessage($message); CTaskNotifications::SendMessageEx($taskData["ID"], $fromUser, $toUsers, array('INSTANT' => str_replace(array("#TASK_TITLE#", "#TASK_COMMENT_TEXT#"), array($taskData["TITLE"], '[COLOR=#000000]' . $messageCropped . '[/COLOR]'), $messageTemplate), 'EMAIL' => str_replace(array("#TASK_TITLE#", "#TASK_COMMENT_TEXT#"), array($taskData["TITLE"], $message), $messageTemplate), 'PUSH' => CTaskNotifications::cropMessage($messageTemplatePush, array('USER_NAME' => CUser::FormatName(CSite::GetNameFormat(false), $user), 'TASK_TITLE' => $taskData["TITLE"], 'TASK_COMMENT_TEXT' => html_entity_decode(CTextParser::clearAllTags($message))), CTaskNotifications::PUSH_MESSAGE_MAX_LENGTH)), array('ENTITY_CODE' => 'COMMENT', 'EVENT_DATA' => $eventData, 'NOTIFY_EVENT' => 'comment', 'NOTIFY_ANSWER' => true, 'TASK_URL' => array('PARAMETERS' => array('MID' => $messageData['ID']), 'HASH' => 'message' . $messageData['ID']))); }
private static function makePushMessage($messageCode, $userId, array $taskData) { $messageCode = self::getGenderMessage($userId, $messageCode . '_PUSH'); $user = self::getUser($userId); $taskName = self::formatTaskName($taskData['ID'], $taskData['TITLE'], $taskData['GROUP_ID'], false); return CTaskNotifications::cropMessage($messageCode, array('USER_NAME' => CUser::FormatName(CSite::GetNameFormat(false), $user), 'TASK_TITLE' => $taskName), CTaskNotifications::PUSH_MESSAGE_MAX_LENGTH); }