Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
mod_h5pactivity\xapi\handler Class Reference

Class xapi_handler for H5P statements and states. More...

Inheritance diagram for 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

 validate_state (state $state)
 Validate a xAPI state.
 

Protected Attributes

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

Detailed Description

Class xapi_handler for H5P statements and states.

Since
Moodle 3.9
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ create()

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

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)
inherited

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 ( )
inherited

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)
inherited

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)
inherited

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 )
inherited

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)
inherited

Process a state save request.

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

◆ statement_to_event()

mod_h5pactivity\xapi\handler::statement_to_event ( statement $statement)

Convert a statement object into a Moodle xAPI Event.

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

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

Reimplemented from core_xapi\handler.

◆ supports_group_actors()

core_xapi\handler::supports_group_actors ( )
inherited

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)
staticfinalinherited

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()

mod_h5pactivity\xapi\handler::validate_state ( state $state)
protected

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.

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

Reimplemented from core_xapi\handler.

◆ wipe_states()

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

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: