Moodle PHP Documentation 4.5
Moodle 4.5.5+ (Build: 20250711) (ce34e8ff087)
core_ai\manager Class Reference

Public Member Functions

 process_action (base $action)
 Process an action.
 

Static Public Member Functions

static get_providers_for_actions (array $actions, bool $enabledonly=false)
 Given a list of actions get the provider plugins that support them.
 
static get_supported_actions (string $pluginname)
 Get the list of actions that this provider or placement supports, given the name of the plugin.
 
static get_user_policy_status (int $userid)
 Get the user policy.
 
static is_action_available (string $actionclass)
 Check if an action is available.
 
static is_action_enabled (string $plugin, string $actionclass)
 Check if an action is enabled for a given plugin.
 
static set_action_state (string $plugin, string $actionbasename, int $enabled)
 Set the action state for a given plugin.
 
static user_policy_accepted (int $userid, int $contextid)
 Set the policy acceptance for a given user.
 

Protected Member Functions

 call_action_provider (provider $provider, base $action)
 Call the action provider.
 

Member Function Documentation

◆ call_action_provider()

core_ai\manager::call_action_provider ( provider $provider,
base $action )
protected

Call the action provider.

The named provider will process the action and return the result.

Parameters
provider$providerThe provider to call.
base$actionThe action to process.
Return values
responses::response_baseThe result of the action.

◆ get_providers_for_actions()

static core_ai\manager::get_providers_for_actions ( array $actions,
bool $enabledonly = false )
static

Given a list of actions get the provider plugins that support them.

Will return an array of arrays, indexed by action name.

Parameters
array$actionsAn array of fully qualified action class names.
bool$enabledonlyIf true, only return enabled providers.
Return values
arrayAn array of provider instances indexed by action name.

◆ get_supported_actions()

static core_ai\manager::get_supported_actions ( string $pluginname)
static

Get the list of actions that this provider or placement supports, given the name of the plugin.

Parameters
string$pluginnameThe name of the plugin to get the actions for.
Return values
arrayAn array of action class names.

◆ get_user_policy_status()

static core_ai\manager::get_user_policy_status ( int $userid)
static

Get the user policy.

Parameters
int$useridThe user id.
Return values
boolTrue if the policy was accepted, false otherwise.

◆ is_action_available()

static core_ai\manager::is_action_available ( string $actionclass)
static

Check if an action is available.

Action is available if it is enabled for at least one enabled provider.

Parameters
string$actionclassThe fully qualified action class name to be checked.
Return values
bool

◆ is_action_enabled()

static core_ai\manager::is_action_enabled ( string $plugin,
string $actionclass )
static

Check if an action is enabled for a given plugin.

Parameters
string$pluginThe name of the plugin.
string$actionclassThe fully qualified action class name to be checked.
Return values
mixedReturns the configuration value of the action for the given plugin.

◆ process_action()

core_ai\manager::process_action ( base $action)

Process an action.

This is the entry point for processing an action.

Parameters
base$actionThe action to process. Action must be configured.
Return values
responses::response_baseThe result of the action.

◆ set_action_state()

static core_ai\manager::set_action_state ( string $plugin,
string $actionbasename,
int $enabled )
static

Set the action state for a given plugin.

Parameters
string$pluginThe name of the plugin.
string$actionbasenameThe action to be set.
int$enabledThe state to be set (e.g., enabled or disabled).
Return values
boolReturns true if the configuration was successfully set, false otherwise.

◆ user_policy_accepted()

static core_ai\manager::user_policy_accepted ( int $userid,
int $contextid )
static

Set the policy acceptance for a given user.

Parameters
int$useridThe user id.
int$contextidThe context id the policy was accepted in.
Return values
boolTrue if the policy was set, false otherwise.

The documentation for this class was generated from the following file: