From 6c9e506ca5ac8e512a03a80251df6d6c170db927 Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Sun, 2 Oct 2011 21:05:01 +0200 Subject: [PATCH] MDL-29479 List of available grading methods returned properly --- grade/grading/lib.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/grade/grading/lib.php b/grade/grading/lib.php index ea30425f501..96d3a48d129 100644 --- a/grade/grading/lib.php +++ b/grade/grading/lib.php @@ -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; } /**