Details
Description
http://docs.moodle.org/en/Development:Grades#Core_API_functions
grade_get_items()
eg grade_get_items($courseid, $itemname=NULL, $itemtype=NULL, $itemmodule=NULL, $iteminstance=NULL, $itemnumber=NULL, $idnumber=NULL)
For extracting all the information about what grading items are attached to something. For example, an assignment may want to retrieve all the grade_items for itself, and get three outcome scales in return. This will affect the grading interface.
grade_create_item()
To create a new grade_item in case it doesn't exist. This function would be called when a module is created or updated, for example, to ensure grade_item entries exist. It's not essential though - if grades are being added later and a matching grade_item doesn't exist yet, the gradebook will create them on the fly.
grade_create_category()
eg grade_create_category(fullname, array of items, aggregation, etc ...) For a given set of items, create a category to group them together (if one doesn't exist yet). Modules may want to do this when they are created. However, the ultimate control is in the gradebook interface itself.
grade_is_locked($itemtype, $itemmodule, $itemteminstance, $userid=NULL)
This function will tell a module whether a grade (or grade_item if $userid is not given) is currently locked or not. This is a combination of the actual settings in the grade tables and a check on moodle/course:editgradeswhenlocked. If it's locked to the current use then the module can print a nice message or prevent editing in the module.
Things left to do:
1. Outcomes:
a. Implement grade_outcome object
b. Implement support methods in grade_item
c. write unit tests
2. Grade history
a. Implement API to view history
b. Methods to extract data from history
c. Methods to export/import
3. Multiple grades
a. Relate grade_items that are part of a multiple grade set together
b. Automatically aggregate multiple grade_items under a category
4. Text grade type
a. Handle calculations, aggregation and adjustments of grades set to text type
5. Hierarchical Locking and Hiding
6. Category keephigh and droplow
7. Grade text: methods for adding and editing grade_text easily
8. Grade pass: method for querying whether a particular student passes a given grade_item
9. Use grade_item.sortorder in queries
10. Grade_category::get_children: easy way to access a category's children to a requested depth (or all children) in hierarchical or flat array format.
11. Grade category aggregation
12. Calculation formula parser