Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Namespaces | |
namespace | core_grades\privacy |
| |
Classes | |
class | core_grades\privacy\grade_grade_with_history |
A grade_item which has a reference to its historical content. More... | |
class | grade_category |
grade_category is an object mapped to DB table {prefix}grade_categories More... | |
class | grade_grade |
grade_grades is an object mapped to DB table {prefix}grade_grades More... | |
class | grade_item |
Class representing a grade item. More... | |
class | grade_object |
An abstract object that holds methods and attributes common to all grade_* objects defined here. More... | |
class | grade_outcome |
Class representing a grade outcome. More... | |
class | grade_scale |
Class representing a grade scale. More... | |
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_course_grade ($userid, $courseid_or_ids=null) | |
Returns the aggregated or calculated course grade for a single user for one or more courses. | |
grade_get_course_grades ($courseid, $userid_or_ids=null) | |
Functions used to retrieve grades objects. | |
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_gradable_activities ($courseid, $modulename='') | |
Returns an array of activities (defined as $cm objects) which are gradeable from gradebook, outcomes are ignored. | |
grade_get_grade_items_for_activity ($cm, $only_main_item=false) | |
Returns all grade items (including outcomes) or main item for a given activity identified by $cm object. | |
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_is_user_graded_in_activity ($cm, $userid) | |
Returns whether or not a user received grades in main grade item for given activity. | |
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 |
const | GRADE_AGGREGATE_EXTRACREDIT_MEAN 12 |
GRADE_AGGREGATE_EXTRACREDIT_MEAN - Use the category mean for grade aggregation and include support for extra credit. | |
const | GRADE_AGGREGATE_MAX 6 |
GRADE_AGGREGATE_MAX - Use the category maximum grade for grade aggregation. | |
const | GRADE_AGGREGATE_MEAN 0 |
GRADE_AGGREGATE_MEAN - Use the category mean for grade aggregation. | |
const | GRADE_AGGREGATE_MEDIAN 2 |
GRADE_AGGREGATE_MEDIAN - Use the category median for grade aggregation. | |
const | GRADE_AGGREGATE_MIN 4 |
GRADE_AGGREGATE_MIN - Use the category minimum grade for grade aggregation. | |
const | GRADE_AGGREGATE_MODE 8 |
GRADE_AGGREGATE_MEDIAN - Use the category mode for grade aggregation. | |
const | GRADE_AGGREGATE_SUM 13 |
GRADE_AGGREGATE_SUM - Use Natural in the category for grade aggregation. | |
const | GRADE_AGGREGATE_WEIGHTED_MEAN 10 |
GRADE_AGGREGATE_WEIGHTED_MEAN - Use a weighted mean of grades in the category for grade aggregation. | |
const | GRADE_AGGREGATE_WEIGHTED_MEAN2 11 |
GRADE_AGGREGATE_WEIGHTED_MEAN2 - Use a simple weighted mean of grades in the category for grade aggregation. | |
const | GRADE_DISPLAY_TYPE_DEFAULT 0 |
GRADE_DISPLAY_TYPE_DEFAULT - Grade display type can be set at 3 levels: grade_item, course setting and site. | |
const | GRADE_DISPLAY_TYPE_LETTER 3 |
GRADE_DISPLAY_TYPE_LETTER - Display the grade as a letter grade. | |
const | GRADE_DISPLAY_TYPE_LETTER_PERCENTAGE 32 |
GRADE_DISPLAY_TYPE_LETTER_PERCENTAGE - Display the grade as a letter grade and a percentage. | |
const | GRADE_DISPLAY_TYPE_LETTER_REAL 31 |
GRADE_DISPLAY_TYPE_LETTER_REAL - Display the grade as a letter grade and a decimal number. | |
const | GRADE_DISPLAY_TYPE_PERCENTAGE 2 |
GRADE_DISPLAY_TYPE_PERCENTAGE - Display the grade as a percentage. | |
const | GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER 23 |
GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER - Display the grade as a percentage and a letter grade. | |
const | GRADE_DISPLAY_TYPE_PERCENTAGE_REAL 21 |
GRADE_DISPLAY_TYPE_PERCENTAGE_REAL - Display the grade as a percentage and a decimal number. | |
const | GRADE_DISPLAY_TYPE_REAL 1 |
GRADE_DISPLAY_TYPE_REAL - Display the grade as a decimal number. | |
const | GRADE_DISPLAY_TYPE_REAL_LETTER 13 |
GRADE_DISPLAY_TYPE_REAL_LETTER - Display the grade as a decimal number and a letter grade. | |
const | GRADE_DISPLAY_TYPE_REAL_PERCENTAGE 12 |
GRADE_DISPLAY_TYPE_REAL_PERCENTAGE - Display the grade as a decimal number and a percentage. | |
const | GRADE_FEEDBACK_FILEAREA 'feedback' |
The file area to store the associated grade_grades feedback files. | |
const | GRADE_FILE_COMPONENT 'grade' |
The component to store grade files. | |
const | GRADE_HISTORY_DELETE 3 |
GRADE_HISTORY_INSERT - A grade item was deleted. | |
const | GRADE_HISTORY_FEEDBACK_FILEAREA 'historyfeedback' |
The file area to store the associated grade_grades_history feedback files. | |
const | GRADE_HISTORY_INSERT 1 |
GRADE_HISTORY_INSERT - A grade item was inserted. | |
const | GRADE_HISTORY_UPDATE 2 |
GRADE_HISTORY_UPDATE - A grade item was updated. | |
const | GRADE_MIN_MAX_FROM_GRADE_GRADE 2 |
GRADE_MIN_MAX_FROM_GRADE_GRADE - Get the grade min/max from the grade grade. | |
const | GRADE_MIN_MAX_FROM_GRADE_ITEM 1 |
GRADE_MIN_MAX_FROM_GRADE_ITEM - Get the grade min/max from the grade item. | |
const | GRADE_REPORT_AGGREGATION_POSITION_FIRST 0 |
GRADE_REPORT_AGGREGATION_POSITION_FIRST - Display the course totals before the individual activity grades. | |
const | GRADE_REPORT_AGGREGATION_POSITION_LAST 1 |
GRADE_REPORT_AGGREGATION_POSITION_LAST - Display the course totals after the individual activity grades. | |
const | GRADE_REPORT_HIDE_TOTAL_IF_CONTAINS_HIDDEN 0 |
GRADE_REPORT_HIDE_TOTAL_IF_CONTAINS_HIDDEN - If the category or course total contains a hidden item hide the total from students. | |
const | GRADE_REPORT_MEAN_ALL 0 |
GRADE_REPORT_MEAN_ALL - Include all grade items including those where the student hasn't received a grade when calculating the mean. | |
const | GRADE_REPORT_MEAN_GRADED 1 |
GRADE_REPORT_MEAN_GRADED - Only include grade items where the student has a grade when calculating the mean. | |
const | GRADE_REPORT_PREFERENCE_DEFAULT 'default' |
GRADE_REPORT_PREFERENCE_DEFAULT - Use the setting from site preferences. | |
const | GRADE_REPORT_PREFERENCE_INHERIT 'inherit' |
GRADE_REPORT_PREFERENCE_INHERIT - Inherit the setting value from the parent. | |
const | GRADE_REPORT_PREFERENCE_UNUSED -1 |
GRADE_REPORT_PREFERENCE_UNUSED - Unused constant. | |
const | GRADE_REPORT_SHOW_REAL_TOTAL_IF_CONTAINS_HIDDEN 2 |
GRADE_REPORT_SHOW_REAL_TOTAL_IF_CONTAINS_HIDDEN - If the category or course total contains a hidden item show students the real total including marks from hidden items. | |
const | GRADE_REPORT_SHOW_TOTAL_IF_CONTAINS_HIDDEN 1 |
GRADE_REPORT_SHOW_TOTAL_IF_CONTAINS_HIDDEN - If the category or course total contains a hidden item show the total to students minus grades from the hidden items. | |
const | GRADE_TYPE_NONE 0 |
GRADE_TYPE_NONE - Ungraded. | |
const | GRADE_TYPE_SCALE 2 |
GRADE_TYPE_NONE - The grade is a value from the set of values available in a grade scale. | |
const | GRADE_TYPE_TEXT 3 |
GRADE_TYPE_NONE - Feedback only. | |
const | GRADE_TYPE_VALUE 1 |
GRADE_TYPE_NONE - The grade is a numeric value. | |
const | GRADE_UPDATE_FAILED 1 |
GRADE_UPDATE_FAILED - Grade updated failed. | |
const | GRADE_UPDATE_ITEM_LOCKED 4 |
GRADE_UPDATE_DELETED - Grade item cannot be updated as it is locked. | |
const | GRADE_UPDATE_MULTIPLE 2 |
GRADE_UPDATE_MULTIPLE - Grade update failed because there are multiple grade items with the same itemnumber for this activity. | |
const | GRADE_UPDATE_OK 0 |
GRADE_UPDATE_OK - Grade updated completed successfully. | |
grade_course_category_delete | ( | $categoryid, | |
$newparentid, | |||
$showfeedback ) |
Called when course category is deleted Cleans the gradebook of associated data.
int | $categoryid | The course category id |
int | $newparentid | If empty everything is deleted. Otherwise the ID of the category where content moved |
bool | $showfeedback | print feedback |
grade_course_reset | ( | $courseid | ) |
Reset all course grades, refetch from the activities and recalculate.
int | $courseid | The course to reset |
bool | success |
grade_floats_different | ( | ?float | $f1, |
?float | $f2 ) |
Compare two float numbers safely.
Uses 5 decimals php precision using grade_floatval(). Nulls accepted too. Used for determining if a database update is required
float | null | $f1 | Float one to compare |
float | null | $f2 | Float two to compare |
bool | True if the supplied values are different |
grade_floats_equal | ( | ?float | $f1, |
?float | $f2 ) |
Compare two float numbers safely.
Uses 5 decimals php precision using grade_floatval()
Do not use rounding for 10,5 at the database level as the results may be different from php round() function.
float | null | $f1 | Float one to compare |
float | null | $f2 | Float two to compare |
bool | True if the values should be considered as the same grades |
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)
float | null | $number | The number to convert |
float|null | float or null |
grade_force_full_regrading | ( | $courseid | ) |
Force final grade recalculation in all course items.
int | $courseid | The course ID to recalculate |
grade_force_site_regrading | ( | ) |
Forces regrading of all site grades.
Used when changing site setings
grade_format_gradevalue | ( | ?float | $value, |
& | $grade_item, | ||
$localized = true, | |||
$displaytype = null, | |||
$decimals = null ) |
Returns string representation of grade value.
float | null | $value | The grade value |
object | $grade_item | Grade item object passed by reference to prevent scale reloading |
bool | $localized | use localised decimal separator |
int | $displaytype | type of display. For example GRADE_DISPLAY_TYPE_REAL, GRADE_DISPLAY_TYPE_PERCENTAGE, GRADE_DISPLAY_TYPE_LETTER |
int | $decimals | The number of decimal places when displaying float values |
string |
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.
float | null | $value | The grade value |
object | $grade_item | Grade item object |
string |
grade_format_gradevalue_percentage | ( | ?float | $value, |
$grade_item, | |||
$decimals, | |||
$localized ) |
Returns a percentage representation of a grade value.
float | null | $value | The grade value |
object | $grade_item | Grade item object |
int | $decimals | The number of decimal places |
bool | $localized | use localised decimal separator |
string |
grade_format_gradevalue_real | ( | ?float | $value, |
$grade_item, | |||
$decimals, | |||
$localized ) |
Returns a float representation of a grade value.
float | null | $value | The grade value |
object | $grade_item | Grade item object |
int | $decimals | The number of decimal places |
bool | $localized | use localised decimal separator |
string |
grade_get_categories_menu | ( | $courseid, | |
$includenew = false ) |
Returns grade options for gradebook grade category menu.
int | $courseid | The course ID |
bool | $includenew | Include option for new category at array index -1 |
array | of grade categories in course |
grade_get_course_grade | ( | $userid, | |
$courseid_or_ids = null ) |
Returns the aggregated or calculated course grade for a single user for one or more courses.
int | $userid | The ID of the single user |
int | array | $courseid_or_ids | Optional ID of course or array of IDs, empty means all of the user's courses |
mixed | grade info or grades array including item info, false if error |
grade_get_course_grades | ( | $courseid, | |
$userid_or_ids = null ) |
Functions used to retrieve grades objects.
int | $courseid | The ID of course |
int | array | $userid_or_ids | Optional ID of the graded user or array of user IDs; if userid not used, returns only information about grade_item |
stdClass | Returns an object containing information about course grade item. scaleid, name, grade and locked status etc and user course grades: $item->grades[$userid] => $usercoursegrade |
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.
stdClass | $grade | |
stdClass | $user |
int|null |
grade_get_gradable_activities | ( | $courseid, | |
$modulename = '' ) |
Returns an array of activities (defined as $cm objects) which are gradeable from gradebook, outcomes are ignored.
int | $courseid | If provided then restrict to one course. |
string | $modulename | If defined (could be 'forum', 'assignment' etc) then only that type are returned. |
array\$cm | objects |
grade_get_grade_items_for_activity | ( | $cm, | |
$only_main_item = false ) |
Returns all grade items (including outcomes) or main item for a given activity identified by $cm object.
cm_info | $cm | A course module object (preferably with modname property) |
bool | $only_main_item | Limit the search to the primary grade item for the activity, 'itemnumber'==0 |
mixed | An array of grade item instances, one grade item if $only_main_item == true, false if error or not found |
grade_get_grades | ( | $courseid, | |
$itemtype, | |||
$itemmodule, | |||
$iteminstance, | |||
$userid_or_ids = null ) |
Returns grading information for given activity, optionally with user grades.
Manual, course or category items can not be queried.
This function can be VERY costly - it is doing full course grades recalculation if needsupdate = 1 for course grade item. So be sure you really need it. If you need just certain grades consider using grade_item\refresh_grades() together with grade_item\get_grade() instead.
int | $courseid | ID of course |
string | $itemtype | Type of grade item. For example, 'mod' or 'block' |
string | $itemmodule | More specific then $itemtype. For example, 'forum' or 'quiz'. May be NULL for some item types |
int | $iteminstance | ID of the item module |
mixed | $userid_or_ids | Either a single user ID, an array of user IDs or null. If user ID or IDs are not supplied returns information about grade_item |
stdClass | Object with keys {items, outcomes, errors}, where 'items' is an array of grade information objects (scaleid, name, grade and locked status, etc.) indexed with itemnumbers |
grade_get_letters | ( | $context = null | ) |
Returns the array of grade letters to be used in the supplied context.
object | $context | Context object or null for defaults |
array | of grade_boundary (minimum) => letter_string |
grade_get_setting | ( | $courseid, | |
$name, | |||
$default = null, | |||
$resetcache = false ) |
Returns a course gradebook setting.
int | $courseid | |
string | $name | of setting, maybe null if reset only |
string | $default | value to return if setting is not found |
bool | $resetcache | force reset of internal static cache |
string | value of the setting, $default if setting not found, NULL if supplied $name is null |
grade_get_settings | ( | $courseid | ) |
Returns all course gradebook settings as object properties.
int | $courseid |
object |
grade_grab_course_grades | ( | $courseid, | |
$modname = null, | |||
$userid = 0 ) |
Refetches grade data from course activities.
int | $courseid | The course ID |
string | $modname | Limit the grade fetch to a single module type. For example 'forum' |
int | $userid | limit the grade fetch to a single user |
grade_is_user_graded_in_activity | ( | $cm, | |
$userid ) |
Returns whether or not a user received grades in main grade item for given activity.
cm_info | $cm | The activity context module |
int | $userid | The user ID |
bool | True if graded, false if user not graded yet |
grade_needs_regrade_final_grades | ( | $courseid | ) |
Return true if the course needs regrading.
int | $courseid | The course ID |
bool | true if course grades need updating. |
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.
int | $courseid | The course ID |
bool | Whether the regrade process is likely to be time consuming |
grade_recover_history_grades | ( | $userid, | |
$courseid ) |
Recover a user's grades from grade_grades_history.
int | $userid | the user ID whose grades we want to recover |
int | $courseid | the relevant course |
bool | true if successful or false if there was an error or no grades could be recovered |
grade_regrade_final_grades | ( | $courseid, | |
$userid = null, | |||
$updated_item = null, | |||
$progress = null ) |
Updates all final grades in course.
int | $courseid | The course ID |
int | $userid | If specified try to do a quick regrading of the grades of this user only |
object | $updated_item | Optional grade item to be marked for regrading. It is required if $userid is set. |
core\progress\base | $progress | If provided, will be used to update progress on this long operation. |
array|true | true if ok, array of errors if problems found. Grade item id => error message |
grade_regrade_final_grades_if_required | ( | $course, | |
callable | $callback = null ) |
Check whether regarding of final grades is required and, if so, perform the regrade.
If the regrade is expected to be time consuming (see grade_needs_regrade_progress_bar), then this function will output the progress bar, and redirect to the current PAGE->url after regrading completes. Otherwise the regrading will happen immediately and the page will be loaded as per normal.
A callback may be specified, which is called if regrading has taken place. The callback may optionally return a URL which will be redirected to when the progress bar is present.
stdClass | $course | The course to regrade |
callable | $callback | A function to call if regrading took place |
moodle_url | The URL to redirect to if redirecting |
grade_set_setting | ( | $courseid, | |
$name, | |||
$value ) |
Add, update or delete a course gradebook setting.
int | $courseid | The course ID |
string | $name | Name of the setting |
string | $value | Value of the setting. NULL means delete the setting. |
grade_uninstalled_module | ( | $modname | ) |
Does gradebook cleanup when a module is uninstalled Deletes all associated grade items.
string | $modname | The grade item module name to remove. For example 'forum' |
grade_update | ( | $source, | |
$courseid, | |||
$itemtype, | |||
$itemmodule, | |||
$iteminstance, | |||
$itemnumber, | |||
$grades = null, | |||
$itemdetails = null, | |||
$isbulkupdate = false ) |
Include essential files.
Submit new or update grade; update/create grade_item definition. Grade must have userid specified, rawgrade and feedback with format are optional. rawgrade NULL means 'Not graded'. Missing property or key means does not change the existing value.
Only following grade item properties can be changed 'itemname', 'idnumber', 'gradetype', 'grademax', 'grademin', 'scaleid', 'multfactor', 'plusfactor', 'deleted' and 'hidden'. 'reset' means delete all current grades including locked ones.
Manual, course or category items can not be updated by this function.
string | $source | Source of the grade such as 'mod/assignment' |
int | $courseid | ID of course |
string | $itemtype | Type of grade item. For example, mod or block |
string | $itemmodule | More specific then $itemtype. For example, assignment or forum. May be NULL for some item types |
int | $iteminstance | Instance ID of graded item |
int | $itemnumber | Most probably 0. Modules can use other numbers when having more than one grade for each user |
mixed | $grades | Grade (object, array) or several grades (arrays of arrays or objects), NULL if updating grade_item definition only |
mixed | $itemdetails | Object or array describing the grading item, NULL if no change |
bool | $isbulkupdate | If bulk grade update is happening. |
int | Returns GRADE_UPDATE_OK, GRADE_UPDATE_FAILED, GRADE_UPDATE_MULTIPLE or GRADE_UPDATE_ITEM_LOCKED |
grade_update_mod_grades | ( | $modinstance, | |
$userid = 0 ) |
Force full update of module grades in central gradebook.
object | $modinstance | Module object with extra cmidnumber and modname property |
int | $userid | Optional user ID if limiting the update to a single user |
bool | True if success |
grade_update_outcomes | ( | $source, | |
$courseid, | |||
$itemtype, | |||
$itemmodule, | |||
$iteminstance, | |||
$userid, | |||
$data ) |
Updates a user's outcomes.
Manual outcomes can not be updated.
string | $source | Source of the grade such as 'mod/assignment' |
int | $courseid | ID of course |
string | $itemtype | Type of grade item. For example, 'mod' or 'block' |
string | $itemmodule | More specific then $itemtype. For example, 'forum' or 'quiz'. May be NULL for some item types |
int | $iteminstance | Instance ID of graded item. For example the forum ID. |
int | $userid | ID of the graded user |
array | $data | Array consisting of grade item itemnumber (grade_update()) => outcomegrade |
bool | returns true if grade items were found and updated successfully |
grade_user_delete | ( | $userid | ) |
Deletes all of a user's grade data from gradebook.
int | $userid | The user whose grade data should be deleted |
grade_user_unenrol | ( | $courseid, | |
$userid ) |
Purge course data when user unenrolls from a course.
int | $courseid | The ID of the course the user has unenrolled from |
int | $userid | The ID of the user unenrolling |
grade_verify_idnumber | ( | $idnumber, | |
$courseid, | |||
$grade_item = null, | |||
$cm = null ) |
Verify new value of grade item idnumber.
Checks for uniqueness of new ID numbers. Old ID numbers are kept intact.
string | $idnumber | string (with magic quotes) |
int | $courseid | ID numbers are course unique only |
grade_item | $grade_item | The grade item this idnumber is associated with |
stdClass | $cm | used for course module idnumbers and items attached to modules |
bool | true means idnumber ok |
remove_course_grades | ( | $courseid, | |
$showfeedback ) |
Remove all grade related course data Grade history is kept.
int | $courseid | The course ID |
bool | $showfeedback | If true success notifications will be displayed |
remove_grade_letters | ( | $context, | |
$showfeedback ) |
Remove grade letters for given context.
context | $context | The context |
bool | $showfeedback | If true a success notification will be displayed |
const GRADE_AGGREGATE_WEIGHTED_MEAN 10 |
GRADE_AGGREGATE_WEIGHTED_MEAN - Use a weighted mean of grades in the category for grade aggregation.
Weights can be manually set.
const GRADE_DISPLAY_TYPE_DEFAULT 0 |
GRADE_DISPLAY_TYPE_DEFAULT - Grade display type can be set at 3 levels: grade_item, course setting and site.
Use the display type from the higher level.
const GRADE_DISPLAY_TYPE_LETTER 3 |
GRADE_DISPLAY_TYPE_LETTER - Display the grade as a letter grade.
For example, A, B, C, D or F.