MDL-29479 List of available grading methods returned properly

This commit is contained in:
David Mudrak 2011-10-02 21:05:01 +02:00
parent f59f488a36
commit 6c9e506ca5

View File

@ -108,17 +108,25 @@ class grading_manager {
* controlled per-context.
*
* Requires the context property to be set in advance.
*
* @param bool $includenone should the 'Simple direct grading' be included
* @return array of the (string)name => (string)localized title of the method
*/
public function get_available_methods() {
public function get_available_methods($includenone = true) {
$this->ensure_isset(array('context'));
// todo - hardcoded list for now, should read the list of installed grading plugins
return array(
'' => get_string('gradingmethodnone', 'core_grading'),
'rubric' => 'Rubric',
);
if ($includenone) {
$list = array('' => get_string('gradingmethodnone', 'core_grading'));
} else {
$list = array();
}
foreach (get_plugin_list('gradingform') as $name => $location) {
$list[$name] = get_string('pluginname', 'gradingform_'.$name);
}
return $list;
}
/**