From 2ea3fc3603687bc2e3102c04f8509e8a045107f5 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 6 Jul 2012 14:34:33 +0200 Subject: [PATCH] Fixes bug: "Class 'Testcategory' not found" see #5130 --- main/exercice/export/scorm/scorm_classes.php | 29 ++++++++++---------- main/exercice/export/scorm/scorm_export.php | 4 +-- main/newscorm/learnpath.class.php | 2 +- main/newscorm/learnpath_functions.inc.php | 6 ++-- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/main/exercice/export/scorm/scorm_classes.php b/main/exercice/export/scorm/scorm_classes.php index 551d8dabf7..4a8209f97d 100644 --- a/main/exercice/export/scorm/scorm_classes.php +++ b/main/exercice/export/scorm/scorm_classes.php @@ -1,4 +1,4 @@ - @@ -9,17 +9,19 @@ * Code */ if ( count( get_included_files() ) == 1 ) die( '---' ); -require_once(api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php'); -require_once(api_get_path(SYS_CODE_PATH).'exercice/question.class.php'); -require_once(api_get_path(SYS_CODE_PATH).'exercice/answer.class.php'); -require_once(api_get_path(SYS_CODE_PATH).'exercice/unique_answer.class.php'); -require_once(api_get_path(SYS_CODE_PATH).'exercice/multiple_answer.class.php'); -require_once(api_get_path(SYS_CODE_PATH).'exercice/multiple_answer_combination.class.php'); -require_once(api_get_path(SYS_CODE_PATH).'exercice/fill_blanks.class.php'); -require_once(api_get_path(SYS_CODE_PATH).'exercice/freeanswer.class.php'); -require_once(api_get_path(SYS_CODE_PATH).'exercice/hotspot.class.php'); -require_once(api_get_path(SYS_CODE_PATH).'exercice/matching.class.php'); -require_once(api_get_path(SYS_CODE_PATH).'exercice/hotspot.class.php'); + +require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/testcategory.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/question.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/answer.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/unique_answer.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/multiple_answer.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/multiple_answer_combination.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/fill_blanks.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/freeanswer.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/hotspot.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/matching.class.php'; +require_once api_get_path(SYS_CODE_PATH).'exercice/hotspot.class.php'; // answer types define('UNIQUE_ANSWER', 1); @@ -785,5 +787,4 @@ class ScormAnswerHotspot extends Answer $html = ''.get_lang('ThisItemIsNotExportable').''; return array($js,$html); } -} -?> +} \ No newline at end of file diff --git a/main/exercice/export/scorm/scorm_export.php b/main/exercice/export/scorm/scorm_export.php index ae387f03d8..d82a9a06b6 100644 --- a/main/exercice/export/scorm/scorm_export.php +++ b/main/exercice/export/scorm/scorm_export.php @@ -10,9 +10,7 @@ if ( count( get_included_files() ) == 1 ) die( '---' ); require dirname(__FILE__) . '/scorm_classes.php'; -/*-------------------------------------------------------- - Classes - --------------------------------------------------------*/ +/* Classes */ // answer types define(UNIQUE_ANSWER, 1); define(MULTIPLE_ANSWER, 2); diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 861fa7fddf..239ebb5712 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -8520,7 +8520,7 @@ class learnpath { $my_file_path = 'quiz_'.$item->get_id().'.html'; // Write the contents of the exported exercise into a (big) html file // to later pack it into the exported SCORM. The file will be removed afterwards. - $contents = export_exercise($exe_id,true); + $contents = export_exercise($exe_id, true); $tmp_file_path = $archive_path.$temp_dir_short.'/'.$my_file_path; $res = file_put_contents($tmp_file_path, $contents); if ($res === false) { error_log('Could not write into file '.$tmp_file_path.' '.__FILE__.' '.__LINE__, 0); } diff --git a/main/newscorm/learnpath_functions.inc.php b/main/newscorm/learnpath_functions.inc.php index 11a66f7737..344609453c 100644 --- a/main/newscorm/learnpath_functions.inc.php +++ b/main/newscorm/learnpath_functions.inc.php @@ -1142,11 +1142,13 @@ function export_exercise($item_id) { global $expdir, $_course, $_configuration, $_SESSION, $_SERVER, $language_interface, $langExerciseNotFound, $langQuestion, $langOk, $origin, $questionNum; $exerciseId = $item_id; - - require_once '../exercice/exercise.class.php'; + + require_once '../exercice/testcategory.class.php'; + require_once '../exercice/exercise.class.php'; require_once '../exercice/question.class.php'; require_once '../exercice/answer.class.php'; require_once '../exercice/exercise.lib.php'; + // Answer types define('UNIQUE_ANSWER', 1);