Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 39 and 401]

(no description)

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

Defines 1 class

H5PEventBase:: (6 methods):
  __construct()
  validLogLevel()
  validStats()
  isAction()
  getDataArray()
  getFormatArray()


Class: H5PEventBase  - X-Ref

The base class for H5P events. Extend to track H5P events in your system.

__construct($type, $sub_type = NULL, $content_id = NULL, $content_title = NULL, $library_name = NULL, $library_version = NULL)   X-Ref
Adds event type, h5p library and timestamp to event before saving it.

Common event types with sub type:
content, <none> – content view
embed – viewed through embed code
shortcode – viewed through internal shortcode
edit – opened in editor
delete – deleted
create – created through editor
create upload – created through upload
update – updated through editor
update upload – updated through upload
upgrade – upgraded

results, <none> – view own results
content – view results for content
set – new results inserted or updated

settings, <none> – settings page loaded

library, <none> – loaded in editor
create – new library installed
update – old library updated

param: string $type
param: string $sub_type
param: string $content_id
param: string $content_title
param: string $library_name
param: string $library_version

validLogLevel($type, $sub_type)   X-Ref
Determines if the event type should be saved/logged.

param: string $type
param: string $sub_type
return: boolean

validStats($type, $sub_type)   X-Ref
Check if the event should be included in the statistics counter.

param: string $type
param: string $sub_type
return: boolean

isAction($type, $sub_type)   X-Ref
Check if event type is an action.

param: string $type
param: string $sub_type
return: boolean

getDataArray()   X-Ref
A helper which makes it easier for systems to save the data.
Add all relevant properties to a assoc. array.
There are no NULL values. Empty string or 0 is used instead.
Used by both Drupal and WordPress.

return: array with keyed values

getFormatArray()   X-Ref
A helper which makes it easier for systems to save the data.
Used in WordPress.

return: array with strings