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.

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.

return: array multidimensional array properly indexed.
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

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.

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

quiz_report_can_filter_only_graded($quiz)   X-Ref

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

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.

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

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.

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

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.

return: array band number => number of users with scores in that band.
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

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.

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

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: object $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.

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

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

param: object $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.

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

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.

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