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] [Versions 400 and 402] [Versions 401 and 402]

Quiz statistics report, table for showing statistics of each question in the quiz.

Copyright: 2008 Jamie Pratt
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 567 lines (23 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class


Class: quiz_statistics_table  - X-Ref

This table has one row for each question in the quiz, with sub-rows when
random questions and variants appear.

There are columns for the various item and position statistics.

__construct()   X-Ref
Constructor.


statistics_setup($quiz, $cmid, $reporturl, $s)   X-Ref
Set up the columns and headers and other properties of the table and then
call flexible_table::setup() method.

param: stdClass $quiz the quiz settings
param: int $cmid the quiz course_module id
param: moodle_url $reporturl the URL to redisplay this report.
param: int $s number of attempts included in the statistics.

wrap_html_start()   X-Ref
Open a div tag to wrap statistics table.


wrap_html_finish()   X-Ref
Close a statistics table div.


col_number($questionstat)   X-Ref
The question number.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_icon($questionstat)   X-Ref
The question type icon.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_actions($questionstat)   X-Ref
Actions that can be performed on the question by this user (e.g. edit or preview).

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_qtype($questionstat)   X-Ref
The question type name.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_name($questionstat)   X-Ref
The question name.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_s($questionstat)   X-Ref
The number of attempts at this question.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_facility($questionstat)   X-Ref
The facility index (average fraction).

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_sd($questionstat)   X-Ref
The standard deviation of the fractions.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_random_guess_score($questionstat)   X-Ref
An estimate of the fraction a student would get by guessing randomly.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_intended_weight($questionstat)   X-Ref
The intended question weight. Maximum mark for the question as a percentage
of maximum mark for the quiz. That is, the indended influence this question
on the student's overall mark.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_effective_weight($questionstat)   X-Ref
The effective question weight. That is, an estimate of the actual
influence this question has on the student's overall mark.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_discrimination_index($questionstat)   X-Ref
Discrimination index. This is the product moment correlation coefficient
between the fraction for this question, and the average fraction for the
other questions in this quiz.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

col_discriminative_efficiency($questionstat)   X-Ref
Discrimination efficiency, similar to, but different from, the Discrimination index.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: string contents of this table cell.

is_dubious_question($questionstat)   X-Ref
This method encapsulates the test for wheter a question should be considered dubious.

param: \core_question\statistics\questions\calculated $questionstat stats for the question.
return: bool is this question possibly not pulling it's weight?

is_calculated_question_summary($questionstat)   X-Ref
Check if the given stats object is an instance of calculated_question_summary.

param: \core_question\statistics\questions\calculated $questionstat Stats object
return: bool

format_range(string $min = null, string $max = null)   X-Ref
Format inputs to represent a range between $min and $max.
This function does not check if $min is less than $max or not.
If both $min and $max are equal to null, this function returns an empty string.

param: string|null $min The minimum value in the range
param: string|null $max The maximum value in the range
return: string

format_percentage(float $number, bool $fraction = true, int $decimals = 2)   X-Ref
Format a number to a localised percentage with specified decimal points.

param: float $number The number being formatted
param: bool $fraction An indicator for whether the number is a fraction or is already multiplied by 100
param: int $decimals Sets the number of decimal points
return: string

format_percentage_range(float $min = null, float $max = null, bool $fraction = true, int $decimals = 2)   X-Ref
Format $min and $max to localised percentages and form a string that represents a range between them.
This function does not check if $min is less than $max or not.
If both $min and $max are equal to null, this function returns an empty string.

param: float|null $min The minimum value of the range
param: float|null $max The maximum value of the range
param: bool $fraction An indicator for whether min and max are a fractions or are already multiplied by 100
param: int $decimals Sets the number of decimal points
return: string A formatted string that represents a range between $min to $max.