| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Source view] [Print] [Project Stats]
Library of functions for gradebook - both public and internal
| Author: | Moodle HQ developers |
| License: | http://www.gnu.org/copyleft/gpl.html GNU Public License |
| Version: | $Id: gradelib.php,v 1.120.2.26 2008/05/13 21:51:47 skodak Exp $ |
| File Size: | 1360 lines (49 kb) |
| Included or required: | 0 times |
| Referenced: | 1 time |
| Includes or requires: | 0 files |
| grade_update($source, $courseid, $itemtype, $itemmodule, $iteminstance, $itemnumber, $grades=NULL, $itemdetails=NULL) X-Ref |
| 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 do not change existing. 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. param: string $source source of the grade such as 'mod/assignment' param: int $courseid id of course param: string $itemtype type of grade item - mod, block param: string $itemmodule more specific then $itemtype - assignment, forum, etc.; maybe NULL for some item types param: int $iteminstance instance it of graded subject param: int $itemnumber most probably 0, modules can use other numbers when having more than one grades for each user param: mixed $grades grade (object, array) or several grades (arrays of arrays or objects), NULL if updating grade_item definition only param: mixed $itemdetails object or array describing the grading item, NULL if no change |
| grade_update_outcomes($source, $courseid, $itemtype, $itemmodule, $iteminstance, $userid, $data) X-Ref |
| Updates outcomes of user Manual outcomes can not be updated. param: string $source source of the grade such as 'mod/assignment' param: int $courseid id of course param: string $itemtype 'mod', 'block' param: string $itemmodule 'forum, 'quiz', etc. param: int $iteminstance id of the item module param: int $userid ID of the graded user param: array $data array itemnumber=>outcomegrade |
| grade_get_grades($courseid, $itemtype, $itemmodule, $iteminstance, $userid_or_ids=null) X-Ref |
| Returns grading information for given activity - optionally with users grades Manual, course or category items can not be queried. param: int $courseid id of course param: string $itemtype 'mod', 'block' param: string $itemmodule 'forum, 'quiz', etc. param: int $iteminstance id of the item module param: int $userid_or_ids optional id of the graded user or array of ids; if userid not used, returns only information about grade_item return: array of grade information objects (scaleid, name, grade and locked status, etc.) indexed with itemnumbers |
| grade_get_setting($courseid, $name, $default=null, $resetcache=false) X-Ref |
| Returns course gradebook setting param: int $courseid param: string $name of setting, maybe null if reset only param: bool $resetcache force reset of internal static cache return: string value, NULL if no setting |
| grade_get_settings($courseid) X-Ref |
| Returns all course gradebook settings as object properties param: int $courseid return: object |
| grade_set_setting($courseid, $name, $value) X-Ref |
| Add/update course gradebook setting param: int $courseid param: string $name of setting param: string value, NULL means no setting==remove return: void |
| grade_format_gradevalue($value, &$grade_item, $localized=true, $displaytype=null, $decimals=null) X-Ref |
| Returns string representation of grade value param: float $value grade value param: object $grade_item - by reference to prevent scale reloading param: bool $localized use localised decimal separator param: int $displaytype type of display - GRADE_DISPLAY_TYPE_REAL, GRADE_DISPLAY_TYPE_PERCENTAGE, GRADE_DISPLAY_TYPE_LETTER param: int $decimalplaces number of decimal places when displaying float values return: string |
| grade_get_categories_menu($courseid, $includenew=false) X-Ref |
| Returns grade options for gradebook category menu param: int $courseid param: bool $includenew include option for new category (-1) return: array of grade categories in course |
| grade_get_letters($context=null) X-Ref |
| Returns grade letters array used in context param: object $context object or null for defaults return: array of grade_boundary=>letter_string |
| grade_verify_idnumber($idnumber, $courseid, $grade_item=null, $cm=null) X-Ref |
| Verify new value of idnumber - checks for uniqueness of new idnumbers, old are kept intact param: string idnumber string (with magic quotes) param: int $courseid - id numbers are course unique only param: object $cm used for course module idnumbers and items attached to modules param: object $gradeitem is item idnumber return: boolean true means idnumber ok |
| grade_force_full_regrading($courseid) X-Ref |
| Force final grade recalculation in all course items param: int $courseid |
| grade_regrade_final_grades($courseid, $userid=null, $updated_item=null) X-Ref |
| Updates all final grades in course. param: int $courseid param: int $userid if specified, try to do a quick regrading of grades of this user only param: object $updated_item the item in which return: boolean true if ok, array of errors if problems found (item id is used as key) |
| grade_grab_legacy_grades($courseid) X-Ref |
| For backwards compatibility with old third-party modules, this function can be used to import all grades from activities with legacy grading. param: int $courseid |
| grade_grab_course_grades($courseid, $modname=null) X-Ref |
| Refetches data from all course activities param: int $courseid param: string $modname return: success |
| grade_update_mod_grades($modinstance, $userid=0) X-Ref |
| Force full update of module grades in central gradebook - works for both legacy and converted activities. param: object $modinstance object with extra cmidnumber and modname property return: boolean success |
| grade_get_legacy_grade_item($modinstance, $grademax, $scaleid) X-Ref |
| Get and update/create grade item for legacy modules. |
| remove_grade_letters($context, $showfeedback) X-Ref |
| Remove grade letters for given context param: object $context |
| remove_course_grades($courseid, $showfeedback) X-Ref |
| Remove all grade related course data - history is kept param: int $courseid param: bool $showfeedback print feedback |
| grade_course_category_delete($categoryid, $newparentid, $showfeedback) X-Ref |
| Called when course category deleted - cleanup gradebook param: int $categoryid course category id param: int $newparentid empty means everything deleted, otherwise id of category where content moved param: bool $showfeedback print feedback |
| grade_uninstalled_module($modname) X-Ref |
| Does gradebook cleanup when module uninstalled. |
| grade_cron() X-Ref |
| Grading cron job |
| grade_course_reset($courseid) X-Ref |
| Resel all course grades param: int $courseid return: success |
| grade_floatval($number) X-Ref |
| Convert number to 5 decimalfloat, empty tring or null db compatible format (we need this to decide if db value changed) param: mixed number return: mixed float or null |
| grade_floats_different($f1, $f2) X-Ref |
| Compare two float numbers safely. Uses 5 decimals php precision. Nulls accepted too. Used for skipping of db updates param: float $f1 param: float $f2 return: true if different |
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |