Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_question\local\statistics\statistics_bulk_loader Class Reference

Static Public Member Functions

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

Static Protected Member Functions

static extract_item_value (all_calculated_for_qubaid_condition $statistics, int $questionid, string $item)
 Extract the value for one question and one type of statistic from a set of statistics.
 
static get_all_places_where_questions_were_attempted (array $questionids)
 For a list of questions find all the places, defined by (component, contextid), where there are attempts.
 
static load_statistics_for_place (string $component, context $context)
 Load the question statistics for all the attempts belonging to a particular component in a particular context.
 

Member Function Documentation

◆ extract_item_value()

static core_question\local\statistics\statistics_bulk_loader::extract_item_value ( all_calculated_for_qubaid_condition $statistics,
int $questionid,
string $item )
staticprotected

Extract the value for one question and one type of statistic from a set of statistics.

Parameters
all_calculated_for_qubaid_condition$statisticsthe batch of statistics.
int$questionida question id.
string$itemone of the field names in all_calculated_for_qubaid_condition, e.g. 'facility'.
Return values
float|nullthe required value.

◆ get_all_places_where_questions_were_attempted()

static core_question\local\statistics\statistics_bulk_loader::get_all_places_where_questions_were_attempted ( array $questionids)
staticprotected

For a list of questions find all the places, defined by (component, contextid), where there are attempts.

Parameters
int[]$questionidsarray of question ids that we are interested in.
Return values
stdClass[]list of objects with fields ->component and ->contextid.

◆ load_aggregate_statistics()

static core_question\local\statistics\statistics_bulk_loader::load_aggregate_statistics ( array $questionids,
array $requiredstatistics )
static

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.

Parameters
int[]$questionidsarray of question ids.
string[]$requiredstatisticsarray of the fields required, e.g. ['facility', 'discriminationindex'].
Return values
float[][]if a value is not available, it will be set to null.

◆ load_statistics_for_place()

static core_question\local\statistics\statistics_bulk_loader::load_statistics_for_place ( string $component,
context $context )
staticprotected

Load the question statistics for all the attempts belonging to a particular component in a particular context.

Parameters
string$componentfrankenstyle component name, e.g. 'mod_quiz'.
context$contextthe context to load the statistics for.
Return values
all_calculated_for_qubaid_condition|nullquestion statistics.

The documentation for this class was generated from the following file: