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 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

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

Defines 1 class


Class: statistics_bulk_loader  - X-Ref

Helper to efficiently load all the statistics for a set of questions.

If you are implementing a question bank column, do not use this method directly.
Instead, override the {@see column_base::get_required_statistics_fields()} method
in your column class, and the question bank view will take care of it for you.

load_aggregate_statistics(array $questionids, array $requiredstatistics)   X-Ref
Load and aggregate the requested statistics for all the places where the given questions are used.

The returned array will contain a values for each questionid and field, which will be null if the value is not available.

return: float[][] if a value is not available, it will be set to null.
param: int[] $questionids array of question ids.
param: string[] $requiredstatistics array of the fields required, e.g. ['facility', 'discriminationindex'].

get_all_places_where_questions_were_attempted(array $questionids)   X-Ref
For a list of questions find all the places, defined by (component, contextid), where there are attempts.

return: \stdClass[] list of objects with fields ->component and ->contextid.
param: int[] $questionids array of question ids that we are interested in.

load_statistics_for_place(string $component,\context $context)   X-Ref
Load the question statistics for all the attempts belonging to a particular component in a particular context.

return: all_calculated_for_qubaid_condition|null question statistics.
param: string $component frankenstyle component name, e.g. 'mod_quiz'.
param: \context $context the context to load the statistics for.

extract_item_value(all_calculated_for_qubaid_condition $statistics,int $questionid, string $item)   X-Ref
Extract the value for one question and one type of statistic from a set of statistics.

return: float|null the required value.
param: all_calculated_for_qubaid_condition $statistics the batch of statistics.
param: int $questionid a question id.
param: string $item one of the field names in all_calculated_for_qubaid_condition, e.g. 'facility'.