Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

This file defines the quiz manual grading report class.

Copyright: 2006 Gustav Delius
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 751 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: quiz_grading_report  - X-Ref

Quiz report to help teachers manually grade questions that need it.

This report basically provides two screens:
- List question that might need manual grading (or optionally all questions).
- Provide an efficient UI to grade all attempts at a particular question.

display($quiz, $cm, $course)   X-Ref
No description

get_qubaids_condition()   X-Ref
Get the JOIN conditions needed so we only show attempts by relevant users.

return: qubaid_join

load_attempts_by_usage_ids($qubaids)   X-Ref
Load the quiz_attempts rows corresponding to a list of question_usage ids.

param: int[] $qubaids the question_usage ids of the quiz_attempts to load.
return: array quiz attempts, with added user name fields.

base_url()   X-Ref
Get the URL of the front page of the report that lists all the questions.

return: moodle_url the URL.

list_questions_url($includeauto = null)   X-Ref
Get the URL of the front page of the report that lists all the questions.

param: bool $includeauto if not given, use the current setting, otherwise,
return: moodle_url the URL.

grade_question_url($slot, $questionid, $grade, $page = true)   X-Ref
Get the URL to grade a batch of question attempts.

param: int $slot
param: int $questionid
param: string $grade
param: int|bool $page = true, link to current page. false = omit page.
return: moodle_url

format_count_for_table($counts, $type, $gradestring)   X-Ref
Renders the contents of one cell of the table on the index view.

param: stdClass $counts counts of different types of attempt for this slot.
param: string $type the type of count to format.
param: string $gradestring get_string identifier for the grading link text, if required.
return: string HTML.

display_index($includeauto)   X-Ref
Display the report front page which summarises the number of attempts to grade.

param: bool $includeauto whether to show automatically-graded questions.

display_grading_interface($slot, $questionid, $grade,$pagesize, $page, $shownames, $showcustomfields, $order, $counts)   X-Ref
Display the UI for grading attempts at one question.

param: int $slot identifies which question to grade.
param: int $questionid identifies which question to grade.
param: string $grade type of attempts to grade.
param: int $pagesize number of questions to show per page.
param: int $page current page number.
param: bool $shownames whether student names should be shown.
param: bool $showcustomfields whether custom field values should be shown.
param: string $order preferred order of attempts.
param: stdClass $counts object that stores the number of each type of attempt.

validate_submitted_marks()   X-Ref
When saving a grading page, are all the submitted marks valid?

return: bool true if all valid, else false.

process_submitted_data()   X-Ref
Save all submitted marks to the database.

return: bool returns true if some attempts or all are graded. False, if none of the attempts are graded.

get_question_state_summary($slots)   X-Ref
Load information about the number of attempts at various questions in each
summarystate.

The results are returned as an two dimensional array $qubaid => $slot => $dataobject

param: array $slots A list of slots for the questions you want to konw about.
return: array The array keys are slot,qestionid. The values are objects with

get_usage_ids_where_question_in_state($summarystate, $slot,$questionid = null, $orderby = 'random', $page = 0, $pagesize = null)   X-Ref
Get a list of usage ids where the question with slot $slot, and optionally
also with question id $questionid, is in summary state $summarystate. Also
return the total count of such states.

Only a subset of the ids can be returned by using $orderby, $limitfrom and
$limitnum. A special value 'random' can be passed as $orderby, in which case
$limitfrom is ignored.

param: int $slot The slot for the questions you want to konw about.
param: int $questionid (optional) Only return attempts that were of this specific question.
param: string $summarystate 'all', 'needsgrading', 'autograded' or 'manuallygraded'.
param: string $orderby 'random', 'date', 'student' or 'idnumber'.
param: int $page implements paging of the results.
param: int $pagesize implements paging of the results. null = all.
return: array with two elements, an array of usage ids, and a count of the total number.

print_header_and_tabs($cm, $course, $quiz, $reportmode = 'overview')   X-Ref
Initialise some parts of $PAGE and start output.

param: object $cm the course_module information.
param: object $course the course settings.
param: object $quiz the quiz settings.
param: string $reportmode the report name.

get_question_heading(stdClass $attempt, bool $shownames, bool $showcustomfields)   X-Ref
Get question heading.

param: stdClass $attempt An instance of quiz_attempt.
param: bool $shownames True to show the student first/lastnames.
param: bool $showcustomfields Whether custom field values should be shown.
return: string The string text for the question heading.