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 310 and 402] [Versions 311 and 402] [Versions 39 and 402]

(no description)

Author: James Pratt me@jamiep.org
Copyright: 2013 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 217 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

analysis_for_class:: (10 methods):
  __construct()
  count_response()
  cache()
  add_response()
  set_response_count()
  has_actual_responses()
  data_for_question_response_table()
  get_maximum_tries()
  get_responses()
  get_response()


Class: analysis_for_class  - X-Ref

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

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

- There is a separate data structure for each question or sub question's analysis
{@link \core_question\statistics\responses\analysis_for_question}
or {@link \core_question\statistics\responses\analysis_for_question_all_tries}.
- There are separate analysis for each variant in this top level instance.
- Then there are class instances representing the analysis of each of the sub parts of each variant of the question.
{@link \core_question\statistics\responses\analysis_for_subpart}.
- Then within the sub part analysis there are response class analysis
{@link \core_question\statistics\responses\analysis_for_class}.
- Then within each class analysis there are analysis for each actual response
{@link \core_question\statistics\responses\analysis_for_actual_response}.

__construct($possibleresponse, $responseclassid)   X-Ref
Constructor, just an easy way to set the fields.

param: \question_possible_response $possibleresponse
param: string                      $responseclassid

count_response($actualresponse, $fraction, $try)   X-Ref
Keep a count of a response to this question sub part that falls within this class.

param: string     $actualresponse
param: float|null $fraction
param: int        $try
return: \core_question\statistics\responses\analysis_for_actual_response

cache($qubaids, $whichtries, $questionid, $variantno, $subpartid, $calculationtime = null)   X-Ref
Cache analysis for class.

param: \qubaid_condition $qubaids    which question usages have been analysed.
param: string            $whichtries which tries have been analysed?
param: int               $questionid which question.
param: int               $variantno  which variant.
param: string            $subpartid  which sub part.
param: int|null          $calculationtime time when the analysis was done. (Defaults to time()).

add_response($response, $fraction)   X-Ref
Add an actual response to the data structure.

param: string $response A string representing the actual response.
param: float  $fraction The fraction of grade awarded for this response.

set_response_count($response, $try, $count)   X-Ref
Used when loading cached counts.

param: string $response
param: int $try the try number, will be zero if not keeping track of try.
param: int $count the count

has_actual_responses()   X-Ref
Are there actual responses to sub parts that where classified into this class?

return: bool whether this analysis has a response class with more than one

data_for_question_response_table($responseclasscolumn, $partid)   X-Ref
Return the data to display in the response analysis table.

param: bool $responseclasscolumn
param: string $partid
return: object[]

get_maximum_tries()   X-Ref
What is the highest try number that an actual response of this response class has been seen?

return: int try number

get_responses()   X-Ref
Return array of the actual responses to this sub part that were classified into this class.

return: string[] the actual responses we are counting tries at.

get_response($response)   X-Ref
Get the data structure used to count the responses that match an actual response within this class of responses.

param: string $response
return: analysis_for_actual_response the instance for keeping count of tries for $response.