Search moodle.org's
Developer Documentation

See Release Notes

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

Differences Between: [Versions 310 and 403] [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: 586 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.

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
return: stdClass record from module-defined table with additional field

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

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

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.

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

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

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

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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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