Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

(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: 215 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)   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.

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.