Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Class: processor  - X-Ref

Class processor to manage the base operations of the providers.

This class is responsible for creating, updating, deleting and loading the communication instance, associated actions.

__construct(private stdClass $instancedata,)   X-Ref
Communication processor constructor.

param: stdClass $instancedata The instance data object

create_instance(context $context,string $provider,int $instanceid,string $component,string $instancetype,string $roomname,)   X-Ref
Create communication instance.

param: context $context The context of the item for the instance
param: string $provider The communication provider
param: int $instanceid The instance id
param: string $component The component name
param: string $instancetype The instance type
param: string $roomname The room name
return: processor|null

update_instance(?string $active = null,?string $roomname = null,)   X-Ref
Update the communication instance with any changes.

param: null|int $active Active state of the instance (processor::PROVIDER_ACTIVE or processor::PROVIDER_INACTIVE)
param: null|string $roomname The room name

delete_instance()   X-Ref
Delete communication data.


get_instance_userids(bool $synced = false, bool $deleted = false)   X-Ref
Get non synced instance user ids for the instance.

param: bool $synced The synced status
param: bool $deleted The deleted status
return: array

get_all_userids_for_instance()   X-Ref
Get existing instance user ids.

return: array

get_all_delete_flagged_userids()   X-Ref
Get all the user ids flagged as deleted.

return: array

create_instance_user_mapping(array $userids)   X-Ref
Create communication user record for mapping and sync.

param: array $userids The user ids

mark_users_as_not_deleted(array $userids)   X-Ref
Mark users as not deleted for the instance.

param: array $userids The user ids

mark_users_as_synced(array $userids)   X-Ref
Mark users as synced for the instance.

param: array $userids The user ids

reset_users_sync_flag(array $userids)   X-Ref
Reset users sync flag for the instance.

param: array $userids The user ids

add_delete_user_flag(array $userids)   X-Ref
Delete users flag for the instance users.

param: array $userids The user ids

delete_instance_user_mapping(array $userids)   X-Ref
Delete communication user record for userid.

param: array $userids The user ids

delete_instance_non_synced_user_mapping(array $userids)   X-Ref
Delete communication user record for userid who are not synced.

param: array $userids The user ids

delete_user_mappings_for_instance()   X-Ref
Delete communication user record for instance.


load_by_id(int $id)   X-Ref
Load communication instance by id.

param: int $id The communication instance id
return: processor|null

load_by_instance(context $context,string $component,string $instancetype,int $instanceid,?string $provider = null,)   X-Ref
Load communication instance by instance id.

param: context $context The context of the item for the instance
param: string $component The component name
param: string $instancetype The instance type
param: int $instanceid The instance id
param: string|null $provider The provider type - if null will load for this context's active provider.
return: processor|null

is_instance_active()   X-Ref
Check if communication instance is active.

return: bool

get_classname_for_provider(string $component)   X-Ref
Get communication provider class name.

param: string $component The component name.
return: string

get_id()   X-Ref
Get communication instance id after creating the instance in communication table.

return: int

get_context()   X-Ref
Get the context of the communication instance.

return: context

get_context_id()   X-Ref
Get the context id of the communication instance.

return: int

get_instance_type()   X-Ref
Get communication instance type.

return: string

get_instance_id()   X-Ref
Get communication instance id.

return: int

get_component()   X-Ref
Get communication instance component.

return: string

get_provider()   X-Ref
Get communication provider type.

return: string|null

get_room_name()   X-Ref
Get room name.

return: string|null

get_room_provider()   X-Ref
Get communication instance id.

return: room_chat_provider

get_user_provider()   X-Ref
Get communication instance id.

return: user_provider

get_room_user_provider()   X-Ref
Get communication instance id.

return: room_user_provider

set_provider_specific_form_definition(string $provider, \MoodleQuickForm $mform)   X-Ref
Set provider specific form definition.

param: string $provider The provider name
param: \MoodleQuickForm $mform The moodle form

get_form_provider()   X-Ref
Get communication instance for form feature.

return: form_provider

supports_user_features()   X-Ref
Get communication instance id.

return: bool

supports_room_user_features()   X-Ref
Get communication instance id.

return: bool

requires_form_features()   X-Ref
Check form feature available.

return: bool

supports_form_features()   X-Ref
Check support for form feature.

return: bool

require_user_features()   X-Ref
Get communication instance id.


supports_room_features()   X-Ref
Get communication instance id.

return: bool

require_api_enabled()   X-Ref
Check if communication api is enabled.


require_room_features()   X-Ref
Get communication instance id.


require_room_user_features()   X-Ref
Get communication instance id.


get_avatar()   X-Ref
Get communication instance id.

return: bool|\stored_file

set_avatar_filename(?string $filename)   X-Ref
Set the avatar file name.

param: string|null $filename

get_avatar_filename()   X-Ref
Get the avatar file name.

return: string|null

is_avatar_synced()   X-Ref
Check if the avatar has been synced with the provider.

return: bool

set_avatar_synced_flag(bool $synced)   X-Ref
Indicate if the avatar has been synced with the provider.

param: boolean $synced True if avatar has been synced.

get_room_url()   X-Ref
Get a room url.

return: string|null

is_provider_available(string $provider)   X-Ref
Is the communication provider enabled and configured, or disabled.

param: string $provider provider component name
return: bool