Differences Between: [Versions 311 and 402] [Versions 400 and 402] [Versions 401 and 402] [Versions 402 and 403]
List of deprecated mod_quiz functions.
Copyright: | 2021 Shamim Rezaie <shamim@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 486 lines (19 kb) |
Included or required: | 1 time |
Referenced: | 1 time |
Includes or requires: | 0 files |
mod_quiz_overdue_attempt_updater:: (2 methods):
update_overdue_attempts()
get_list_of_overdue_attempts()
moodle_quiz_exception:: (8 methods):
__construct()
quiz_update_sumgrades()
quiz_update_all_attempt_sumgrades()
quiz_update_all_final_grades()
quiz_set_grade()
quiz_save_best_grade()
quiz_calculate_best_grade()
quiz_calculate_best_attempt()
Class: mod_quiz_overdue_attempt_updater - X-Ref
Class: moodle_quiz_exception - X-Ref
Class for quiz exceptions. Just saves a couple of arguments on the__construct($quizobj, $errorcode, $a = null, $link = '', $debuginfo = null) X-Ref |
Constructor. param: quiz_settings $quizobj the quiz the error relates to. param: string $errorcode The name of the string from error.php to print. param: mixed $a Extra words and phrases that might be required in the error string. param: string $link The url where the user will be prompted to continue. param: string|null $debuginfo optional debugging information. |
quiz_update_sumgrades($quiz) X-Ref |
Update the sumgrades field of the quiz. This needs to be called whenever the grading structure of the quiz is changed. For example if a question is added or removed, or a question weight is changed. You should call {@see quiz_delete_previews()} before you call this function. param: stdClass $quiz a quiz. |
quiz_update_all_attempt_sumgrades($quiz) X-Ref |
Update the sumgrades field of the attempts at a quiz. param: stdClass $quiz a quiz. |
quiz_update_all_final_grades($quiz) X-Ref |
Update the final grade at this quiz for all students. This function is equivalent to calling quiz_save_best_grade for all users, but much more efficient. param: stdClass $quiz the quiz settings. |
quiz_set_grade($newgrade, $quiz) X-Ref |
The quiz grade is the maximum that student's results are marked out of. When it changes, the corresponding data in quiz_grades and quiz_feedback needs to be rescaled. After calling this function, you probably need to call quiz_update_all_attempt_sumgrades, grade_calculator::recompute_all_final_grades(); quiz_update_grades. (At least, that is what this comment has said for years, but it seems to call recompute_all_final_grades itself.) param: float $newgrade the new maximum grade for the quiz. param: stdClass $quiz the quiz we are updating. Passed by reference so its return: bool indicating success or failure. |
quiz_save_best_grade($quiz, $userid = null, $attempts = []) X-Ref |
Save the overall grade for a user at a quiz in the quiz_grades table param: stdClass $quiz The quiz for which the best grade is to be calculated and then saved. param: int $userid The userid to calculate the grade for. Defaults to the current user. param: array $attempts The attempts of this user. Useful if you are return: bool Indicates success or failure. |
quiz_calculate_best_grade($quiz, $attempts) X-Ref |
Calculate the overall grade for a quiz given a number of attempts by a particular user. param: stdClass $quiz the quiz settings object. param: array $attempts an array of all the user's attempts at this quiz in order. return: float the overall grade |
quiz_calculate_best_attempt($quiz, $attempts) X-Ref |
Return the attempt with the best grade for a quiz Which attempt is the best depends on $quiz->grademethod. If the grade method is GRADEAVERAGE then this function simply returns the last attempt. param: stdClass $quiz The quiz for which the best grade is to be calculated param: array $attempts An array of all the attempts of the user at the quiz return: stdClass The attempt with the best grade |
quiz_completion_check_passing_grade_or_all_attempts($course, $cm, $userid, $quiz) X-Ref |
Internal function used in quiz_get_completion_state. Check passing grade (or no attempts left) requirement for completion. param: stdClass $course param: cm_info|stdClass $cm param: int $userid param: stdClass $quiz return: bool True if the passing grade (or no attempts left) requirement is disabled or met. |
quiz_completion_check_min_attempts($userid, $quiz) X-Ref |
Internal function used in quiz_get_completion_state. Check minimum attempts requirement for completion. param: int $userid param: stdClass $quiz return: bool True if minimum attempts requirement is disabled or met. |
quiz_get_completion_state($course, $cm, $userid, $type) X-Ref |
Obtains the automatic completion state for this quiz on any conditions in quiz settings, such as if all attempts are used or a certain grade is achieved. param: stdClass $course Course param: cm_info|stdClass $cm Course-module param: int $userid User ID param: bool $type Type of comparison (or/and; can be used as return value if no conditions) return: bool True if completed, false if not. (If no conditions, then return |
quiz_retrieve_tags_for_slot_ids($slotids) X-Ref |
Retrieves tag information for the given list of quiz slot ids. Currently the only slots that have tags are random question slots. Example: If we have 3 slots with id 1, 2, and 3. The first slot has two tags, the second has one tag, and the third has zero tags. The return structure will look like: [ 1 => [ quiz_slot_tags.id => { ...tag data... }, quiz_slot_tags.id => { ...tag data... }, ], 2 => [ quiz_slot_tags.id => { ...tag data... }, ], 3 => [], ] param: int[] $slotids The list of id for the quiz slots. return: array[] List of quiz_slot_tags records indexed by slot id. |
quiz_has_question_use($quiz, $slot) X-Ref |
No description |