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 400 and 401]

(no description)

File Size: 180 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.

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

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.

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

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.

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

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.

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'.
return: float|null the required value.