mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +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'));
|
$this->ensure_isset(array('context', 'component'));
|
||||||
|
|
||||||
// example: if the given context+component lead to mod_assignment, this method
|
if ($this->get_context()->contextlevel == CONTEXT_SYSTEM) {
|
||||||
// will do something like
|
if ($this->get_component() !== 'core_grading') {
|
||||||
// require_once($CFG->dirroot.'/mod/assignment/lib.php');
|
throw new coding_exception('Unsupported component at the system context');
|
||||||
// return assignment_gradable_area_list();
|
} else {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
// todo - what to return for bank areas in the system context
|
} else if ($this->get_context()->contextlevel >= CONTEXT_COURSE) {
|
||||||
// todo - hardcoded list for now
|
list($context, $course, $cm) = get_context_info_array($this->get_context()->id);
|
||||||
return array('submission' => 'Submissions');
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3892,3 +3892,12 @@ function assignment_page_type_list($pagetype, $parentcontext, $currentcontext) {
|
||||||
);
|
);
|
||||||
return $module_pagetype;
|
return $module_pagetype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all gradable areas for the advanced grading methods gramework
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function assignment_grading_areas_list() {
|
||||||
|
return array('submission' => get_string('submissions', 'mod_assignment'));
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue