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 403]

(no description)

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

Defines 1 class


Class: helper  - X-Ref

Helper for statistics

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 ane of the field names in all_calculated_for_qubaid_condition, e.g. 'facility'.

calculate_average_question_stats_item(array $questionids, string $item)   X-Ref
Calculate average for a stats item on a list of questions.

return: array array keys are question ids and the corresponding values are the average values.
param: int[] $questionids list of ids of the questions we are interested in.
param: string $item ane of the field names in all_calculated_for_qubaid_condition, e.g. 'facility'.

calculate_average_question_facility(int $questionid)   X-Ref
Calculate average facility index

return: float|null
param: int $questionid

calculate_average_question_discriminative_efficiency(int $questionid)   X-Ref
Calculate average discriminative efficiency

return: float|null
param: int $questionid question id

calculate_average_question_discrimination_index(int $questionid)   X-Ref
Calculate average discriminative efficiency

return: float|null
param: int $questionid question id

format_percentage(?float $number, bool $fraction = true, int $decimals = 2)   X-Ref
Format a number to a localised percentage with specified decimal points.

return: string
param: float|null $number The number being formatted
param: bool $fraction An indicator for whether the number is a fraction or is already multiplied by 100
param: int $decimals Sets the number of decimal points

format_discrimination_index(?float $value)   X-Ref
Format discrimination index (Needs checking?).

return: array
param: float|null $value stats value