Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 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: stdClass     $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: stdClass $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: stdClass $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: stdClass $response The raw data for this row.
return: string|null The value for this cell of the table or null means use raw data.