Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Files | |
file | advancedgrading_mapping.php |
Grade item, itemnumber mapping. | |
file | behat_grade.php |
Behat grade related steps definitions. | |
file | calculation_form.php |
A moodleform to allow the editing of a calculated grade item. | |
file | category_form.php |
A moodleform to edit the grade options for an individual grade category. | |
file | component_gradeitem.php |
Compontent definition of a gradeitem. | |
file | component_gradeitems.php |
Helper class to fetch information about component grade items. | |
file | constants.php |
Definitions of constants for gradebook. | |
file | coverage.php |
Coverage information for the grades component. | |
file | edit_form.php |
A moodleform for editing grade letters. | |
file | edit_form.php |
Edit form for grade outcomes. | |
file | edit_form.php |
Edit form for grade scales. | |
file | fetch.php |
Web service functions relating to point grades and grading. | |
file | fetch.php |
Web service functions relating to scale grades and grading. | |
file | form.php |
A form for editing course grade settings. | |
file | grade_category.php |
Definition of a class to represent a grade category. | |
file | grade_form.php |
A moodleform to allow the editing of a user's grade for a particular activity. | |
file | grade_grade.php |
Definition of a class to represent an individual user's grade. | |
file | grade_item.php |
Definition of a class to represent a grade item. | |
file | grade_object.php |
Definition of a grade object class for grade item, grade category etc to inherit from. | |
file | grade_outcome.php |
Definition of grade outcome class. | |
file | grade_scale.php |
Definition of grade scale class. | |
file | gradelib.php |
Library of functions for gradebook - both public and internal. | |
file | grades_external.php |
Core grades external functions. | |
file | import_outcomes_form.php |
A form to allow importing outcomes from a file. | |
file | item_form.php |
A moodleform allowing the editing of the grade options for an individual grade item. | |
file | itemnumber_mapping.php |
Grade item, itemnumber mapping. | |
file | lib.php |
A library of classes used by the grade edit pages. | |
file | lib.php |
Functions used by gradebook plugins and reports. | |
file | lib.php |
File containing the grade_report class. | |
file | outcomeitem_form.php |
A moodleform to allow the creation and editing of outcome grade items. | |
file | querylib.php |
Functions used to retrieve grades objects. | |
file | store.php |
Web service functions relating to point grades and grading. | |
file | store.php |
Web service functions relating to scale grades and grading. | |
file | tabs.php |
Prints navigation tabs for viewing and editing grade letters. | |
file | tabs.php |
Prints navigation tabs for viewing and editing grade outcomes. | |
Namespaces | |
namespace | core_grades |
| |
namespace | core_grades\grades\grader\gradingpanel\point\external |
| |
namespace | core_grades\grades\grader\gradingpanel\scale\external |
| |
namespace | core_grades\local\gradeitem |
| |
namespace | core_grades\privacy |
| |
Classes | |
class | behat_grade |
class | core_grades\component_gradeitem |
Compontent definition of a gradeitem. More... | |
class | core_grades\component_gradeitems |
Helper class to fetch information about component grade items. More... | |
class | core_grades\grades\grader\gradingpanel\point\external\fetch |
External grading panel point API. More... | |
class | core_grades\grades\grader\gradingpanel\point\external\store |
External grading panel point API. More... | |
class | core_grades\grades\grader\gradingpanel\scale\external\fetch |
External grading panel scale API. More... | |
class | core_grades\grades\grader\gradingpanel\scale\external\store |
External grading panel scale API. More... | |
interface | core_grades\local\gradeitem\advancedgrading_mapping |
Grade item, itemnumber mapping. More... | |
interface | core_grades\local\gradeitem\itemnumber_mapping |
Grade item, itemnumber mapping. More... | |
class | core_grades\privacy\provider |
Data provider class. More... | |
class | core_grades_external |
core grades functions More... | |
class | course_settings_form |
First implementation of the preferences in the form of a moodleform. More... | |
class | edit_calculation_form |
class | edit_category_form |
class | edit_grade_form |
class | edit_item_form |
class | edit_letter_form |
class | edit_outcome_form |
class | edit_outcomeitem_form |
class | edit_scale_form |
class | grade_category |
class | grade_edit_tree |
class | grade_edit_tree_column |
Class grade_edit_tree_column. More... | |
class | grade_edit_tree_column_actions |
Class grade_edit_tree_column_actions. More... | |
class | grade_edit_tree_column_name |
Class grade_edit_tree_column_name. More... | |
class | grade_edit_tree_column_range |
Class grade_edit_tree_column_range. More... | |
class | grade_edit_tree_column_select |
Class grade_edit_tree_column_select. More... | |
class | grade_edit_tree_column_weight |
Class grade_edit_tree_column_weight. More... | |
class | grade_grade |
class | grade_helper |
Grade helper class. More... | |
class | grade_item |
class | grade_object |
class | grade_outcome |
class | grade_plugin_info |
A simple class containing info about grade plugins. More... | |
class | grade_plugin_return |
Utility class used for return tracking when using edit and other forms in grade plugins. More... | |
class | grade_report |
An abstract class containing variables and methods used by all or most reports. More... | |
class | grade_scale |
class | grade_seq |
Flat structure similar to grade tree. More... | |
class | grade_structure |
General structure representing grade items in course. More... | |
class | grade_tree |
This class represents a complete tree of categories, grade_items and final grades, organises as an array primarily, but which can also be converted to other formats. More... | |
class | graded_users_iterator |
This class iterates over all users that are graded in a course. More... | |
class | import_outcomes_form |
class | phpunit_coverage_info |
Coverage information for the tool_dataprivacy plugin. More... | |
Functions | |
grade_build_nav ($path, $pagename=null, $id=null) | |
Function central to gradebook for building and printing the navigation (breadcrumb trail). More... | |
grade_button ($type, $courseid, $object) | |
Local shortcut function for creating an edit/delete button for a grade_* object. More... | |
grade_course_category_delete ($categoryid, $newparentid, $showfeedback) | |
Called when course category is deleted Cleans the gradebook of associated data. More... | |
grade_course_reset ($courseid) | |
Reset all course grades, refetch from the activities and recalculate. More... | |
moodle_page | grade_extend_settings ($plugininfo, $courseid) |
This method adds settings to the settings block for the grade system and its plugins. More... | |
grade_floats_different ($f1, $f2) | |
Compare two float numbers safely. More... | |
grade_floats_equal ($f1, $f2) | |
Compare two float numbers safely. More... | |
grade_floatval ($number) | |
Convert a number to 5 decimal point float, an empty string or a null db compatible format (we need this to decide if db value changed) More... | |
grade_force_full_regrading ($courseid) | |
Force final grade recalculation in all course items. More... | |
grade_force_site_regrading () | |
Forces regrading of all site grades. More... | |
grade_format_gradevalue ($value, &$grade_item, $localized=true, $displaytype=null, $decimals=null) | |
Returns string representation of grade value. More... | |
grade_format_gradevalue_letter ($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. More... | |
grade_format_gradevalue_percentage ($value, $grade_item, $decimals, $localized) | |
Returns a percentage representation of a grade value. More... | |
grade_format_gradevalue_real ($value, $grade_item, $decimals, $localized) | |
Returns a float representation of a grade value. More... | |
grade_get_categories_menu ($courseid, $includenew=false) | |
Returns grade options for gradebook grade category menu. More... | |
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. More... | |
grade_get_course_grades ($courseid, $userid_or_ids=null) | |
Returns the aggregated or calculated course grade(s) for a single course for one or more users. More... | |
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. More... | |
grade_get_gradable_activities ($courseid, $modulename='') | |
Returns an array of activities (defined as $cm objects) which are gradeable from gradebook, outcomes are ignored. More... | |
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. More... | |
grade_get_graded_users_select ($report, $course, $userid, $groupid, $includeall) | |
grade_get_grades ($courseid, $itemtype, $itemmodule, $iteminstance, $userid_or_ids=null) | |
grade_get_letters ($context=null) | |
Returns the array of grade letters to be used in the supplied context. More... | |
grade_get_plugin_info ($courseid, $active_type, $active_plugin) | |
grade_get_plugin_info More... | |
grade_get_setting ($courseid, $name, $default=null, $resetcache=false) | |
Returns a course gradebook setting. More... | |
grade_get_settings ($courseid) | |
Returns all course gradebook settings as object properties. More... | |
grade_grab_course_grades ($courseid, $modname=null, $userid=0) | |
Refetches grade data from course activities. More... | |
grade_hide_min_max_grade_upgrade_notice ($courseid) | |
Hide warning about changed grades during upgrade from 2.8.0-2.8.6 and 2.9.0. More... | |
grade_is_user_graded_in_activity ($cm, $userid) | |
Returns whether or not a user received grades in main grade item for given activity. More... | |
grade_needs_regrade_final_grades ($courseid) | |
Return true if the course needs regrading. More... | |
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. More... | |
grade_print_tabs ($active_type, $active_plugin, $plugin_info, $return=false) | |
Print grading plugin selection tab-based navigation. More... | |
grade_recover_history_grades ($userid, $courseid) | |
Recover a user's grades from grade_grades_history. More... | |
grade_regrade_final_grades ($courseid, $userid=null, $updated_item=null, $progress=null) | |
Updates all final grades in course. More... | |
grade_regrade_final_grades_if_required ($course, callable $callback=null) | |
Check whether regarding of final grades is required and, if so, perform the regrade. More... | |
grade_set_setting ($courseid, $name, $value) | |
Add, update or delete a course gradebook setting. More... | |
grade_uninstalled_module ($modname) | |
Does gradebook cleanup when a module is uninstalled Deletes all associated grade items. More... | |
grade_update ($source, $courseid, $itemtype, $itemmodule, $iteminstance, $itemnumber, $grades=NULL, $itemdetails=NULL) | |
grade_update_mod_grades ($modinstance, $userid=0) | |
Force full update of module grades in central gradebook. More... | |
grade_update_outcomes ($source, $courseid, $itemtype, $itemmodule, $iteminstance, $userid, $data) | |
grade_upgrade_use_min_max_from_grade_grade ($courseid) | |
Use the grade min and max from the grade_grade. More... | |
grade_upgrade_use_min_max_from_grade_item ($courseid) | |
Use the grade min and max from the grade_item. More... | |
grade_user_delete ($userid) | |
Deletes all of a user's grade data from gradebook. More... | |
grade_user_unenrol ($courseid, $userid) | |
Purge course data when user unenrolls from a course. More... | |
grade_verify_idnumber ($idnumber, $courseid, $grade_item=null, $cm=null) | |
Verify new value of grade item idnumber. More... | |
hide_aggregatesubcats_upgrade_notice ($courseid) | |
Hide warning about changed grades during upgrade to 2.8. More... | |
hide_gradebook_calculations_freeze_notice ($courseid) | |
Hide warning about changed grades due to bug fixes. More... | |
hide_natural_aggregation_upgrade_notice ($courseid) | |
Hide warning about changed grades during upgrade to 2.8. More... | |
print_grade_page_head ($courseid, $active_type, $active_plugin=null, $heading=false, $return=false, $buttons=false, $shownavigation=true, $headerhelpidentifier=null, $headerhelpcomponent=null, $user=null) | |
Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and (optional) navigation tabs for any gradebook page. More... | |
print_grade_plugin_selector ($plugin_info, $active_type, $active_plugin, $return=false) | |
Print grading plugin selection popup form. More... | |
print_graded_users_selector ($course, $actionpage, $userid=0, $groupid=0, $includeall=true, $return=false) | |
Print a selection popup form of the graded users in a course. More... | |
print_natural_aggregation_upgrade_notice ($courseid, $context, $thispage, $return=false) | |
Print warning about changed grades during upgrade to 2.8. More... | |
remove_course_grades ($courseid, $showfeedback) | |
Remove all grade related course data Grade history is kept. More... | |
remove_grade_letters ($context, $showfeedback) | |
Remove grade letters for given context. More... | |
Variables | |
global | $CFG |
$context = context_course::instance($courseid) | |
$row = $tabs = array() | |
$row [] | |
$row = $tabs = array() | |
$row [] | |
if(has_capability('moodle/grade:manageletters', $context)) | $tabs [] = $row |
if(has_capability('moodle/grade:manage', $context)) | $tabs [] = $row |
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_WEIGHTED_MEAN2 - 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. More... | |
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. More... | |
const | GRADE_DISPLAY_TYPE_LETTER 3 |
GRADE_DISPLAY_TYPE_LETTER - Display the grade as a letter grade. More... | |
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_NAVMETHOD_COMBO 2 |
GRADE_NAVMETHOD_TABS - Display both a drop down and tabs to allow navigation within the gradebook. | |
const | GRADE_NAVMETHOD_DROPDOWN 0 |
GRADE_NAVMETHOD_DROPDOWN - Display a drop down box to allow navigation within the gradebook. | |
const | GRADE_NAVMETHOD_TABS 1 |
GRADE_NAVMETHOD_TABS - Display tabs to allow navigation within the gradebook. | |
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. | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
grade_build_nav | ( | $path, | |
$pagename = null , |
|||
$id = null |
|||
) |
Function central to gradebook for building and printing the navigation (breadcrumb trail).
string | $path | The path of the calling script (using FILE?) |
string | $pagename | The language string to use as the last part of the navigation (non-link) |
mixed | $id | Either a plain integer (assuming the key is 'id') or an array of keys and values (e.g courseid => $courseid, itemid...) |
string |
grade_button | ( | $type, | |
$courseid, | |||
$object | |||
) |
Local shortcut function for creating an edit/delete button for a grade_* object.
string | $type | 'edit' or 'delete' |
int | $courseid | The Course ID |
grade_* | $object The grade_* object |
string | html |
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 |
moodle_page grade_extend_settings | ( | $plugininfo, | |
$courseid | |||
) |
This method adds settings to the settings block for the grade system and its plugins.
$PAGE
grade_floats_different | ( | $f1, | |
$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 | $f1 | Float one to compare |
float | $f2 | Float two to compare |
bool | True if the supplied values are different |
grade_floats_equal | ( | $f1, | |
$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 | $f1 | Float one to compare |
float | $f2 | Float two to compare |
bool | True if the values should be considered as the same grades |
grade_floatval | ( | $number | ) |
Convert a number to 5 decimal point float, an empty string or a null db compatible format (we need this to decide if db value changed)
mixed | $number | The number to convert |
mixed | 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 | ( | $value, | |
& | $grade_item, | ||
$localized = true , |
|||
$displaytype = null , |
|||
$decimals = null |
|||
) |
Returns string representation of grade value.
float | $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 | ( | $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 | $value | The grade value |
object | $grade_item | Grade item object |
string |
grade_format_gradevalue_percentage | ( | $value, | |
$grade_item, | |||
$decimals, | |||
$localized | |||
) |
Returns a percentage representation of a grade value.
float | $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 | ( | $value, | |
$grade_item, | |||
$decimals, | |||
$localized | |||
) |
Returns a float representation of a grade value.
float | $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 |
|||
) |
Returns the aggregated or calculated course grade(s) for a single course for one or more users.
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_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_plugin_info | ( | $courseid, | |
$active_type, | |||
$active_plugin | |||
) |
grade_get_plugin_info
int | $courseid | The course id |
string | $active_type | type of plugin on current page - import, export, report or edit |
string | $active_plugin | active plugin type - grader, user, cvs, ... |
array |
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_hide_min_max_grade_upgrade_notice | ( | $courseid | ) |
Hide warning about changed grades during upgrade from 2.8.0-2.8.6 and 2.9.0.
int | $courseid | The current course id. |
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_print_tabs | ( | $active_type, | |
$active_plugin, | |||
$plugin_info, | |||
$return = false |
|||
) |
Print grading plugin selection tab-based navigation.
string | $active_type | type of plugin on current page - import, export, report or edit |
string | $active_plugin | active plugin type - grader, user, cvs, ... |
array | $plugin_info | Array of plugins |
boolean | $return | return as string |
nothing | or string if $return true |
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. |
bool | 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_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_upgrade_use_min_max_from_grade_grade | ( | $courseid | ) |
Use the grade min and max from the grade_grade.
This is reserved for core use after an upgrade.
int | $courseid | The current course id. |
grade_upgrade_use_min_max_from_grade_item | ( | $courseid | ) |
Use the grade min and max from the grade_item.
This is reserved for core use after an upgrade.
int | $courseid | The current course id. |
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 |
hide_aggregatesubcats_upgrade_notice | ( | $courseid | ) |
Hide warning about changed grades during upgrade to 2.8.
int | $courseid | The current course id. |
hide_gradebook_calculations_freeze_notice | ( | $courseid | ) |
Hide warning about changed grades due to bug fixes.
int | $courseid | The current course id. |
hide_natural_aggregation_upgrade_notice | ( | $courseid | ) |
Hide warning about changed grades during upgrade to 2.8.
int | $courseid | The current course id. |
print_grade_page_head | ( | $courseid, | |
$active_type, | |||
$active_plugin = null , |
|||
$heading = false , |
|||
$return = false , |
|||
$buttons = false , |
|||
$shownavigation = true , |
|||
$headerhelpidentifier = null , |
|||
$headerhelpcomponent = null , |
|||
$user = null |
|||
) |
Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and (optional) navigation tabs for any gradebook page.
All gradebook pages MUST use these functions in favour of the usual print_header(), print_header_simple(), print_heading() etc. !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
int | $courseid | Course id |
string | $active_type | The type of the current page (report, settings, import, export, scales, outcomes, letters) |
string | $active_plugin | The plugin of the current page (grader, fullview etc...) |
string | $heading | The heading of the page. Tries to guess if none is given |
boolean | $return | Whether to return (true) or echo (false) the HTML generated by this function |
string | $bodytags | Additional attributes that will be added to the <body> tag |
string | $buttons | Additional buttons to display on the page |
boolean | $shownavigation | should the gradebook navigation drop down (or tabs) be shown? |
string | $headerhelpidentifier | The help string identifier if required. |
string | $headerhelpcomponent | The component for the help string. |
stdClass | $user | The user object for use with the user context header. |
string | HTML code or nothing if $return == false |
print_grade_plugin_selector | ( | $plugin_info, | |
$active_type, | |||
$active_plugin, | |||
$return = false |
|||
) |
Print grading plugin selection popup form.
array | $plugin_info | An array of plugins containing information for the selector |
boolean | $return | return as string |
nothing | or string if $return true |
print_graded_users_selector | ( | $course, | |
$actionpage, | |||
$userid = 0 , |
|||
$groupid = 0 , |
|||
$includeall = true , |
|||
$return = false |
|||
) |
Print a selection popup form of the graded users in a course.
int | $course | id of the course |
string | $actionpage | The page receiving the data from the popoup form |
int | $userid | id of the currently selected user (or 'all' if they are all selected) |
int | $groupid | id of requested group, 0 means all |
int | $includeall | bool include all option |
bool | $return | If true, will return the HTML, otherwise, will print directly |
null |
print_natural_aggregation_upgrade_notice | ( | $courseid, | |
$context, | |||
$thispage, | |||
$return = false |
|||
) |
Print warning about changed grades during upgrade to 2.8.
int | $courseid | The current course id. |
context | $context | The course context. |
string | $thispage | The relative path for the current page. E.g. /grade/report/user/index.php |
boolean | $return | return as string |
nothing | or string if $return true |
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 |
$row[] |
$row[] |
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.