Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

Data generator.

Copyright: 2020 Ferran Recio <ferran@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 587 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: mod_h5pactivity_generator  - X-Ref

h5pactivity module data generator class.

create_instance($record = null, array $options = null)   X-Ref
Creates new h5pactivity module instance. By default it contains a short
text file.

return: stdClass record from module-defined table with additional field
param: array|stdClass $record data for module being generated. Requires 'course' key
param: null|array $options general options for course module. Since 2.6 it is

create_content($instance, $record = [])   X-Ref
Creata a fake attempt

return: stdClass generated object
param: stdClass $instance object returned from create_instance() call
param: stdClass|array $record

create_attempt(array $data)   X-Ref
Create a H5P attempt.

This method is user by behat generator.

param: array $data the attempts data array

get_attempt_object($attemptinfo)   X-Ref
Get or create an H5P attempt using the data array.

return: int the attempt id
param: array $attemptinfo the generator provided data

new_user_attempt(array $attemptinfo)   X-Ref
Creates a user attempt.

return: int the h5pactivity_attempt ID
param: array $attemptinfo the current attempt information.

insert_statement(array $attemptinfo, array $statement)   X-Ref
Insert a new statement into an attempt.

If the interaction type is "compound" it will also update the attempt general result.

return: int the h5pactivity_attempt_result ID
param: array $attemptinfo the current attempt information
param: array $statement the statement tracking information

get_attempt_result_compound(array $attemptinfo)   X-Ref
Generates a valid compound tracking result.

return: array with the required statement data
param: array $attemptinfo the current attempt information.

get_attempt_result_choice(array $attemptinfo)   X-Ref
Generates a valid choice tracking result.

return: array with the required statement data
param: array $attemptinfo the current attempt information.

get_attempt_result_matching(array $attemptinfo)   X-Ref
Generates a valid matching tracking result.

return: array with the required statement data
param: array $attemptinfo the current attempt information.

get_attempt_result_fillin(array $attemptinfo)   X-Ref
Generates a valid fill-in tracking result.

return: array with the required statement data
param: array $attemptinfo the current attempt information.

get_attempt_result_truefalse(array $attemptinfo)   X-Ref
Generates a valid true-false tracking result.

return: array with the required statement data
param: array $attemptinfo the current attempt information.

get_attempt_result_longfillin(array $attemptinfo)   X-Ref
Generates a valid long-fill-in tracking result.

return: array with the required statement data
param: array $attemptinfo the current attempt information.

get_attempt_result_sequencing(array $attemptinfo)   X-Ref
Generates a valid sequencing tracking result.

return: array with the required statement data
param: array $attemptinfo the current attempt information.

get_attempt_result_other(array $attemptinfo)   X-Ref
Generates a valid other tracking result.

return: array with the required statement data
param: array $attemptinfo the current attempt information.