Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Class api is the public endpoint of the communication api. More...
Public Member Functions | |
add_members_to_room (array $userids, bool $queue=true) | |
Create a communication ad-hoc task for add members operation and add the user mapping. | |
create_and_configure_room (string $communicationroomname, ?\stored_file $avatar=null, ?\stdClass $instance=null,) | |
Create a communication ad-hoc task for create operation. | |
delete_room () | |
Create a communication ad-hoc task for delete operation. | |
form_definition (MoodleQuickForm $mform, string $selectdefaultcommunication=processor::PROVIDER_NONE) | |
Define the form elements for the communication api. | |
form_definition_for_provider (\MoodleQuickForm $mform, string $provider=processor::PROVIDER_NONE) | |
Set the form definitions for the plugins. | |
get_avatar () | |
Get the avatar file. | |
get_communication_room_url () | |
Get the communication room url. | |
get_form_provider () | |
Return the form provider. | |
get_processor () | |
Return the underlying communication processor object. | |
get_provider () | |
Get the communication provider. | |
get_room_name () | |
A helper to fetch the room name. | |
get_room_provider () | |
Return the room provider. | |
get_room_user_provider () | |
Return the room user provider. | |
get_user_provider () | |
Return the user provider. | |
reload () | |
Reload in the internal instance data. | |
remove_members_from_room (array $userids, bool $queue=true) | |
Create a communication ad-hoc task for remove members operation or action immediately. | |
set_avatar (?\stored_file $avatar) | |
Get the avatar file. | |
set_data (\stdClass $instance) | |
Set the form data if the data is already available. | |
show_communication_room_status_notification () | |
Display the communication room status notification. | |
update_room (?int $active=null, ?string $communicationroomname=null, ?\stored_file $avatar=null, ?\stdClass $instance=null,) | |
Create a communication ad-hoc task for update operation. | |
update_room_membership (array $userids, bool $queue=true) | |
Create a communication ad-hoc task for updating members operation and update the user mapping. | |
Static Public Member Functions | |
static | get_communication_plugin_list_for_form () |
Get the list of plugins for form selection. | |
static | get_enabled_providers_and_default (string $selecteddefaulprovider=null) |
Get the enabled communication providers and default provider according to the selected provider. | |
static | is_available () |
Check if the communication api is enabled. | |
static | load_by_instance (context $context, string $component, string $instancetype, int $instanceid, ?string $provider=null,) |
Get the communication processor object. | |
Protected Member Functions | |
get_avatar_filerecord (string $filename) | |
Get the avatar file record for the avatar for filesystem. | |
Class api is the public endpoint of the communication api.
This class is the point of contact for api usage.
Communication api allows to add ad-hoc tasks to the queue to perform actions on the communication providers. This api will not allow any immediate actions to be performed on the communication providers. It will only add the tasks to the queue. The exception has been made for deletion of members in case of deleting the user. This is because the user will not be available. The member management api part allows run actions immediately if required.
Communication api does allow to have form elements related to communication api in the required forms. This is done by using the form_definition method. This method will add the form elements to the form.
core_communication\api::add_members_to_room | ( | array | $userids, |
bool | $queue = true ) |
Create a communication ad-hoc task for add members operation and add the user mapping.
This method will add a task to the queue to add the room users.
array | $userids | The user ids to add to the room |
bool | $queue | Whether to queue the task or not |
core_communication\api::create_and_configure_room | ( | string | $communicationroomname, |
?\stored_file | $avatar = null, | ||
?\stdClass | $instance = null ) |
Create a communication ad-hoc task for create operation.
This method will add a task to the queue to create the room.
string | $communicationroomname | The communication room name |
null | stored_file | $avatar | The stored file for the avatar |
stdClass | null | $instance | The actual instance object |
core_communication\api::delete_room | ( | ) |
Create a communication ad-hoc task for delete operation.
This method will add a task to the queue to delete the room.
core_communication\api::form_definition | ( | MoodleQuickForm | $mform, |
string | $selectdefaultcommunication = processor::PROVIDER_NONE ) |
Define the form elements for the communication api.
This method will be called from the form definition method of the instance.
MoodleQuickForm | $mform | The form element |
string | $selectdefaultcommunication | The default selected communication provider in the form field |
core_communication\api::form_definition_for_provider | ( | \MoodleQuickForm | $mform, |
string | $provider = processor::PROVIDER_NONE ) |
Set the form definitions for the plugins.
MoodleQuickForm | $mform | The moodle form |
string | $provider | The provider name |
core_communication\api::get_avatar | ( | ) |
Get the avatar file.
null|stored_file |
|
protected |
Get the avatar file record for the avatar for filesystem.
string | $filename | The filename of the avatar |
stdClass |
|
static |
Get the list of plugins for form selection.
array |
core_communication\api::get_communication_room_url | ( | ) |
Get the communication room url.
string|null |
|
static |
Get the enabled communication providers and default provider according to the selected provider.
string | null | $selecteddefaulprovider |
array |
core_communication\api::get_form_provider | ( | ) |
Return the form provider.
core_communication\form_provider |
core_communication\api::get_processor | ( | ) |
Return the underlying communication processor object.
processor |
core_communication\api::get_provider | ( | ) |
Get the communication provider.
string |
core_communication\api::get_room_name | ( | ) |
A helper to fetch the room name.
string |
core_communication\api::get_room_provider | ( | ) |
Return the room provider.
core_communication\room_chat_provider |
core_communication\api::get_room_user_provider | ( | ) |
Return the room user provider.
core_communication\room_user_provider |
core_communication\api::get_user_provider | ( | ) |
Return the user provider.
core_communication\user_provider |
|
static |
Get the communication processor object.
context | $context | The context of the item for the instance |
string | $component | The component of the item for the instance |
string | $instancetype | The type of the item for the instance |
int | $instanceid | The id of the instance |
string | null | $provider | The provider type - if null will load for this context's active provider. |
api |
core_communication\api::remove_members_from_room | ( | array | $userids, |
bool | $queue = true ) |
Create a communication ad-hoc task for remove members operation or action immediately.
This method will add a task to the queue to remove the room users.
array | $userids | The user ids to remove from the room |
bool | $queue | Whether to queue the task or not |
core_communication\api::set_avatar | ( | ?\stored_file | $avatar | ) |
Get the avatar file.
If null is set, then delete the old area file and set the avatarfilename to null. This will make sure the plugin api deletes the avatar from the room.
null | stored_file | $avatar | The stored file for the avatar |
bool |
core_communication\api::set_data | ( | \stdClass | $instance | ) |
Set the form data if the data is already available.
stdClass | $instance | The instance object |
core_communication\api::update_room | ( | ?int | $active = null, |
?string | $communicationroomname = null, | ||
?\stored_file | $avatar = null, | ||
?\stdClass | $instance = null ) |
Create a communication ad-hoc task for update operation.
This method will add a task to the queue to update the room.
null | int | $active | The selected active state of the provider |
null | string | $communicationroomname | The communication room name |
null | stored_file | $avatar | The stored file for the avatar |
stdClass | null | $instance | The actual instance object |
core_communication\api::update_room_membership | ( | array | $userids, |
bool | $queue = true ) |
Create a communication ad-hoc task for updating members operation and update the user mapping.
This method will add a task to the queue to update the room users.
array | $userids | The user ids to add to the room |
bool | $queue | Whether to queue the task or not |