From 7453df700fd92b92b490a5d1bf4cdc7592726000 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 12 May 2008 17:29:56 +0000 Subject: [PATCH] MDL-14804 - question_list_instances is broken - It does not include the each modules lib file before doing function_exists($module->name.'_question_list_instances'). --- lib/questionlib.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/questionlib.php b/lib/questionlib.php index 22cb029d3d..bcd0f5829c 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -249,18 +249,22 @@ class cmoptions { * @return array of strings */ function question_list_instances($questionid) { + global $CFG; $instances = array(); $modules = get_records('modules'); foreach ($modules as $module) { - $fn = $module->name.'_question_list_instances'; - if (function_exists($fn)) { - $instances = $instances + $fn($questionid); + $fullmod = $CFG->dirroot . '/mod/' . $module->name; + if (file_exists($fullmod . '/lib.php')) { + include_once($fullmod . '/lib.php'); + $fn = $module->name.'_question_list_instances'; + if (function_exists($fn)) { + $instances = $instances + $fn($questionid); + } } } return $instances; } - /** * Returns list of 'allowed' grades for grade selection * formatted suitably for dropdown box function -- 2.39.5