Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
gradelib.php File Reference

Functions

 grade_course_category_delete ($categoryid, $newparentid, $showfeedback)
 Called when course category is deleted Cleans the gradebook of associated data.
 
 grade_course_reset ($courseid)
 Reset all course grades, refetch from the activities and recalculate.
 
 grade_floats_different (?float $f1, ?float $f2)
 Compare two float numbers safely.
 
 grade_floats_equal (?float $f1, ?float $f2)
 Compare two float numbers safely.
 
 grade_floatval (?float $number)
 Convert a number to 5 decimal point float, null db compatible format (we need this to decide if db value changed)
 
 grade_force_full_regrading ($courseid)
 Force final grade recalculation in all course items.
 
 grade_force_site_regrading ()
 Forces regrading of all site grades.
 
 grade_format_gradevalue (?float $value, &$grade_item, $localized=true, $displaytype=null, $decimals=null)
 Returns string representation of grade value.
 
 grade_format_gradevalue_letter (?float $value, $grade_item)
 Returns a letter grade representation of a grade value The array of grade letters used is produced by grade_get_letters() using the course context.
 
 grade_format_gradevalue_percentage (?float $value, $grade_item, $decimals, $localized)
 Returns a percentage representation of a grade value.
 
 grade_format_gradevalue_real (?float $value, $grade_item, $decimals, $localized)
 Returns a float representation of a grade value.
 
 grade_get_categories_menu ($courseid, $includenew=false)
 Returns grade options for gradebook grade category menu.
 
 grade_get_date_for_user_grade (\stdClass $grade, stdClass $user)
 Get the most appropriate grade date for a grade item given the user that the grade relates to.
 
 grade_get_grades ($courseid, $itemtype, $itemmodule, $iteminstance, $userid_or_ids=null)
 Returns grading information for given activity, optionally with user grades.
 
 grade_get_letters ($context=null)
 Returns the array of grade letters to be used in the supplied context.
 
 grade_get_setting ($courseid, $name, $default=null, $resetcache=false)
 Returns a course gradebook setting.
 
 grade_get_settings ($courseid)
 Returns all course gradebook settings as object properties.
 
 grade_grab_course_grades ($courseid, $modname=null, $userid=0)
 Refetches grade data from course activities.
 
 grade_needs_regrade_final_grades ($courseid)
 Return true if the course needs regrading.
 
 grade_needs_regrade_progress_bar ($courseid)
 Return true if the regrade process is likely to be time consuming and will therefore require the progress bar.
 
 grade_recover_history_grades ($userid, $courseid)
 Recover a user's grades from grade_grades_history.
 
 grade_regrade_final_grades ($courseid, $userid=null, $updated_item=null, $progress=null)
 Updates all final grades in course.
 
 grade_regrade_final_grades_if_required ($course, callable $callback=null)
 Check whether regarding of final grades is required and, if so, perform the regrade.
 
 grade_set_setting ($courseid, $name, $value)
 Add, update or delete a course gradebook setting.
 
 grade_uninstalled_module ($modname)
 Does gradebook cleanup when a module is uninstalled Deletes all associated grade items.
 
 grade_update ($source, $courseid, $itemtype, $itemmodule, $iteminstance, $itemnumber, $grades=null, $itemdetails=null, $isbulkupdate=false)
 Include essential files.
 
 grade_update_mod_grades ($modinstance, $userid=0)
 Force full update of module grades in central gradebook.
 
 grade_update_outcomes ($source, $courseid, $itemtype, $itemmodule, $iteminstance, $userid, $data)
 Updates a user's outcomes.
 
 grade_user_delete ($userid)
 Deletes all of a user's grade data from gradebook.
 
 grade_user_unenrol ($courseid, $userid)
 Purge course data when user unenrolls from a course.
 
 grade_verify_idnumber ($idnumber, $courseid, $grade_item=null, $cm=null)
 Verify new value of grade item idnumber.
 
 remove_course_grades ($courseid, $showfeedback)
 Remove all grade related course data Grade history is kept.
 
 remove_grade_letters ($context, $showfeedback)
 Remove grade letters for given context.
 

Variables

global $CFG