Search moodle.org's
Developer Documentation

See Release Notes

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

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

(no description)

File Size: 224 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

handler:: (11 methods):
  __construct()
  create()
  supports_xapi()
  supports_group_actors()
  process_statements()
  save_state()
  load_state()
  delete_state()
  wipe_states()
  reset_states()
  get_state_store()


Class: handler  - X-Ref

Class handler handles basic xAPI statements and states.

__construct(string $component)   X-Ref
Constructor for a xAPI handler base class.

param: string $component the component name

create(string $component)   X-Ref
Returns the xAPI handler of a specific component.

param: string $component the component name in frankenstyle.
return: handler|null a handler object or null if none found.

supports_xapi(string $component)   X-Ref
Whether a component supports (and implements) xAPI.

param: string $component the component name in frankenstyle.
return: bool true if the given component implements xAPI handler; false otherwise.

supports_group_actors()   X-Ref
Return true if group actor is enabled.

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

return: bool

process_statements(array $statements)   X-Ref
Process a bunch of statements sended to a specific component.

param: statement[] $statements an array with all statement to process.
return: int[] return an specifying what statements are being stored.

save_state(state $state)   X-Ref
Process a state save request.

param: state $state the state object
return: bool if the state can be saved

load_state(state $state)   X-Ref
Process a state save request.

param: state $state the state object
return: state|null the resulting loaded state

delete_state(state $state)   X-Ref
Process a state delete request.

param: state $state the state object
return: bool if the deletion is successful

wipe_states(?string $itemid = null,?int $userid = null,?string $stateid = null,?string $registration = null)   X-Ref
Delete all states from this component.

param: string|null $itemid
param: int|null $userid
param: string|null $stateid
param: string|null $registration

reset_states(?string $itemid = null,?int $userid = null,?string $stateid = null,?string $registration = null)   X-Ref
Reset all states from this component.

param: string|null $itemid
param: int|null $userid
param: string|null $stateid
param: string|null $registration

get_state_store()   X-Ref
Return a valor state store for this component.

Plugins may override this method is they want to use a different
state store class.
return: state_store the store to use to get/put/delete states.