public static function trigger() { $notificationSetting = new Notifications(); if (func_num_args() > 0 && $notificationSetting->validNotificationType(func_get_arg(0))) { $funcArgs = func_get_args(); $notificationType = $funcArgs[0]; if ($notificationSetting->validNotificationType($notificationType)) { switch ($notificationType) { case 'profile_post_comment': // funcArgs[1] is JTable $comment (#__stream_comment) self::sendCommentAdd($notificationType, $funcArgs[1]); break; case 'profile_like_post': // funcArgs[1] is JTable $message (#__stream) self::sendMessageLike($notificationType, $funcArgs[1]); break; case 'profile_mention_update': case 'profile_mention_todo': case 'profile_mention_event': case 'profile_mention_milestone': // funcArgs[1] is JTable $message (#__stream) // funcArgs[2] is group_id $streamTable = $funcArgs[1]; $groupId = $funcArgs[2]; // Perform Name Mention Notification Trigger $mentionedUserId = StreamMessage::getMentionUserId($streamTable->message); if (!empty($mentionedUserId)) { self::sendMentionName($notificationType, $mentionedUserId, $streamTable, $groupId); } break; /************************************************************************************************* * * GROUP NOTIFICATION SECTION * ************************************************************************************************/ /************************************************************************************************* * * GROUP NOTIFICATION SECTION * ************************************************************************************************/ case 'group_join': case 'group_follow': // funcArgs[1] is JTable $group (#__groups) // funcArgs[1] is JTable $actor (#__users) $action = explode('_', $notificationType); self::sendGroupJoinFollow($notificationType, $funcArgs[1], $funcArgs[2], $action[1]); break; case 'group_add_update': case 'group_add_todo': case 'group_add_event': case 'group_add_milestone': // funcArgs[1] is JTable $group (#__groups) // funcArgs[2] is JTable $stream (#__stream) self::sendGroupAddContent($notificationType, $funcArgs[1], $funcArgs[2]); break; /************************************************************************************************* * * EVENT NOTIFICATION SECTION * ************************************************************************************************/ /************************************************************************************************* * * EVENT NOTIFICATION SECTION * ************************************************************************************************/ case 'event_join': // funcArgs[1] is JTable $todo (#__stream) self::sendEventJoin($notificationType, $funcArgs[1]); break; /************************************************************************************************* * * TODO NOTIFICATION SECTION * ************************************************************************************************/ /************************************************************************************************* * * TODO NOTIFICATION SECTION * ************************************************************************************************/ case 'todo_complete_item': // funcArgs[1] is JTable $todo (#__stream) // funcArgs[2] is the actor (#__users) // funcArgs[3] is the index of the item in todo self::sendTodoCompleteItem($notificationType, $funcArgs[1], $funcArgs[2], $funcArgs[3]); break; /************************************************************************************************* * * FILE NOTIFICATION SECTION * ************************************************************************************************/ /************************************************************************************************* * * FILE NOTIFICATION SECTION * ************************************************************************************************/ case 'file_replace_new': // funcArgs[1] is JTable $file (#__stream_files) self::sendFileReplaceNew($notificationType, $funcArgs[1], $funcArgs[2]); break; /************************************************************************************************* * * DIRECT/PRIVATE MESSAGING * ************************************************************************************************/ /************************************************************************************************* * * DIRECT/PRIVATE MESSAGING * ************************************************************************************************/ case 'direct_message_new': // funcArgs[1] is JTable $group (#__groups) // funcArgs[2] is JTable $stream (#__stream) self::sendDirectMessageNew($notificationType, $funcArgs[1], $funcArgs[2]); break; } } } return false; }