Search moodle.org's
Developer Documentation

See Release Notes

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

Differences Between: [Versions 402 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.

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 ane of the field names in all_calculated_for_qubaid_condition, e.g. 'facility'.
return: float|null the required value.

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

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'.
return: array array keys are question ids and the corresponding values are the average values.

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

param: int $questionid
return: float|null

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

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

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

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

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

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
return: string

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

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