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

Counts a class of responses for this sub part of the question. More...

Public Member Functions

 __construct ($possibleresponse, $responseclassid)
 Constructor, just an easy way to set the fields.
 
 add_response ($response, $fraction)
 Add an actual response to the data structure.
 
 cache ($qubaids, $whichtries, $questionid, $variantno, $subpartid, $calculationtime=null)
 Cache analysis for class.
 
 count_response ($actualresponse, $fraction, $try)
 Keep a count of a response to this question sub part that falls within this class.
 
 data_for_question_response_table ($responseclasscolumn, $partid)
 Return the data to display in the response analysis table.
 
 get_maximum_tries ()
 What is the highest try number that an actual response of this response class has been seen?
 
 has_actual_responses ()
 Are there actual responses to sub parts that where classified into this class?
 
 set_response_count ($response, $try, $count)
 Used when loading cached counts.
 

Protected Member Functions

 get_response ($response)
 Get the data structure used to count the responses that match an actual response within this class of responses.
 
 get_responses ()
 Return array of the actual responses to this sub part that were classified into this class.
 

Protected Attributes

analysis_for_actual_response[] $actualresponses = array()
 key is the actual response represented as a string as it will be displayed in report.
 
string $fraction
 the (partial) credit awarded for this responses.
 
string $modelresponse
 represent this class in the response analysis table.
 
string $responseclassid
 must be unique for each response class within this sub part.
 

Detailed Description

Counts a class of responses for this sub part of the question.

No response is one possible class of response to a question.

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_class::__construct ( $possibleresponse,
$responseclassid )

Constructor, just an easy way to set the fields.

Parameters
question_possible_response$possibleresponse
string$responseclassid

Member Function Documentation

◆ add_response()

core_question\statistics\responses\analysis_for_class::add_response ( $response,
$fraction )

Add an actual response to the data structure.

Parameters
string$responseA string representing the actual response.
float$fractionThe fraction of grade awarded for this response.

◆ cache()

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

Cache analysis for class.

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

◆ count_response()

core_question\statistics\responses\analysis_for_class::count_response ( $actualresponse,
$fraction,
$try )

Keep a count of a response to this question sub part that falls within this class.

Parameters
string$actualresponse
float | null$fraction
int$try
Return values
core_question\statistics\responses\analysis_for_actual_response

◆ data_for_question_response_table()

core_question\statistics\responses\analysis_for_class::data_for_question_response_table ( $responseclasscolumn,
$partid )

Return the data to display in the response analysis table.

Parameters
bool$responseclasscolumn
string$partid
Return values
object[]

◆ get_maximum_tries()

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

What is the highest try number that an actual response of this response class has been seen?

Return values
inttry number

◆ get_response()

core_question\statistics\responses\analysis_for_class::get_response ( $response)
protected

Get the data structure used to count the responses that match an actual response within this class of responses.

Parameters
string$response
Return values
analysis_for_actual_responsethe instance for keeping count of tries for $response.

◆ get_responses()

core_question\statistics\responses\analysis_for_class::get_responses ( )
protected

Return array of the actual responses to this sub part that were classified into this class.

Return values
string[]the actual responses we are counting tries at.

◆ has_actual_responses()

core_question\statistics\responses\analysis_for_class::has_actual_responses ( )

Are there actual responses to sub parts that where classified into this class?

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.

◆ set_response_count()

core_question\statistics\responses\analysis_for_class::set_response_count ( $response,
$try,
$count )

Used when loading cached counts.

Parameters
string$response
int$trythe try number, will be zero if not keeping track of try.
int$countthe count

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