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

Quiz statistics report, table for showing response analysis for a particular question (or sub question).

Author: James Pratt <me@jamiep.org>
Copyright: 2014 Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 186 lines (7 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

quiz_statistics_question_table:: (6 methods):
  __construct()
  question_setup()
  format_percentage()
  col_fraction()
  col_frequency()
  other_cols()


Class: quiz_statistics_question_table  - X-Ref

This table shows statistics about a particular question.

Lists the responses that students made to this question, with frequency counts.

The responses may be grouped, either by sub-part of the question, or by the
answer they match.

__construct($qid)   X-Ref
Constructor.

param: int $qid the id of the particular question whose statistics are being

question_setup($reporturl, $questiondata, $s, $responseanalysis)   X-Ref
Set up columns and column names and other table settings.

param: moodle_url $reporturl
param: object     $questiondata
param: integer    $s             number of attempts on this question.
param: \core_question\statistics\responses\analysis_for_question $responseanalysis

format_percentage($fraction)   X-Ref
Take a float where 1 represents 100% and return a string representing the percentage.

param: float $fraction The fraction.
return: string The fraction as a percentage.

col_fraction($response)   X-Ref
The mark fraction that this response earns.

param: object $response containst the data to display.
return: string contents of this table cell.

col_frequency($response)   X-Ref
The frequency with which this response was given.

param: object $response contains the data to display.
return: string contents of this table cell.

other_cols($colname, $response)   X-Ref
If there is not a col_{column name} method then we call this method. If it returns null
that means just output the property as in the table raw data. If this returns none null
then this is the output for this cell of the table.

param: string $colname  The name of this column.
param: object $response The raw data for this row.
return: string|null The value for this cell of the table or null means use raw data.