Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core_xapi\state_store Class Reference

Public Member Functions

 __construct (string $component)
 Constructor for a xAPI handler base class.
 
 cleanup ()
 Execute a state store clean up.
 
 delete (state $state)
 Delete any extra state data stored in the database.
 
 get (state $state)
 Get a state object from the database.
 
 get_state_ids (?string $itemid=null, ?int $userid=null, ?string $registration=null, ?int $since=null,)
 Get all state ids from a specific activity and agent.
 
 put (state $state)
 Inserts an state object into the database.
 
 reset (?string $itemid=null, ?int $userid=null, ?string $stateid=null, ?string $registration=null)
 Reset all states from the component.
 
 wipe (?string $itemid=null, ?int $userid=null, ?string $stateid=null, ?string $registration=null)
 Remove all states from the component The given parameters are filters to decide the states to wipe.
 

Protected Member Functions

 activity_id_to_item_id (string $activityid)
 Convert the xAPI activity ID into an item ID integer.
 

Protected Attributes

string $component
 component name in frankenstyle.
 

Constructor & Destructor Documentation

◆ __construct()

core_xapi\state_store::__construct ( string $component)

Constructor for a xAPI handler base class.

Parameters
string$componentthe component name

Member Function Documentation

◆ activity_id_to_item_id()

core_xapi\state_store::activity_id_to_item_id ( string $activityid)
protected

Convert the xAPI activity ID into an item ID integer.

Exceptions
xapi_exceptionif the activity id is not numeric.
Parameters
string$activityidthe provided activity ID
Return values
int

◆ cleanup()

core_xapi\state_store::cleanup ( )

Execute a state store clean up.

Plugins can override this methos to provide an alternative clean up logic.

◆ delete()

core_xapi\state_store::delete ( state $state)

Delete any extra state data stored in the database.

This method will be called only if the state is accepted by validate_state.

Plugins may override this method add extra clean up tasks to the deletion.

Parameters
state$state
Return values
boolif the state is removed

◆ get()

core_xapi\state_store::get ( state $state)

Get a state object from the database.

This method will be called only if the state is accepted by validate_state.

Plugins may override this method if they store some data in different tables.

Parameters
state$state
Return values
state|nullthe state

◆ get_state_ids()

core_xapi\state_store::get_state_ids ( ?string $itemid = null,
?int $userid = null,
?string $registration = null,
?int $since = null )

Get all state ids from a specific activity and agent.

Plugins may override this method if they store some data in different tables.

Parameters
string | null$itemid
int | null$userid
string | null$registration
int | null$sincefilter ids updated since a specific timestamp
Return values
string[]the state ids values

◆ put()

core_xapi\state_store::put ( state $state)

Inserts an state object into the database.

This method will be called only if the state is accepted by validate_state.

Plugins may override this method if they store some data in different tables.

Parameters
state$state
Return values
boolif the state is inserted/updated

◆ reset()

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

Reset all states from the component.

The given parameters are filters to decide the states to reset. If no parameters are defined, the only filter applied will be the component.

Plugins may override this method if they store some data in different tables.

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

◆ wipe()

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

Remove all states from the component The given parameters are filters to decide the states to wipe.

If no parameters are defined, the only filter applied will be the component.

Plugins may override this method if they store some data in different tables.

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

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