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.

Functions that are not part of a class:

quiz_report_index_by_keys($datum, $keys, $keysunique = true)   X-Ref
Takes an array of objects and constructs a multidimensional array keyed by
the keys it finds on the object.

param: array $datum an array of objects with properties on the object
param: array $keys Array of strings with the names of the properties on the
param: bool $keysunique If there is not only one object for each
return: array multidimensional array properly indexed.

quiz_report_unindex($datum)   X-Ref
No description

quiz_has_questions($quizid)   X-Ref
Are there any questions in this quiz?

param: int $quizid the quiz id.

quiz_report_get_significant_questions($quiz)   X-Ref
Get the slots of real questions (not descriptions) in this quiz, in order.

param: stdClass $quiz the quiz.
return: array of slot => objects with fields

quiz_report_can_filter_only_graded($quiz)   X-Ref

param: stdClass $quiz the quiz settings.
return: bool whether, for this quiz, it is possible to filter attempts to show

quiz_report_qm_filter_select($quiz, $quizattemptsalias = 'quiza')   X-Ref
This is a wrapper for {@link quiz_report_grade_method_sql} that takes the whole quiz object instead of just the grading method
as a param. See definition for {@link quiz_report_grade_method_sql} below.

param: stdClass $quiz
param: string $quizattemptsalias sql alias for 'quiz_attempts' table
return: string sql to test if this is an attempt that will contribute towards the grade of the user

quiz_report_grade_method_sql($grademethod, $quizattemptsalias = 'quiza')   X-Ref
Given a quiz grading method return sql to test if this is an
attempt that will be contribute towards the grade of the user. Or return an
empty string if the grading method is QUIZ_GRADEAVERAGE and thus all attempts
contribute to final grade.

param: string $grademethod quiz grading method.
param: string $quizattemptsalias sql alias for 'quiz_attempts' table
return: string sql to test if this is an attempt that will contribute towards the graded of the user

quiz_report_grade_bands($bandwidth, $bands, $quizid, \core\dml\sql_join $usersjoins = null)   X-Ref
Get the number of students whose score was in a particular band for this quiz.

param: number $bandwidth the width of each band.
param: int $bands the number of bands
param: int $quizid the quiz id.
param: \core\dml\sql_join $usersjoins (joins, wheres, params) to get enrolled users
return: array band number => number of users with scores in that band.

quiz_report_highlighting_grading_method($quiz, $qmsubselect, $qmfilter)   X-Ref
No description

quiz_report_feedback_for_grade($grade, $quizid, $context)   X-Ref
Get the feedback text for a grade on this quiz. The feedback is
processed ready for display.

param: float $grade a grade on this quiz.
param: int $quizid the id of the quiz object.
return: string the comment that corresponds to this grade (empty string if there is not one.

quiz_report_scale_summarks_as_percentage($rawmark, $quiz, $round = true)   X-Ref
Format a number as a percentage out of $quiz->sumgrades

param: number $rawgrade the mark to format.
param: stdClass $quiz the quiz settings
param: bool $round whether to round the results ot $quiz->decimalpoints.

quiz_report_list($context)   X-Ref
Returns an array of reports to which the current user has access to.

return: array reports are ordered as they should be for display in tabs.

quiz_report_download_filename($report, $courseshortname, $quizname)   X-Ref
Create a filename for use when downloading data from a quiz report. It is
expected that this will be passed to flexible_table::is_downloading, which
cleans the filename of bad characters and adds the file extension.

param: string $report the type of report.
param: string $courseshortname the course shortname.
param: string $quizname the quiz name.
return: string the filename.

quiz_report_default_report($context)   X-Ref
Get the default report for the current user.

param: stdClass $context the quiz context.

quiz_no_questions_message($quiz, $cm, $context)   X-Ref
Generate a message saying that this quiz has no questions, with a button to
go to the edit page, if the user has the right capability.

param: stdClass $quiz the quiz settings.
param: stdClass $cm the course_module object.
param: stdClass $context the quiz context.
return: string HTML to output.

quiz_report_should_show_grades($quiz, context $context)   X-Ref
Should the grades be displayed in this report. That depends on the quiz
display options, and whether the quiz is graded.

param: stdClass $quiz the quiz settings.
param: context $context the quiz context.
return: bool