Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 402] [Versions 400 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.

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

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

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

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

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

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.

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