Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

The file defines a base class that can be used to build a report like the overview or responses report, that has one row per attempt.

Copyright: 2010 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 384 lines (16 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 1 class


Class: quiz_attempts_report  - X-Ref

Base class for quiz reports that are basically a table with one row for each attempt.

init($mode, $formclass, $quiz, $cm, $course)   X-Ref
Initialise various aspects of this report.

param: string $mode
param: string $formclass
param: object $quiz
param: object $cm
param: object $course
return: array with four elements:

get_base_url()   X-Ref
Get the base URL for this report.

return: moodle_url the URL.

get_students_joins($cm, $course = null)   X-Ref
Get sql fragments (joins) which can be used to build queries that
will select an appropriate set of students to show in the reports.

param: object $cm the course module.
param: object $course the course settings.
return: array with four elements:

print_standard_header_and_messages($cm, $course, $quiz,$options, $currentgroup, $hasquestions, $hasstudents)   X-Ref
Outputs the things you commonly want at the top of a quiz report.

Calls through to {@link print_header_and_tabs()} and then
outputs the standard group selector, number of attempts summary,
and messages to cover common cases when the report can't be shown.

param: stdClass $cm the course_module information.
param: stdClass $course the course settings.
param: stdClass $quiz the quiz settings.
param: mod_quiz_attempts_report_options $options the current report settings.
param: int $currentgroup the current group.
param: bool $hasquestions whether there are any questions in the quiz.
param: bool $hasstudents whether there are any relevant students.

add_user_columns($table, &$columns, &$headers)   X-Ref
Add all the user-related columns to the $columns and $headers arrays.

param: table_sql $table the table being constructed.
param: array $columns the list of columns. Added to.
param: array $headers the columns headings. Added to.

configure_user_columns($table)   X-Ref
Set the display options for the user-related columns in the table.

param: table_sql $table the table being constructed.

add_state_column(&$columns, &$headers)   X-Ref
Add the state column to the $columns and $headers arrays.

param: array $columns the list of columns. Added to.
param: array $headers the columns headings. Added to.

add_time_columns(&$columns, &$headers)   X-Ref
Add all the time-related columns to the $columns and $headers arrays.

param: array $columns the list of columns. Added to.
param: array $headers the columns headings. Added to.

add_grade_columns($quiz, $usercanseegrades, &$columns, &$headers, $includefeedback = true)   X-Ref
Add all the grade and feedback columns, if applicable, to the $columns
and $headers arrays.

param: object $quiz the quiz settings.
param: bool $usercanseegrades whether the user is allowed to see grades for this quiz.
param: array $columns the list of columns. Added to.
param: array $headers the columns headings. Added to.
param: bool $includefeedback whether to include the feedbacktext columns

set_up_table_columns($table, $columns, $headers, $reporturl,mod_quiz_attempts_report_options $options, $collapsible)   X-Ref
Set up the table.

param: table_sql $table the table being constructed.
param: array $columns the list of columns.
param: array $headers the columns headings.
param: moodle_url $reporturl the URL of this report.
param: mod_quiz_attempts_report_options $options the display options.
param: bool $collapsible whether to allow columns in the report to be collapsed.

process_actions($quiz, $cm, $currentgroup, \core\dml\sql_join $groupstudentsjoins,\core\dml\sql_join $allowedjoins, $redirecturl)   X-Ref
Process any submitted actions.

param: object $quiz the quiz settings.
param: object $cm the cm object for the quiz.
param: int $currentgroup the currently selected group.
param: \core\dml\sql_join $groupstudentsjoins (joins, wheres, params) the students in the current group.
param: \core\dml\sql_join $allowedjoins (joins, wheres, params) the users whose attempt this user is allowed to modify.
param: moodle_url $redirecturl where to redircet to after a successful action.

delete_selected_attempts($quiz, $cm, $attemptids, \core\dml\sql_join $allowedjoins)   X-Ref
Delete the quiz attempts

param: object $quiz the quiz settings. Attempts that don't belong to
param: object $cm the course_module object.
param: array $attemptids the list of attempt ids to delete.
param: \core\dml\sql_join $allowedjoins (joins, wheres, params) This list of userids that are visible in the report.

load_relevant_students($cm, $course = null)   X-Ref
Get information about which students to show in the report.

param: object $cm the coures module.
param: object $course the course settings.
return: array with four elements: