mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-29483 The list of gradable areas is now obtained from the module
At the moment, only activity modules are supported.
This commit is contained in:
parent
967d346f72
commit
9e4eb676e4
2 changed files with 27 additions and 7 deletions
|
@ -260,14 +260,25 @@ class grading_manager {
|
|||
|
||||
$this->ensure_isset(array('context', 'component'));
|
||||
|
||||
// example: if the given context+component lead to mod_assignment, this method
|
||||
// will do something like
|
||||
// require_once($CFG->dirroot.'/mod/assignment/lib.php');
|
||||
// return assignment_gradable_area_list();
|
||||
if ($this->get_context()->contextlevel == CONTEXT_SYSTEM) {
|
||||
if ($this->get_component() !== 'core_grading') {
|
||||
throw new coding_exception('Unsupported component at the system context');
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
|
||||
// todo - what to return for bank areas in the system context
|
||||
// todo - hardcoded list for now
|
||||
return array('submission' => 'Submissions');
|
||||
} else if ($this->get_context()->contextlevel >= CONTEXT_COURSE) {
|
||||
list($context, $course, $cm) = get_context_info_array($this->get_context()->id);
|
||||
|
||||
if (empty($cm->modname)) {
|
||||
throw new coding_exception('Unsupported area location');
|
||||
} else {
|
||||
return plugin_callback('mod', $cm->modname, 'grading', 'areas_list', null, array());
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new coding_exception('Unsupported gradable area context level');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue