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

Analysis for possible responses for parts of a question. More...

Inheritance diagram for core_question\statistics\responses\analysis_for_question:
core_question\statistics\responses\analysis_for_question_all_tries

Public Member Functions

 __construct (array $possiblereponses=null)
 Constructor method.
 
 cache ($qubaids, $whichtries, $questionid, $calculationtime=null)
 Save the analysis to the DB, first cleaning up any old ones.
 
 count_response_parts ($variantno, $responseparts)
 Takes an array of question_classified_response and adds counts of the responses to the sub parts and classes.
 
 get_analysis_for_subpart ($variantno, $subpartid)
 Get the response counts etc.
 
 get_maximum_tries ()
 What is the highest number of tries at this question?
 
 get_subpart_ids ($variantno)
 Unique ids for sub parts.
 
 get_variant_nos ()
 Variant nos found in this question's attempt data.
 
 has_actual_responses ()
 
 has_multiple_response_classes ()
 Used to work out what kind of table is needed to display stats.
 
 has_multiple_tries_data ()
 
 has_subparts ()
 Used to work out what kind of table is needed to display stats.
 

Protected Member Functions

 initialise_stats_for_variant ($variantno)
 Initialise data structure for response analysis of one variant.
 

Protected Attributes

array[] $possibleresponses = array()
 See description above in constructor method.
 
array[] $subparts = array()
 A multidimensional array whose first index is variant no and second index is subpart id, array contents are of type analysis_for_subpart.
 

Detailed Description

Analysis for possible responses for parts of a question.

It is up to a question type designer to decide on how many parts their question has. See question_type::get_possible_responses() and sub classes where the sub parts and response classes are defined.

A sub part might represent a sub question embedded in the question for example in a matching question there are several sub parts. A numeric question with a unit might be divided into two sub parts for the purposes of response analysis or the question type designer might decide to treat the answer, both the numeric and unit part, as a whole for the purposes of response analysis.

Author
James Pratt me@ja.nosp@m.miep.nosp@m..org
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_question\statistics\responses\analysis_for_question::__construct ( array $possiblereponses = null)

Constructor method.

Parameters
array[]Two index array, first index is unique string for each sub question part, the second string index is the 'class' that sub-question part can be classified into. Value in array is instance of question_possible_response This is the return value from question_type::get_possible_responses() see that method for fuller documentation.

Member Function Documentation

◆ cache()

core_question\statistics\responses\analysis_for_question::cache ( $qubaids,
$whichtries,
$questionid,
$calculationtime = null )

Save the analysis to the DB, first cleaning up any old ones.

Parameters
qubaid_condition$qubaidswhich question usages have been analysed.
string$whichtrieswhich tries have been analysed?
int$questionidwhich question.
int | null$calculationtimetime when the analysis was done. (Defaults to time()).

◆ count_response_parts()

core_question\statistics\responses\analysis_for_question::count_response_parts ( $variantno,
$responseparts )

Takes an array of question_classified_response and adds counts of the responses to the sub parts and classes.

Parameters
int$variantno
question_classified_response[]$responsepartskeys are sub-part id.

Reimplemented in core_question\statistics\responses\analysis_for_question_all_tries.

◆ get_analysis_for_subpart()

core_question\statistics\responses\analysis_for_question::get_analysis_for_subpart ( $variantno,
$subpartid )

Get the response counts etc.

for variant $variantno, question sub part $subpartid.

Or if there is no recorded analysis yet then initialise the data structure for that part of the analysis and return the initialised analysis objects.

Parameters
int$variantno
string$subpartidid for sub part.
Return values
analysis_for_subpart

◆ get_maximum_tries()

core_question\statistics\responses\analysis_for_question::get_maximum_tries ( )

What is the highest number of tries at this question?

Return values
intalways 1 as this class is for analysing only one try.

Reimplemented in core_question\statistics\responses\analysis_for_question_all_tries.

◆ get_subpart_ids()

core_question\statistics\responses\analysis_for_question::get_subpart_ids ( $variantno)

Unique ids for sub parts.

Parameters
int$variantno
Return values
string[]

◆ get_variant_nos()

core_question\statistics\responses\analysis_for_question::get_variant_nos ( )

Variant nos found in this question's attempt data.

Return values
int[]

◆ has_actual_responses()

core_question\statistics\responses\analysis_for_question::has_actual_responses ( )
Return values
boolwhether this analysis has a response class with more than one different actual response, or if the actual response is different from the model response.

◆ has_multiple_response_classes()

core_question\statistics\responses\analysis_for_question::has_multiple_response_classes ( )

Used to work out what kind of table is needed to display stats.

Return values
boolwhether this question has (a subpart with) more than one response class.

◆ has_multiple_tries_data()

core_question\statistics\responses\analysis_for_question::has_multiple_tries_data ( )
Return values
boolDoes this response analysis include counts for responses for multiple tries of the question?

Reimplemented in core_question\statistics\responses\analysis_for_question_all_tries.

◆ has_subparts()

core_question\statistics\responses\analysis_for_question::has_subparts ( )

Used to work out what kind of table is needed to display stats.

Return values
boolwhether this analysis has more than one subpart.

◆ initialise_stats_for_variant()

core_question\statistics\responses\analysis_for_question::initialise_stats_for_variant ( $variantno)
protected

Initialise data structure for response analysis of one variant.

Parameters
int$variantno

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