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 402 and 403]

(no description)

File Size: 381 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: 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: stdClass $quiz
param: stdClass $cm
param: stdClass $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: stdClass $cm the course module.
param: stdClass $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 {@see 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: 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: stdClass $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,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: 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: stdClass $quiz the quiz settings.
param: stdClass $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: stdClass $quiz the quiz settings. Attempts that don't belong to
param: stdClass $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.