See Release Notes
Long Term Support Release
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 overview report class.
Copyright: | 1999 onwards Martin Dougiamas and others {@link http://moodle.com} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 765 lines (33 kb) |
Included or required: | 0 times |
Referenced: | 1 time |
Includes or requires: | 0 files |
quiz_overview_report:: (18 methods):
display()
process_actions()
start_regrade()
finish_regrade()
unlock_session()
regrade_attempt()
clear_regrade_date_cache()
get_new_question_for_regrade()
regrade_attempts()
regrade_attempts_needing_it()
regrade_batch_of_attempts()
count_question_attempts_needing_regrade()
has_regraded_questions()
clear_regrade_table()
update_overall_grades()
get_bands_count_and_width()
get_bands_labels()
get_chart()
Class: quiz_overview_report - X-Ref
Quiz report subclass for the overview (grades) report.display($quiz, $cm, $course) X-Ref |
process_actions($quiz, $cm, $currentgroup, \core\dml\sql_join $groupstudentsjoins,\core\dml\sql_join $allowedjoins, $redirecturl) X-Ref |
Extends parent function processing any submitted actions. param: object $quiz param: object $cm param: int $currentgroup param: \core\dml\sql_join $groupstudentsjoins (joins, wheres, params) param: \core\dml\sql_join $allowedjoins (joins, wheres, params) param: moodle_url $redirecturl |
start_regrade($quiz, $cm) X-Ref |
Check necessary capabilities, and start the display of the regrade progress page. param: object $quiz the quiz settings. param: object $cm the cm object for the quiz. |
finish_regrade($nexturl) X-Ref |
Finish displaying the regrade progress page. param: moodle_url $nexturl where to send the user after the regrade. |
unlock_session() X-Ref |
Unlock the session and allow the regrading process to run in the background. |
regrade_attempt($attempt, $dryrun = false, $slots = null) X-Ref |
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. param: object $attempt the quiz attempt to regrade. param: bool $dryrun if true, do a pretend regrade, otherwise do it for real. param: array $slots if null, regrade all questions, otherwise, just regrade return: array messages array with keys slot number, and values reasons why that slot cannot be regraded. |
clear_regrade_date_cache() X-Ref |
For use in tests only. Clear the cached regrade data. |
get_new_question_for_regrade(stdClass $attempt,question_usage_by_activity $quba, int $slot) X-Ref |
Work out of we should be using a new question version for a particular slot in a regrade. param: stdClass $attempt the attempt being regraded. param: question_usage_by_activity $quba the question_usage corresponding to that. param: int $slot which slot is currently being regraded. return: question_definition other question version to use for this slot. |
regrade_attempts($quiz, $dryrun = false,\core\dml\sql_join$groupstudentsjoins = null, $attemptids = array() X-Ref |
Regrade attempts for this quiz, exactly which attempts are regraded is controlled by the parameters. param: object $quiz the quiz settings. param: bool $dryrun if true, do a pretend regrade, otherwise do it for real. param: \core\dml\sql_join|array $groupstudentsjoins empty for all attempts, otherwise regrade attempts param: array $attemptids blank for all attempts, otherwise only regrade |
regrade_attempts_needing_it($quiz, \core\dml\sql_join $groupstudentsjoins) X-Ref |
Regrade those questions in those attempts that are marked as needing regrading in the quiz_overview_regrades table. param: object $quiz the quiz settings. param: \core\dml\sql_join $groupstudentsjoins empty for all attempts, otherwise regrade attempts |
regrade_batch_of_attempts($quiz, array $attempts,bool $dryrun, \core\dml\sql_join $groupstudentsjoins) X-Ref |
This is a helper used by {@link regrade_attempts()} and {@link 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. param: object $quiz the quiz settings. param: array $attempts of data from the quiz_attempts table, with extra data as above. param: bool $dryrun if true, do a pretend regrade, otherwise do it for real. param: \core\dml\sql_join $groupstudentsjoins empty for all attempts, otherwise regrade attempts |
count_question_attempts_needing_regrade($quiz, \core\dml\sql_join $groupstudentsjoins) X-Ref |
Count the number of attempts in need of a regrade. param: object $quiz the quiz settings. param: \core\dml\sql_join $groupstudentsjoins (joins, wheres, params) If this is given, only data relating return: int the number of attempts. |
has_regraded_questions($from, $where, $params) X-Ref |
Are there any pending regrades in the table we are going to show? param: string $from tables used by the main query. param: string $where where clause used by the main query. param: array $params required by the SQL. return: bool whether there are pending regrades. |
clear_regrade_table($quiz, \core\dml\sql_join $groupstudentsjoins) X-Ref |
Remove all information about pending/complete regrades from the database. param: object $quiz the quiz settings. param: \core\dml\sql_join $groupstudentsjoins (joins, wheres, params). If this is given, only data relating |
update_overall_grades($quiz) X-Ref |
Update the final grades for all attempts. This method is used following a regrade. param: object $quiz the quiz settings. param: array $userids only update scores for these userids. param: array $attemptids attemptids only update scores for these attempt ids. |
get_bands_count_and_width($quiz) X-Ref |
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. param: object $quiz The quiz object. return: array Contains the number of bands, and their width. |
get_bands_labels($bands, $bandwidth, $quiz) X-Ref |
Get the bands labels. param: int $bands The number of bands. param: int $bandwidth The band width. param: object $quiz The quiz object. return: string[] The labels. |
get_chart($labels, $data) X-Ref |
Get a chart. param: string[] $labels Chart labels. param: int[] $data The data. return: \core\chart_base |