Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Quiz report subclass for the overview (grades) report. More...
Public Member Functions | |
display ($quiz, $cm, $course) | |
Override this function to display the report. | |
get_current_group ($cm, $course, $context) | |
Get the current group for the user user looking at the report. | |
init ($mode, $formclass, $quiz, $cm, $course) | |
Initialise various aspects of this report. | |
print_header_and_tabs ($cm, $course, $quiz, $reportmode='overview') | |
Initialise some parts of $PAGE and start output. | |
regrade_attempt ($attempt, $dryrun=false, $slots=null) | |
Regrade a particular quiz attempt. | |
Static Public Member Functions | |
static | get_bands_count_and_width ($quiz) |
Get the bands configuration for the quiz. | |
static | get_bands_labels ($bands, $bandwidth, $quiz) |
Get the bands labels. | |
Protected Member Functions | |
add_grade_columns ($quiz, $usercanseegrades, &$columns, &$headers, $includefeedback=true) | |
Add all the grade and feedback columns, if applicable, to the $columns and $headers arrays. | |
add_state_column (&$columns, &$headers) | |
Add the state column to the $columns and $headers arrays. | |
add_time_columns (&$columns, &$headers) | |
Add all the time-related columns to the $columns and $headers arrays. | |
add_user_columns ($table, &$columns, &$headers) | |
Add all the user-related columns to the $columns and $headers arrays. | |
clear_regrade_table ($quiz, core\dml\sql_join $groupstudentsjoins) | |
Remove all information about pending/complete regrades from the database. | |
configure_user_columns ($table) | |
Set the display options for the user-related columns in the table. | |
count_question_attempts_needing_regrade ($quiz, core\dml\sql_join $groupstudentsjoins) | |
Count the number of attempts in need of a regrade. | |
delete_selected_attempts ($quiz, $cm, $attemptids, core\dml\sql_join $allowedjoins) | |
Delete the quiz attempts. | |
finish_regrade ($nexturl) | |
Finish displaying the regrade progress page. | |
get_base_url () | |
Get the base URL for this report. | |
get_students_joins ($cm, $course=null) | |
Get sql fragments (joins) which can be used to build queries that will select an appropriate set of students to show in the reports. | |
has_regraded_questions ($from, $where, $params) | |
Are there any pending regrades in the table we are going to show? | |
print_standard_header_and_messages ($cm, $course, $quiz, $options, $currentgroup, $hasquestions, $hasstudents) | |
Outputs the things you commonly want at the top of a quiz report. | |
process_actions ($quiz, $cm, $currentgroup, core\dml\sql_join $groupstudentsjoins, core\dml\sql_join $allowedjoins, $redirecturl) | |
Extends parent function processing any submitted actions. | |
regrade_attempts ($quiz, $dryrun=false, core\dml\sql_join $groupstudentsjoins=null, $attemptids=[]) | |
Regrade attempts for this quiz, exactly which attempts are regraded is controlled by the parameters. | |
regrade_attempts_needing_it ($quiz, core\dml\sql_join $groupstudentsjoins) | |
Regrade those questions in those attempts that are marked as needing regrading in the quiz_overview_regrades table. | |
regrade_batch_of_attempts ($quiz, array $attempts, bool $dryrun, core\dml\sql_join $groupstudentsjoins) | |
This is a helper used by regrade_attempts() and regrade_attempts_needing_it(). | |
set_up_table_columns ($table, $columns, $headers, $reporturl, attempts_report_options $options, $collapsible) | |
Set up the table. | |
start_regrade ($quiz, $cm) | |
Check necessary capabilities, and start the display of the regrade progress page. | |
unlock_session () | |
Unlock the session and allow the regrading process to run in the background. | |
update_overall_grades ($quiz) | |
Update the final grades for all attempts. | |
Static Protected Member Functions | |
static | get_chart ($labels, $data) |
Get a chart. | |
Protected Attributes | |
context_module | $context |
the quiz context. | |
attempts_report_options_form | $form |
The settings form to use. | |
bool | $hasgroupstudents |
string | $mode |
the mode this report is. | |
string | $qmsubselect |
SQL fragment for selecting the attempt that gave the final grade, if applicable. | |
quiz_settings null | $quizobj = null |
quiz settings object. | |
boolean | $showgrades = null |
caches the results of { | |
Quiz report subclass for the overview (grades) report.
|
protectedinherited |
Add all the grade and feedback columns, if applicable, to the $columns and $headers arrays.
stdClass | $quiz | the quiz settings. |
bool | $usercanseegrades | whether the user is allowed to see grades for this quiz. |
array | $columns | the list of columns. Added to. |
array | $headers | the columns headings. Added to. |
bool | $includefeedback | whether to include the feedbacktext columns |
|
protectedinherited |
Add the state column to the $columns and $headers arrays.
array | $columns | the list of columns. Added to. |
array | $headers | the columns headings. Added to. |
|
protectedinherited |
Add all the time-related columns to the $columns and $headers arrays.
array | $columns | the list of columns. Added to. |
array | $headers | the columns headings. Added to. |
|
protectedinherited |
Add all the user-related columns to the $columns and $headers arrays.
table_sql | $table | the table being constructed. |
array | $columns | the list of columns. Added to. |
array | $headers | the columns headings. Added to. |
|
protected |
Remove all information about pending/complete regrades from the database.
stdClass | $quiz | the quiz settings. |
core\dml\sql_join | $groupstudentsjoins | (joins, wheres, params). If this is given, only data relating to these users is cleared. |
|
protectedinherited |
Set the display options for the user-related columns in the table.
table_sql | $table | the table being constructed. |
|
protected |
Count the number of attempts in need of a regrade.
stdClass | $quiz | the quiz settings. |
core\dml\sql_join | $groupstudentsjoins | (joins, wheres, params) If this is given, only data relating to these users is cleared. |
int | the number of attempts. |
|
protectedinherited |
Delete the quiz attempts.
stdClass | $quiz | the quiz settings. Attempts that don't belong to this quiz are not deleted. |
stdClass | $cm | the course_module object. |
array | $attemptids | the list of attempt ids to delete. |
core\dml\sql_join | $allowedjoins | (joins, wheres, params) This list of userids that are visible in the report. Users can only delete attempts that they are allowed to see in the report. Empty means all users. |
Reimplemented in testable_quiz_attempts_report.
quiz_overview_report::display | ( | $quiz, | |
$cm, | |||
$course ) |
Override this function to display the report.
stdClass | $quiz | this quiz. |
stdClass | $cm | the course-module for this quiz. |
stdClass | $course | the coures we are in. |
Reimplemented from mod_quiz\local\reports\report_base.
|
protected |
Finish displaying the regrade progress page.
moodle_url | $nexturl | where to send the user after the regrade. @uses exit. This method never returns. |
|
static |
Get the bands configuration for the quiz.
This returns the configuration for having between 11 and 20 bars in a chart based on the maximum grade to be given on a quiz. The width of a band is the number of grade points it encapsulates.
stdClass | $quiz | The quiz object. |
array | Contains the number of bands, and their width. |
|
static |
Get the bands labels.
int | $bands | The number of bands. |
int | $bandwidth | The band width. |
stdClass | $quiz | The quiz object. |
string[] | The labels. |
|
protectedinherited |
Get the base URL for this report.
moodle_url | the URL. |
|
staticprotected |
Get a chart.
string[] | $labels | Chart labels. |
int[] | $data | The data. |
core\chart_base |
|
inherited |
Get the current group for the user user looking at the report.
stdClass | $cm | the course_module information. |
stdClass | $course | the course settings. |
context | $context | the quiz context. |
int | the current group id, if applicable. 0 for all users, NO_GROUPS_ALLOWED if the user cannot see any group. |
|
protectedinherited |
Get sql fragments (joins) which can be used to build queries that will select an appropriate set of students to show in the reports.
stdClass | $cm | the course module. |
stdClass | $course | the course settings. |
array | with four elements: 0 => integer the current group id (0 for none). 1 => core\dml\sql_join Contains joins, wheres, params for all the students in this course. 2 => core\dml\sql_join Contains joins, wheres, params for all the students in the current group. 3 => core\dml\sql_join Contains joins, wheres, params for all the students to show in the report. Will be the same as either element 1 or 2. |
|
protected |
Are there any pending regrades in the table we are going to show?
string | $from | tables used by the main query. |
string | $where | where clause used by the main query. |
array | $params | required by the SQL. |
bool | whether there are pending regrades. |
|
inherited |
Initialise various aspects of this report.
string | $mode | |
string | $formclass | |
stdClass | $quiz | |
stdClass | $cm | |
stdClass | $course |
array | with four elements: 0 => integer the current group id (0 for none). 1 => core\dml\sql_join Contains joins, wheres, params for all the students in this course. 2 => core\dml\sql_join Contains joins, wheres, params for all the students in the current group. 3 => core\dml\sql_join Contains joins, wheres, params for all the students to show in the report. Will be the same as either element 1 or 2. |
|
inherited |
Initialise some parts of $PAGE and start output.
stdClass | $cm | the course_module information. |
stdClass | $course | the course settings. |
stdClass | $quiz | the quiz settings. |
string | $reportmode | the report name. |
Reimplemented in quiz_grading_report.
|
protectedinherited |
Outputs the things you commonly want at the top of a quiz report.
Calls through to {
stdClass | $cm | the course_module information. |
stdClass | $course | the course settings. |
stdClass | $quiz | the quiz settings. |
attempts_report_options | $options | the current report settings. |
int | $currentgroup | the current group. |
bool | $hasquestions | whether there are any questions in the quiz. |
bool | $hasstudents | whether there are any relevant students. |
|
protected |
Extends parent function processing any submitted actions.
stdClass | $quiz | |
stdClass | $cm | |
int | $currentgroup | |
core\dml\sql_join | $groupstudentsjoins | (joins, wheres, params) |
core\dml\sql_join | $allowedjoins | (joins, wheres, params) |
moodle_url | $redirecturl |
Reimplemented from mod_quiz\local\reports\attempts_report.
quiz_overview_report::regrade_attempt | ( | $attempt, | |
$dryrun = false, | |||
$slots = null ) |
Regrade a particular quiz attempt.
Either for real ($dryrun = false), or as a pretend regrade to see which fractions would change. The outcome is stored in the quiz_overview_regrades table.
Note, $attempt is not upgraded in the database. The caller needs to do that. However, $attempt->sumgrades is updated, if this is not a dry run.
stdClass | $attempt | the quiz attempt to regrade. |
bool | $dryrun | if true, do a pretend regrade, otherwise do it for real. |
array | $slots | if null, regrade all questions, otherwise, just regrade the questions with those slots. |
array | messages array with keys slot number, and values reasons why that slot cannot be regraded. |
|
protected |
Regrade attempts for this quiz, exactly which attempts are regraded is controlled by the parameters.
stdClass | $quiz | the quiz settings. |
bool | $dryrun | if true, do a pretend regrade, otherwise do it for real. |
core\dml\sql_join | null | $groupstudentsjoins | empty for all attempts, otherwise regrade attempts for these users. |
array | $attemptids | blank for all attempts, otherwise only regrade attempts whose id is in this list. |
|
protected |
Regrade those questions in those attempts that are marked as needing regrading in the quiz_overview_regrades table.
stdClass | $quiz | the quiz settings. |
core\dml\sql_join | $groupstudentsjoins | empty for all attempts, otherwise regrade attempts for these users. |
|
protected |
This is a helper used by regrade_attempts() and regrade_attempts_needing_it().
Given an array of attempts, it regrades them all, or does a dry run. Each object in the attempts array must be a row from the quiz_attempts table, with the core_user\fields\for_name() fields from the user table joined in. In addition, if $attempt->regradeonlyslots is set, then only those slots are regraded, otherwise all slots are regraded.
stdClass | $quiz | the quiz settings. |
array | $attempts | of data from the quiz_attempts table, with extra data as above. |
bool | $dryrun | if true, do a pretend regrade, otherwise do it for real. |
core\dml\sql_join | $groupstudentsjoins | empty for all attempts, otherwise regrade attempts |
|
protectedinherited |
Set up the table.
table_sql | $table | the table being constructed. |
array | $columns | the list of columns. |
array | $headers | the columns headings. |
moodle_url | $reporturl | the URL of this report. |
attempts_report_options | $options | the display options. |
bool | $collapsible | whether to allow columns in the report to be collapsed. |
|
protected |
Check necessary capabilities, and start the display of the regrade progress page.
stdClass | $quiz | the quiz settings. |
stdClass | $cm | the cm object for the quiz. |
|
protected |
Update the final grades for all attempts.
This method is used following a regrade.
stdClass | $quiz | the quiz settings. |
|
protectedinherited |
quiz settings object.
Set in the init method.
|
protectedinherited |
caches the results of {