Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Static Public Member Functions | |
static | block_contacts ($userids, $userid=0) |
Block contacts. More... | |
static | block_contacts_is_deprecated () |
Marking the method as deprecated. More... | |
static | block_contacts_parameters () |
Block contacts parameters description. More... | |
static | block_contacts_returns () |
Block contacts return description. More... | |
static | block_user (int $userid, int $blockeduserid) |
Blocks a user. More... | |
static | block_user_parameters () |
Block user parameters description. More... | |
static | block_user_returns () |
Block user return description. More... | |
static | call_external_function ($function, $args, $ajaxonly=false) |
Call an external function validating all params/returns correctly. More... | |
static | clean_returnvalue (external_description $description, $response) |
Clean response If a response attribute is unknown from the description, we just ignore the attribute. More... | |
static | confirm_contact_request (int $userid, int $requesteduserid) |
Confirm a contact request. More... | |
static | confirm_contact_request_parameters () |
Confirm a contact request parameters description. More... | |
static | confirm_contact_request_returns () |
Confirm a contact request return description. More... | |
static | create_contact_request (int $userid, int $requesteduserid) |
Creates a contact request. More... | |
static | create_contact_request_parameters () |
Creates a contact request parameters description. More... | |
static | create_contact_request_returns () |
Creates a contact request return description. More... | |
static | create_contacts ($userids, $userid=0) |
Create contacts. More... | |
static | create_contacts_is_deprecated () |
Marking the method as deprecated. More... | |
static | create_contacts_parameters () |
Create contacts parameters description. More... | |
static | create_contacts_returns () |
Create contacts return description. More... | |
static | data_for_messagearea_contacts ($userid, $limitfrom=0, $limitnum=0) |
Get messagearea contacts parameters. More... | |
static | data_for_messagearea_contacts_is_deprecated () |
Marking the method as deprecated. More... | |
static | data_for_messagearea_contacts_parameters () |
The messagearea contacts return parameters. More... | |
static | data_for_messagearea_contacts_returns () |
The messagearea contacts return structure. More... | |
static | data_for_messagearea_conversations ($userid, $limitfrom=0, $limitnum=0) |
Get messagearea conversations. More... | |
static | data_for_messagearea_conversations_is_deprecated () |
Marking the method as deprecated. More... | |
static | data_for_messagearea_conversations_parameters () |
The messagearea conversations parameters. More... | |
static | data_for_messagearea_conversations_returns () |
The messagearea conversations return structure. More... | |
static | data_for_messagearea_get_most_recent_message ($currentuserid, $otheruserid) |
Get the most recent message in a conversation. More... | |
static | data_for_messagearea_get_most_recent_message_is_deprecated () |
Marking the method as deprecated. More... | |
static | data_for_messagearea_get_most_recent_message_parameters () |
The get most recent message return parameters. More... | |
static | data_for_messagearea_get_most_recent_message_returns () |
The get most recent message return structure. More... | |
static | data_for_messagearea_get_profile ($currentuserid, $otheruserid) |
Get the profile information for a contact. More... | |
static | data_for_messagearea_get_profile_is_deprecated () |
Marking the method as deprecated. More... | |
static | data_for_messagearea_get_profile_parameters () |
The get profile parameters. More... | |
static | data_for_messagearea_get_profile_returns () |
The get profile return structure. More... | |
static | data_for_messagearea_messages ($currentuserid, $otheruserid, $limitfrom=0, $limitnum=0, $newest=false, $timefrom=0) |
Get messagearea messages. More... | |
static | data_for_messagearea_messages_is_deprecated () |
Marking the method as deprecated. More... | |
static | data_for_messagearea_messages_parameters () |
The messagearea messages parameters. More... | |
static | data_for_messagearea_messages_returns () |
The messagearea messages return structure. More... | |
static | data_for_messagearea_search_messages ($userid, $search, $limitfrom=0, $limitnum=0) |
Get messagearea search messages results. More... | |
static | data_for_messagearea_search_messages_parameters () |
Get messagearea search messages parameters. More... | |
static | data_for_messagearea_search_messages_returns () |
Get messagearea search messages returns. More... | |
static | data_for_messagearea_search_users ($userid, $search, $limitnum=0) |
Get messagearea search users results. More... | |
static | data_for_messagearea_search_users_in_course ($userid, $courseid, $search, $limitfrom=0, $limitnum=0) |
Get messagearea search users in course results. More... | |
static | data_for_messagearea_search_users_in_course_is_deprecated () |
Marking the method as deprecated. More... | |
static | data_for_messagearea_search_users_in_course_parameters () |
Get messagearea search users in course parameters. More... | |
static | data_for_messagearea_search_users_in_course_returns () |
Get messagearea search users in course returns. More... | |
static | data_for_messagearea_search_users_is_deprecated () |
Marking the method as deprecated. More... | |
static | data_for_messagearea_search_users_parameters () |
Get messagearea search users parameters. More... | |
static | data_for_messagearea_search_users_returns () |
Get messagearea search users returns. More... | |
static | decline_contact_request (int $userid, int $requesteduserid) |
Declines a contact request. More... | |
static | decline_contact_request_parameters () |
Declines a contact request parameters description. More... | |
static | decline_contact_request_returns () |
Declines a contact request return description. More... | |
static | delete_contacts ($userids, $userid=0) |
Delete contacts. More... | |
static | delete_contacts_parameters () |
Delete contacts parameters description. More... | |
static | delete_contacts_returns () |
Delete contacts return description. More... | |
static | delete_conversation ($userid, $otheruserid) |
Deletes a conversation. More... | |
static | delete_conversation_is_deprecated () |
Marking the method as deprecated. More... | |
static | delete_conversation_parameters () |
Returns description of method parameters. More... | |
static | delete_conversation_returns () |
Returns description of method result value. More... | |
static | delete_conversations_by_id ($userid, array $conversationids) |
Deletes a conversation. More... | |
static | delete_conversations_by_id_parameters () |
Returns description of method parameters. More... | |
static | delete_conversations_by_id_returns () |
Returns description of method result value. More... | |
static | delete_message ($messageid, $userid, $read=true) |
Deletes a message. More... | |
static | delete_message_for_all_users (int $messageid, int $userid) |
Deletes a message for all users. More... | |
static | delete_message_for_all_users_parameters () |
Returns description of method parameters. More... | |
static | delete_message_for_all_users_returns () |
Returns description of method result value. More... | |
static | delete_message_parameters () |
Returns description of method parameters. More... | |
static | delete_message_returns () |
Returns description of method result value. More... | |
static | external_function_info ($function, $strictness=MUST_EXIST) |
Returns detailed function information. More... | |
static | get_blocked_users ($userid) |
Retrieve a list of users blocked. More... | |
static | get_blocked_users_parameters () |
Get blocked users parameters description. More... | |
static | get_blocked_users_returns () |
Get blocked users return description. More... | |
static | get_contact_requests (int $userid, int $limitfrom=0, int $limitnum=0) |
Handles returning the contact requests for a user. More... | |
static | get_contact_requests_parameters () |
Returns contact requests parameters description. More... | |
static | get_contact_requests_returns () |
Returns the contact requests return description. More... | |
static | get_contacts () |
Get contacts. More... | |
static | get_contacts_is_deprecated () |
Marking the method as deprecated. More... | |
static | get_contacts_parameters () |
Get contacts parameters description. More... | |
static | get_contacts_returns () |
Get contacts return description. More... | |
static | get_conversation (int $userid, int $conversationid, bool $includecontactrequests=false, bool $includeprivacyinfo=false, int $memberlimit=0, int $memberoffset=0, int $messagelimit=0, int $messageoffset=0, bool $newestmessagesfirst=true) |
Get a single conversation. More... | |
static | get_conversation_between_users (int $userid, int $otheruserid, bool $includecontactrequests=false, bool $includeprivacyinfo=false, int $memberlimit=0, int $memberoffset=0, int $messagelimit=0, int $messageoffset=0, bool $newestmessagesfirst=true) |
Get a single conversation between users. More... | |
static | get_conversation_between_users_parameters () |
Get conversation parameters. More... | |
static | get_conversation_between_users_returns () |
Get conversation returns. More... | |
static | get_conversation_counts (int $userid) |
Returns an array of conversation counts for the various types of conversations, including favourites. More... | |
static | get_conversation_counts_parameters () |
Returns description of method parameters for get_conversation_counts() method. More... | |
static | get_conversation_counts_returns () |
Get conversation counts return description. More... | |
static | get_conversation_members (int $userid, int $conversationid, bool $includecontactrequests=false, bool $includeprivacyinfo=false, int $limitfrom=0, int $limitnum=0) |
Returns a list of conversation members. More... | |
static | get_conversation_members_parameters () |
Returns get conversation members parameters description. More... | |
static | get_conversation_members_returns () |
Returns the get conversation members return description. More... | |
static | get_conversation_messages (int $currentuserid, int $convid, int $limitfrom=0, int $limitnum=0, bool $newest=false, int $timefrom=0) |
Get conversation messages. More... | |
static | get_conversation_messages_parameters () |
The conversation messages parameters. More... | |
static | get_conversation_messages_returns () |
The messagearea messages return structure. More... | |
static | get_conversation_parameters () |
Get conversation parameters. More... | |
static | get_conversation_returns () |
Get conversation returns. More... | |
static | get_conversations ($userid, $limitfrom=0, $limitnum=0, int $type=null, bool $favourites=null, bool $mergeself=false) |
Get the list of conversations for the user. More... | |
static | get_conversations_parameters () |
Get conversations parameters. More... | |
static | get_conversations_returns () |
Get conversations returns. More... | |
static | get_member_info (int $referenceuserid, array $userids, bool $includecontactrequests=false, bool $includeprivacyinfo=false) |
Returns conversation member info for the supplied users, relative to the supplied referenceuserid. More... | |
static | get_member_info_parameters () |
Returns description of method parameters for get_member_info() method. More... | |
static | get_member_info_returns () |
Get member info return description. More... | |
static | get_message_processor ($userid=0, $name) |
Get a message processor. More... | |
static | get_message_processor_parameters () |
Returns description of method parameters. More... | |
static | get_message_processor_returns () |
Returns description of method result value. More... | |
static | get_messages ($useridto, $useridfrom=0, $type='both', $read=true, $newestfirst=true, $limitfrom=0, $limitnum=0) |
Get messages function implementation. More... | |
static | get_messages_parameters () |
Get messages parameters description. More... | |
static | get_messages_returns () |
Get messages return description. More... | |
static | get_received_contact_requests_count (int $userid) |
Returns the number of contact requests the user has received. More... | |
static | get_received_contact_requests_count_parameters () |
Returns the number of contact requests the user has received parameters description. More... | |
static | get_received_contact_requests_count_returns () |
Returns the number of contact requests the user has received return description. More... | |
static | get_self_conversation (int $userid, int $messagelimit=0, int $messageoffset=0, bool $newestmessagesfirst=true) |
Get a single self-conversation. More... | |
static | get_self_conversation_parameters () |
Get self-conversation parameters. More... | |
static | get_self_conversation_returns () |
Get conversation returns. More... | |
static | get_unread_conversation_counts (int $userid) |
Returns an array of unread conversation counts for the various types of conversations, including favourites. More... | |
static | get_unread_conversation_counts_parameters () |
Returns description of method parameters for get_unread_conversation_counts() method. More... | |
static | get_unread_conversation_counts_returns () |
Get unread conversation counts return description. More... | |
static | get_unread_conversations_count ($useridto) |
Get unread messages count function. More... | |
static | get_unread_conversations_count_parameters () |
Get unread conversations count parameters description. More... | |
static | get_unread_conversations_count_returns () |
Get unread conversations count return description. More... | |
static | get_user_contacts (int $userid, int $limitfrom=0, int $limitnum=0) |
Get user contacts. More... | |
static | get_user_contacts_parameters () |
The user contacts return parameters. More... | |
static | get_user_contacts_returns () |
The user contacts return structure. More... | |
static | get_user_message_preferences ($userid=0) |
Get the notification preferences for a given user. More... | |
static | get_user_message_preferences_parameters () |
Returns description of method parameters. More... | |
static | get_user_message_preferences_returns () |
Returns description of method result value. More... | |
static | get_user_notification_preferences ($userid=0) |
Get the notification preferences for a given user. More... | |
static | get_user_notification_preferences_parameters () |
Returns description of method parameters. More... | |
static | get_user_notification_preferences_returns () |
Returns description of method result value. More... | |
static | mark_all_conversation_messages_as_read (int $userid, int $conversationid) |
Mark all conversation messages as read function. More... | |
static | mark_all_conversation_messages_as_read_parameters () |
Mark all conversation messages as read parameters description. More... | |
static | mark_all_conversation_messages_as_read_returns () |
Mark all conversation messages as read return description. More... | |
static | mark_all_messages_as_read ($useridto, $useridfrom) |
Mark all messages as read function. More... | |
static | mark_all_messages_as_read_is_deprecated () |
Marking the method as deprecated. More... | |
static | mark_all_messages_as_read_parameters () |
Mark all messages as read parameters description. More... | |
static | mark_all_messages_as_read_returns () |
Mark all messages as read return description. More... | |
static | mark_all_notifications_as_read ($useridto, $useridfrom) |
Mark all notifications as read function. More... | |
static | mark_all_notifications_as_read_parameters () |
Mark all notifications as read parameters description. More... | |
static | mark_all_notifications_as_read_returns () |
Mark all notifications as read return description. More... | |
static | mark_message_read ($messageid, $timeread) |
Mark a single message as read, trigger message_viewed event. More... | |
static | mark_message_read_parameters () |
Returns description of method parameters. More... | |
static | mark_message_read_returns () |
Returns description of method result value. More... | |
static | mark_notification_read ($notificationid, $timeread) |
Mark a single notification as read. More... | |
static | mark_notification_read_parameters () |
Returns description of method parameters. More... | |
static | mark_notification_read_returns () |
Returns description of method result value. More... | |
static | message_processor_config_form ($userid, $name, $formvalues) |
Processes a message processor config form. More... | |
static | message_processor_config_form_parameters () |
Returns description of method parameters. More... | |
static | message_processor_config_form_returns () |
Returns description of method result value. More... | |
static | message_search_users ($userid, $search, $limitfrom=0, $limitnum=0) |
Get search users results. More... | |
static | message_search_users_parameters () |
Get messagearea message search users parameters. More... | |
static | message_search_users_returns () |
Get messagearea message search users returns. More... | |
static | mute_conversations (int $userid, array $conversationids) |
Mutes conversations. More... | |
static | mute_conversations_parameters () |
Mute conversations parameters description. More... | |
static | mute_conversations_returns () |
Mute conversations return description. More... | |
static | search_contacts ($searchtext, $onlymycourses=false) |
Search contacts. More... | |
static | search_contacts_parameters () |
Search contacts parameters description. More... | |
static | search_contacts_returns () |
Search contacts return description. More... | |
static | send_instant_messages ($messages=array()) |
Send private messages from the current USER to other users. More... | |
static | send_instant_messages_parameters () |
Returns description of method parameters. More... | |
static | send_instant_messages_returns () |
Returns description of method result value. More... | |
static | send_messages_to_conversation (int $conversationid, array $messages=[]) |
Send messages from the current USER to a conversation. More... | |
static | send_messages_to_conversation_parameters () |
Returns description of method parameters. More... | |
static | send_messages_to_conversation_returns () |
Returns description of method result value. More... | |
static | set_context_restriction ($context) |
Set context restriction for all following subsequent function calls. More... | |
static | set_favourite_conversations (int $userid, array $conversationids) |
Favourite a conversation, or list of conversations for a user. More... | |
static | set_favourite_conversations_parameters () |
Returns description of method parameters for the favourite_conversations() method. More... | |
static | set_favourite_conversations_returns () |
Return a description of the returns for the create_user_favourite_conversations() method. More... | |
static | set_timeout ($seconds=360) |
This method has to be called before every operation that takes a longer time to finish! More... | |
static | unblock_contacts ($userids, $userid=0) |
Unblock contacts. More... | |
static | unblock_contacts_is_deprecated () |
Marking the method as deprecated. More... | |
static | unblock_contacts_parameters () |
Unblock contacts parameters description. More... | |
static | unblock_contacts_returns () |
Unblock contacts return description. More... | |
static | unblock_user (int $userid, int $unblockeduserid) |
Unblock user. More... | |
static | unblock_user_parameters () |
Unblock user parameters description. More... | |
static | unblock_user_returns () |
Unblock user return description. More... | |
static | unmute_conversations (int $userid, array $conversationids) |
Unmute conversations. More... | |
static | unmute_conversations_parameters () |
Unmute conversations parameters description. More... | |
static | unmute_conversations_returns () |
Unmute conversations return description. More... | |
static | unset_favourite_conversations (int $userid, array $conversationids) |
Unfavourite a conversation, or list of conversations for a user. More... | |
static | unset_favourite_conversations_parameters () |
Returns description of method parameters for unfavourite_conversations() method. More... | |
static | unset_favourite_conversations_returns () |
Unset favourite conversations return description. More... | |
static | validate_context ($context) |
Makes sure user may execute functions in this context. More... | |
static | validate_parameters (external_description $description, $params) |
Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown. More... | |
Static Protected Member Functions | |
static | get_context_from_params ($param) |
Get context from passed parameters. More... | |
static | get_context_parameters () |
Returns a prepared structure to use a context parameters. More... | |
static | get_preferences_structure () |
Returns a notification or message preference structure. More... | |
static | validate_preferences_permissions ($userid) |
Check that the user has enough permission to retrieve message or notifications preferences. More... | |
|
static |
Block contacts.
array | $userids | array of user IDs. |
int | $userid | The id of the user we are blocking the contacts for |
external_description |
|
static |
Marking the method as deprecated.
bool |
|
static |
Block contacts parameters description.
external_function_parameters |
|
static |
Block contacts return description.
external_description |
|
static |
Blocks a user.
int | $userid | The id of the user who is blocking |
int | $blockeduserid | The id of the user being blocked |
external_description |
|
static |
Block user parameters description.
external_function_parameters |
|
static |
Block user return description.
external_description |
|
staticinherited |
Call an external function validating all params/returns correctly.
Note that an external function may modify the state of the current page, so this wrapper saves and restores tha PAGE and COURSE global variables before/after calling the external function.
string | $function | A webservice function name. |
array | $args | Params array (named params) |
boolean | $ajaxonly | If true, an extra check will be peformed to see if ajax is required. |
array | containing keys for error (bool), exception and data. |
|
staticinherited |
Clean response If a response attribute is unknown from the description, we just ignore the attribute.
If a response attribute is incorrect, invalid_response_exception is thrown. Note: this function is similar to validate parameters, however it is distinct because parameters validation must be distinct from cleaning return values.
external_description | $description | description of the return values |
mixed | $response | the actual response |
mixed | response with added defaults for optional items, invalid_response_exception thrown if any problem found |
|
static |
Confirm a contact request.
int | $userid | The id of the user who is creating the contact request |
int | $requesteduserid | The id of the user being requested |
|
static |
Confirm a contact request parameters description.
external_function_parameters |
|
static |
Confirm a contact request return description.
external_description |
|
static |
Creates a contact request.
int | $userid | The id of the user who is creating the contact request |
int | $requesteduserid | The id of the user being requested |
|
static |
Creates a contact request parameters description.
external_function_parameters |
|
static |
Creates a contact request return description.
external_description |
|
static |
Create contacts.
array | $userids | array of user IDs. |
int | $userid | The id of the user we are creating the contacts for |
external_description |
|
static |
Marking the method as deprecated.
bool |
|
static |
Create contacts parameters description.
external_function_parameters |
|
static |
Create contacts return description.
external_description |
|
static |
Get messagearea contacts parameters.
int | $userid | The id of the user who we are viewing conversations for |
int | $limitfrom | |
int | $limitnum |
stdClass |
moodle_exception |
|
static |
Marking the method as deprecated.
bool |
|
static |
The messagearea contacts return parameters.
external_function_parameters |
|
static |
The messagearea contacts return structure.
external_single_structure |
|
static |
Get messagearea conversations.
NOTE FOR FINAL DEPRECATION: When removing this method, please also consider removal of get_conversations_legacy_formatter() from the core_message\helper class. This helper method was used solely to format the new get_conversations() return data into the old format used here, and in message/index.php. If we no longer need either of these, then that method can be removed.
int | $userid | The id of the user who we are viewing conversations for |
int | $limitfrom | |
int | $limitnum |
stdClass |
moodle_exception |
|
static |
Marking the method as deprecated.
bool |
|
static |
The messagearea conversations parameters.
external_function_parameters |
|
static |
The messagearea conversations return structure.
external_single_structure |
|
static |
Get the most recent message in a conversation.
int | $currentuserid | The current user's id |
int | $otheruserid | The other user's id |
stdClass |
moodle_exception |
|
static |
Marking the method as deprecated.
bool |
|
static |
The get most recent message return parameters.
external_function_parameters |
|
static |
The get most recent message return structure.
external_single_structure |
|
static |
Get the profile information for a contact.
int | $currentuserid | The current user's id |
int | $otheruserid | The id of the user whose profile we are viewing |
stdClass |
moodle_exception |
|
static |
Marking the method as deprecated.
bool |
|
static |
The get profile parameters.
external_function_parameters |
|
static |
The get profile return structure.
external_single_structure |
|
static |
Get messagearea messages.
int | $currentuserid | The current user's id |
int | $otheruserid | The other user's id |
int | $limitfrom | |
int | $limitnum | |
boolean | $newest |
stdClass |
moodle_exception |
|
static |
Marking the method as deprecated.
bool |
|
static |
The messagearea messages parameters.
external_function_parameters |
|
static |
The messagearea messages return structure.
external_single_structure |
|
static |
Get messagearea search messages results.
int | $userid | The id of the user who is performing the search |
string | $search | The string being searched |
int | $limitfrom | |
int | $limitnum |
stdClass |
moodle_exception |
|
static |
|
static |
|
static |
Get messagearea search users results.
int | $userid | The id of the user who is performing the search |
string | $search | The string being searched |
int | $limitnum |
stdClass |
moodle_exception |
|
static |
Get messagearea search users in course results.
int | $userid | The id of the user who is performing the search |
int | $courseid | The id of the course |
string | $search | The string being searched |
int | $limitfrom | |
int | $limitnum |
stdClass |
moodle_exception |
|
static |
Marking the method as deprecated.
bool |
|
static |
Get messagearea search users in course parameters.
external_function_parameters |
|
static |
Get messagearea search users in course returns.
external_single_structure |
|
static |
Marking the method as deprecated.
bool |
|
static |
Get messagearea search users parameters.
external_function_parameters |
|
static |
Get messagearea search users returns.
external_single_structure |
|
static |
Declines a contact request.
int | $userid | The id of the user who is creating the contact request |
int | $requesteduserid | The id of the user being requested |
|
static |
Declines a contact request parameters description.
external_function_parameters |
|
static |
Declines a contact request return description.
external_description |
|
static |
Delete contacts.
array | $userids | array of user IDs. |
int | $userid | The id of the user we are deleting the contacts for |
null |
|
static |
|
static |
|
static |
Deletes a conversation.
int | $userid | The user id of who we want to delete the conversation for |
int | $otheruserid | The user id of the other user in the conversation |
array |
moodle_exception |
|
static |
Marking the method as deprecated.
bool |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description |
|
static |
Deletes a conversation.
int | $userid | The user id of who we want to delete the conversation for |
int[] | $conversationids | The ids of the conversations |
array |
moodle_exception |
|
static |
|
static |
|
static |
Deletes a message.
int | $messageid | the message id |
int | $userid | the user id of who we want to delete the message for |
bool | $read | if is a message read (default to true) |
external_description |
moodle_exception |
|
static |
Deletes a message for all users.
int | $messageid | the message id |
int | $userid | the user id of who we want to delete the message for all users |
external_description |
moodle_exception |
|
static |
|
static |
|
static |
|
static |
|
staticinherited |
Returns detailed function information.
string | object | $function | name of external function or record from external_function |
int | $strictness | IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; MUST_EXIST means throw exception if no record or multiple records found |
stdClass | description or false if not found or exception thrown |
|
static |
Retrieve a list of users blocked.
int | $userid | the user whose blocked users we want to retrieve |
external_description |
|
static |
|
static |
|
static |
Handles returning the contact requests for a user.
This also includes the user data necessary to display information about the user.
It will not include blocked users.
int | $userid | The id of the user we want to get the contact requests for |
int | $limitfrom | |
int | $limitnum |
|
static |
Returns contact requests parameters description.
external_function_parameters |
|
static |
Returns the contact requests return description.
external_description |
|
static |
|
static |
Marking the method as deprecated.
bool |
|
static |
Get contacts parameters description.
external_function_parameters |
|
static |
Get contacts return description.
external_description |
|
staticprotectedinherited |
Get context from passed parameters.
The passed array must either contain a contextid or a combination of context level and instance id to fetch the context. For example, the context level can be "course" and instanceid can be courseid.
See context_helper::get_all_levels() for a list of valid context levels.
array | $param |
invalid_parameter_exception |
context |
|
staticprotectedinherited |
Returns a prepared structure to use a context parameters.
external_single_structure |
Reimplemented in core_competency\external, and tool_lp\external.
|
static |
Get a single conversation.
int | $userid | The user id to get the conversation for |
int | $conversationid | The id of the conversation to fetch |
bool | $includecontactrequests | Should contact requests be included between members |
bool | $includeprivacyinfo | Should privacy info be included between members |
int | $memberlimit | Limit number of members to load |
int | $memberoffset | Offset members by this amount |
int | $messagelimit | Limit number of messages to load |
int | $messageoffset | Offset the messages |
bool | $newestmessagesfirst | Order messages by newest first |
stdClass |
moodle_exception | if the messaging feature is disabled on the site. |
|
static |
Get a single conversation between users.
int | $userid | The user id to get the conversation for |
int | $otheruserid | The other user id |
bool | $includecontactrequests | Should contact requests be included between members |
bool | $includeprivacyinfo | Should privacy info be included between members |
int | $memberlimit | Limit number of members to load |
int | $memberoffset | Offset members by this amount |
int | $messagelimit | Limit number of messages to load |
int | $messageoffset | Offset the messages |
bool | $newestmessagesfirst | Order messages by newest first |
stdClass |
moodle_exception | if the messaging feature is disabled on the site. |
|
static |
Get conversation parameters.
external_function_parameters |
|
static |
Get conversation returns.
external_single_structure |
|
static |
Returns an array of conversation counts for the various types of conversations, including favourites.
Return format: [ 'favourites' => 0, 'types' => [ core_message\api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL => 0, core_message\api::MESSAGE_CONVERSATION_TYPE_GROUP => 0 ] ]
int | $userid | the id of the user whose counts we are fetching. |
array | the array of conversation counts, indexed by type. |
moodle_exception | if the current user cannot perform this action. |
|
static |
Returns description of method parameters for get_conversation_counts() method.
external_function_parameters |
|
static |
Get conversation counts return description.
external_description |
|
static |
Returns a list of conversation members.
int | $userid | The user we are returning the conversation members for, used by helper::get_member_info. |
int | $conversationid | The id of the conversation |
bool | $includecontactrequests | Do we want to include contact requests with this data? |
bool | $includeprivacyinfo | Do we want to include privacy info? |
int | $limitfrom | |
int | $limitnum |
array |
|
static |
Returns get conversation members parameters description.
external_function_parameters |
|
static |
Returns the get conversation members return description.
external_description |
|
static |
Get conversation messages.
int | $currentuserid | The current user's id. |
int | $convid | The conversation id. |
int | $limitfrom | Return a subset of records, starting at this point (optional). |
int | $limitnum | Return a subset comprising this many records in total (optional, required if $limitfrom is set). |
bool | $newest | True for getting first newest messages, false otherwise. |
int | $timefrom | The time from the conversation messages to get. |
array | The messages and members who have sent some of these messages. |
moodle_exception |
|
static |
|
static |
|
static |
Get conversation parameters.
external_function_parameters |
|
static |
Get conversation returns.
external_single_structure |
|
static |
Get the list of conversations for the user.
int | $userid | The id of the user who is performing the search |
int | $limitfrom | |
int | $limitnum | |
int | null | $type | |
bool | null | $favourites | |
bool | $mergeself | whether to include self-conversations (true) or ONLY private conversations (false) when private conversations are requested. |
stdClass |
moodle_exception | if the messaging feature is disabled on the site. |
|
static |
|
static |
|
static |
Returns conversation member info for the supplied users, relative to the supplied referenceuserid.
This is the basic structure used when returning members, and includes information about the relationship between each member and the referenceuser, such as a whether the referenceuser has marked the member as a contact, or has blocked them.
int | $referenceuserid | the id of the user which check contact and blocked status. |
array | $userids |
array | the array of objects containing member info. |
moodle_exception | if messaging is disabled or if the user cannot perform the action. |
|
static |
Returns description of method parameters for get_member_info() method.
external_function_parameters |
|
static |
Get member info return description.
external_description |
|
static |
Get a message processor.
int | $userid | |
string | $name | the name of the processor |
external_description |
moodle_exception |
|
static |
|
static |
|
static |
Get messages function implementation.
invalid_parameter_exception | |
moodle_exception |
int | $useridto | the user id who received the message |
int | $useridfrom | the user id who send the message. -10 or -20 for no-reply or support user |
string | $type | type of message to return, expected values: notifications, conversations and both |
bool | $read | true for retreiving read messages, false for unread |
bool | $newestfirst | true for ordering by newest first, false for oldest first |
int | $limitfrom | limit from |
int | $limitnum | limit num |
external_description |
|
static |
|
static |
|
staticprotected |
Returns a notification or message preference structure.
external_single_structure | the structure |
|
static |
Returns the number of contact requests the user has received.
int | $userid | The ID of the user we want to return the number of received contact requests for |
external_value |
|
static |
Returns the number of contact requests the user has received parameters description.
external_function_parameters |
|
static |
Returns the number of contact requests the user has received return description.
external_value |
|
static |
Get a single self-conversation.
int | $userid | The user id to get the self-conversation for |
int | $messagelimit | Limit number of messages to load |
int | $messageoffset | Offset the messages |
bool | $newestmessagesfirst | Order messages by newest first |
stdClass |
moodle_exception | if the messaging feature is disabled on the site. |
|
static |
Get self-conversation parameters.
external_function_parameters |
|
static |
Get conversation returns.
external_single_structure |
|
static |
Returns an array of unread conversation counts for the various types of conversations, including favourites.
Return format: [ 'favourites' => 0, 'types' => [ core_message\api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL => 0, core_message\api::MESSAGE_CONVERSATION_TYPE_GROUP => 0 ] ]
int | $userid | the id of the user whose counts we are fetching. |
array | the array of unread conversation counts, indexed by type. |
moodle_exception | if the current user cannot perform this action. |
|
static |
Returns description of method parameters for get_unread_conversation_counts() method.
external_function_parameters |
|
static |
Get unread conversation counts return description.
external_description |
|
static |
Get unread messages count function.
invalid_parameter_exception | |
moodle_exception |
int | $useridto | the user id who received the message |
external_description |
|
static |
Get unread conversations count parameters description.
external_function_parameters |
|
static |
|
static |
Get user contacts.
int | $userid | The id of the user who we are viewing conversations for |
int | $limitfrom | |
int | $limitnum |
array |
moodle_exception |
|
static |
The user contacts return parameters.
external_function_parameters |
|
static |
The user contacts return structure.
external_multiple_structure |
|
static |
Get the notification preferences for a given user.
int | $userid | id of the user, 0 for current user |
external_description |
moodle_exception |
|
static |
|
static |
|
static |
Get the notification preferences for a given user.
int | $userid | id of the user, 0 for current user |
external_description |
moodle_exception |
|
static |
|
static |
|
static |
Mark all conversation messages as read function.
int | $userid | The user id of who we want to delete the conversation for |
int | $conversationid | The id of the conversations |
|
static |
Mark all conversation messages as read parameters description.
external_function_parameters |
|
static |
|
static |
Mark all messages as read function.
invalid_parameter_exception | |
moodle_exception |
int | $useridto | the user id who received the message |
int | $useridfrom | the user id who send the message. -10 or -20 for no-reply or support user |
external_description |
|
static |
Marking the method as deprecated.
bool |
|
static |
Mark all messages as read parameters description.
external_function_parameters |
|
static |
Mark all messages as read return description.
external_single_structure |
|
static |
Mark all notifications as read function.
invalid_parameter_exception | |
moodle_exception |
int | $useridto | the user id who received the message |
int | $useridfrom | the user id who send the message. -10 or -20 for no-reply or support user |
external_description |
|
static |
Mark all notifications as read parameters description.
external_function_parameters |
|
static |
|
static |
Mark a single message as read, trigger message_viewed event.
int | $messageid | id of the message (in the message table) |
int | $timeread | timestamp for when the message should be marked read |
external_description |
invalid_parameter_exception | |
moodle_exception |
|
static |
|
static |
|
static |
Mark a single notification as read.
This will trigger a 'notification_viewed' event.
int | $notificationid | id of the notification |
int | $timeread | timestamp for when the notification should be marked read |
external_description |
invalid_parameter_exception | |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description |
|
static |
Processes a message processor config form.
int | $userid | the user id |
string | $name | the name of the processor |
array | $formvalues | the form values |
external_description |
moodle_exception |
|
static |
|
static |
|
static |
Get search users results.
int | $userid | The id of the user who is performing the search |
string | $search | The string being searched |
int | $limitfrom | |
int | $limitnum |
array |
moodle_exception |
|
static |
Get messagearea message search users parameters.
external_function_parameters |
|
static |
|
static |
Mutes conversations.
int | $userid | The id of the user who is blocking |
array | $conversationids | The list of conversations being muted |
external_description |
|
static |
Mute conversations parameters description.
external_function_parameters |
|
static |
Mute conversations return description.
external_description |
|
static |
Search contacts.
string | $searchtext | query string. |
bool | $onlymycourses | limit the search to the user's courses only. |
external_description |
|
static |
|
static |
|
static |
Send private messages from the current USER to other users.
array | $messages | An array of message to send. |
array |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Send messages from the current USER to a conversation.
This conversation may be any type of conversation, individual or group.
int | $conversationid | the id of the conversation to which the messages will be sent. |
array | $messages | An array of message to send. |
array | the array of messages which were sent (created). |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
staticinherited |
Set context restriction for all following subsequent function calls.
stdClass | $context | the context restriction |
|
static |
Favourite a conversation, or list of conversations for a user.
int | $userid | the id of the user, or 0 for the current user. |
array | $conversationids | the list of conversations ids to favourite. |
array |
moodle_exception | if messaging is disabled or if the user cannot perform the action. |
|
static |
Returns description of method parameters for the favourite_conversations() method.
external_function_parameters |
|
static |
Return a description of the returns for the create_user_favourite_conversations() method.
external_description |
|
staticinherited |
This method has to be called before every operation that takes a longer time to finish!
int | $seconds | max expected time the next operation needs |
|
static |
Unblock contacts.
array | $userids | array of user IDs. |
int | $userid | The id of the user we are unblocking the contacts for |
null |
|
static |
Marking the method as deprecated.
bool |
|
static |
Unblock contacts parameters description.
external_function_parameters |
|
static |
Unblock contacts return description.
external_description |
|
static |
Unblock user.
int | $userid | The id of the user who is unblocking |
int | $unblockeduserid | The id of the user being unblocked |
|
static |
Unblock user parameters description.
external_function_parameters |
|
static |
Unblock user return description.
external_description |
|
static |
Unmute conversations.
int | $userid | The id of the user who is unblocking |
array | $conversationids | The list of conversations being muted |
|
static |
Unmute conversations parameters description.
external_function_parameters |
|
static |
Unmute conversations return description.
external_description |
|
static |
Unfavourite a conversation, or list of conversations for a user.
int | $userid | the id of the user, or 0 for the current user. |
array | $conversationids | the list of conversations ids unset as favourites. |
array |
moodle_exception | if messaging is disabled or if the user cannot perform the action. |
|
static |
Returns description of method parameters for unfavourite_conversations() method.
external_function_parameters |
|
static |
Unset favourite conversations return description.
external_description |
|
staticinherited |
Makes sure user may execute functions in this context.
stdClass | $context |
|
staticinherited |
Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown.
This is a simple recursive method which is intended to be called from each implementation method of external API.
external_description | $description | description of parameters |
mixed | $params | the actual parameters |
mixed | params with added defaults for optional items, invalid_parameters_exception thrown if any problem found |
|
staticprotected |
Check that the user has enough permission to retrieve message or notifications preferences.
int | $userid | the user id requesting the preferences |
stdClass | full user object |
moodle_exception |