Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
core_xapi\handler Class Reference
Inheritance diagram for core_xapi\handler:
mod_h5pactivity\xapi\handler

Public Member Functions

 delete_state (state $state)
 Process a state delete request.
 
 get_state_store ()
 Return a valor state store for this component.
 
 load_state (state $state)
 Process a state save request.
 
 process_statements (array $statements)
 Process a bunch of statements sended to a specific component.
 
 reset_states (?string $itemid=null, ?int $userid=null, ?string $stateid=null, ?string $registration=null)
 Reset all states from this component.
 
 save_state (state $state)
 Process a state save request.
 
 statement_to_event (statement $statement)
 Convert a statement object into a Moodle xAPI Event.
 
 supports_group_actors ()
 Return true if group actor is enabled.
 
 wipe_states (?string $itemid=null, ?int $userid=null, ?string $stateid=null, ?string $registration=null)
 Delete all states from this component.
 

Static Public Member Functions

static create (string $component)
 Returns the xAPI handler of a specific component.
 
static supports_xapi (string $component)
 Whether a component supports (and implements) xAPI.
 

Protected Member Functions

 __construct (string $component)
 Constructor for a xAPI handler base class.
 
 validate_state (state $state)
 Validate a xAPI state.
 

Protected Attributes

string $component
 component name in frankenstyle.
 
state_store $statestore
 the state_store instance.
 

Constructor & Destructor Documentation

◆ __construct()

core_xapi\handler::__construct ( string $component)
finalprotected

Constructor for a xAPI handler base class.

Parameters
string$componentthe component name

Member Function Documentation

◆ create()

static core_xapi\handler::create ( string $component)
staticfinal

Returns the xAPI handler of a specific component.

Parameters
string$componentthe component name in frankenstyle.
Return values
handler|nulla handler object or null if none found.
Exceptions
xapi_exception

◆ delete_state()

core_xapi\handler::delete_state ( state $state)

Process a state delete request.

Parameters
state$statethe state object
Return values
boolif the deletion is successful

◆ get_state_store()

core_xapi\handler::get_state_store ( )

Return a valor state store for this component.

Plugins may override this method is they want to use a different state store class.

Return values
state_storethe store to use to get/put/delete states.

◆ load_state()

core_xapi\handler::load_state ( state $state)

Process a state save request.

Parameters
state$statethe state object
Return values
state|nullthe resulting loaded state

◆ process_statements()

core_xapi\handler::process_statements ( array $statements)

Process a bunch of statements sended to a specific component.

Parameters
statement[]$statementsan array with all statement to process.
Return values
int[]return an specifying what statements are being stored.

◆ reset_states()

core_xapi\handler::reset_states ( ?string $itemid = null,
?int $userid = null,
?string $stateid = null,
?string $registration = null )

Reset all states from this component.

Parameters
string | null$itemid
int | null$userid
string | null$stateid
string | null$registration

◆ save_state()

core_xapi\handler::save_state ( state $state)

Process a state save request.

Parameters
state$statethe state object
Return values
boolif the state can be saved

◆ statement_to_event()

core_xapi\handler::statement_to_event ( statement $statement)
abstract

Convert a statement object into a Moodle xAPI Event.

If a statement is accepted by validate_statement the component must provide a event to handle that statement, otherwise the statement will be rejected.

Note: this method must be overridden by the plugins which want to use xAPI.

Parameters
statement$statement
Return values
core\event\base|nulla Moodle event to trigger

Reimplemented in mod_h5pactivity\xapi\handler.

◆ supports_group_actors()

core_xapi\handler::supports_group_actors ( )

Return true if group actor is enabled.

Note: this method must be overridden by the plugins which want to use groups in statements.

Return values
bool

◆ supports_xapi()

static core_xapi\handler::supports_xapi ( string $component)
staticfinal

Whether a component supports (and implements) xAPI.

Parameters
string$componentthe component name in frankenstyle.
Return values
booltrue if the given component implements xAPI handler; false otherwise.

◆ validate_state()

core_xapi\handler::validate_state ( state $state)
abstractprotected

Validate a xAPI state.

Check if the state is valid for this handler.

This method is used also for the state get requests so the validation cannot rely on having state data.

Note: this method must be overridden by the plugins which want to use xAPI states.

Parameters
state$state
Return values
boolif the state is valid or not

Reimplemented in mod_h5pactivity\xapi\handler.

◆ wipe_states()

core_xapi\handler::wipe_states ( ?string $itemid = null,
?int $userid = null,
?string $stateid = null,
?string $registration = null )

Delete all states from this component.

Parameters
string | null$itemid
int | null$userid
string | null$stateid
string | null$registration

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