From 8f2fab88b905bfc526df1ac7458e0811ad07fcc0 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Mon, 6 Jul 2009 06:56:25 +0000 Subject: [PATCH] MDL-16438 Fixed parsing of get_plugins_list for grader reports. --- grade/report/index.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/grade/report/index.php b/grade/report/index.php index e50c3c4b4a..25415512ac 100644 --- a/grade/report/index.php +++ b/grade/report/index.php @@ -35,7 +35,6 @@ $context = get_context_instance(CONTEXT_COURSE, $course->id); /// find all accessible reports $reports = get_plugin_list('gradereport'); // Get all installed reports -$reports = array_keys($reports); foreach ($reports as $plugin => $plugindir) { // Remove ones we can't see if (!has_capability('gradereport/'.$plugin.':view', $context)) { @@ -57,19 +56,19 @@ if (!empty($USER->grade_last_report[$course->id])) { $last = null; } -if (!in_array($last, $reports)) { +if (!array_key_exists($last, $reports)) { $last = null; } if (empty($last)) { - if (in_array('grader', $reports)) { + if (array_key_exists('grader', $reports)) { $last = 'grader'; - } else if (in_array('user', $reports)) { + } else if (array_key_exists('user', $reports)) { $last = 'user'; } else { - $last = reset($reports); + $last = key(reset($reports)); } } -- 2.39.5