Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

Chat external API

Copyright: 2015 Juan Leyva <juan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 845 lines (33 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: mod_chat_external  - X-Ref

Chat external functions

login_user_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

login_user($chatid, $groupid = 0)   X-Ref
Log the current user into a chat room in the given chat.

param: int $chatid the chat instance id
param: int $groupid the user group id
return: array of warnings and the chat unique session id

login_user_returns()   X-Ref
Returns description of method result value

return: external_description

get_chat_users_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_chat_users($chatsid)   X-Ref
Get the list of users in the given chat session.

param: int $chatsid the chat session id
return: array of warnings and the user lists

get_chat_users_returns()   X-Ref
Returns description of method result value

return: external_description

send_chat_message_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

send_chat_message($chatsid, $messagetext, $beepid = '')   X-Ref
Send a message on the given chat session.

param: int $chatsid the chat session id
param: string $messagetext the message text
param: string $beepid the beep message id
return: array of warnings and the new message id (0 if the message was empty)

send_chat_message_returns()   X-Ref
Returns description of method result value

return: external_description

get_chat_latest_messages_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_chat_latest_messages($chatsid, $chatlasttime = 0)   X-Ref
Get the latest messages from the given chat session.

param: int $chatsid the chat session id
param: int $chatlasttime last time messages were retrieved (epoch time)
return: array of warnings and the new message id (0 if the message was empty)

get_chat_latest_messages_returns()   X-Ref
Returns description of method result value

return: external_description

view_chat_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

view_chat($chatid)   X-Ref
Trigger the course module viewed event and update the module completion status.

param: int $chatid the chat instance id
return: array of warnings and status result

view_chat_returns()   X-Ref
Returns description of method result value

return: external_description

get_chats_by_courses_parameters()   X-Ref
Describes the parameters for get_chats_by_courses.

return: external_function_parameters

get_chats_by_courses($courseids = array()   X-Ref
Returns a list of chats in a provided list of courses,
if no list is provided all chats that the user can view will be returned.

param: array $courseids the course ids
return: array of chats details

get_chats_by_courses_returns()   X-Ref
Describes the get_chats_by_courses return value.

return: external_single_structure

get_sessions_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_sessions($chatid, $groupid = 0, $showall = false)   X-Ref
Retrieves chat sessions for a given chat.

param: int $chatid the chat instance id
param: int $groupid filter messages by this group. 0 to determine the group.
param: bool $showall whether to include incomplete sessions or not
return: array of warnings and the sessions

get_sessions_returns()   X-Ref
Returns description of method result value

return: external_description

get_session_messages_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_session_messages($chatid, $sessionstart, $sessionend, $groupid = 0)   X-Ref
Retrieves messages of the given chat session.

param: int $chatid the chat instance id
param: int $sessionstart the session start time (timestamp)
param: int $sessionend the session end time (timestamp)
param: int $groupid filter messages by this group. 0 to determine the group.
return: array of warnings and the messages

get_session_messages_returns()   X-Ref
Returns description of method result value

return: external_description