From ba818ee23e39cf37f4c79c7aedd10b7f5a39262f Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 10 Jun 2016 17:09:04 -0500 Subject: [PATCH] Refactoring: move main/exercice/ to main/exercise/ and related folders (except code for migration from 1.9 and 1.10) --- .htaccess | 3 + composer.json | 2 +- documentation/installation_guide.html | 2 + documentation/installation_guide_es_ES.html | 2 + documentation/installation_guide_fr_FR.html | 2 + main/{exercice => exercise}/Draggable.php | 0 main/{exercice => exercise}/Hpdownload.php | 2 +- .../MatchingDraggable.php | 0 main/{exercice => exercise}/TestCategory.php | 0 .../UniqueAnswerImage.php | 0 main/{exercice => exercise}/admin.php | 20 +- main/{exercice => exercise}/adminhp.php | 2 +- main/{exercice => exercise}/aiken.php | 4 +- main/{exercice => exercise}/answer.class.php | 0 .../calculated_answer.class.php | 2 +- .../evalmathnotation.php | 0 main/{exercice => exercise}/exercice.php | 0 .../{exercice => exercise}/exercise.class.php | 6 +- main/{exercice => exercise}/exercise.php | 20 +- .../{exercice => exercise}/exercise_admin.php | 0 .../exercise_history.php | 2 +- .../exercise_reminder.php | 0 .../exercise_report.php | 4 +- .../exercise_result.class.php | 0 .../exercise_result.php | 2 +- main/{exercice => exercise}/exercise_show.php | 4 +- .../exercise_submit.php | 0 .../exercise_submit_modal.php | 0 .../export/aiken/aiken_classes.php | 0 .../export/aiken/aiken_import.inc.php | 0 .../export/exercise_import.inc.php | 0 .../export/exercise_import.php | 0 main/{exercice => exercise}/export/index.php | 0 .../export/qti2/qti2_classes.php | 0 .../export/qti2/qti2_export.php | 0 .../export/scorm/scorm_classes.php | 0 main/{exercice => exercise}/feedback.php | 0 .../fill_blanks.class.php | 2 +- .../freeanswer.class.php | 0 .../global_multiple_answer.class.php | 486 +++++++++--------- .../hotpotatoes.lib.php | 0 main/{exercice => exercise}/hotpotatoes.php | 2 +- .../hotpotatoes_exercise_report.php | 0 .../hotpotatoes_exercise_result.class.php | 0 main/{exercice => exercise}/hotspot.class.php | 0 main/{exercice => exercise}/hotspot.inc.php | 0 .../hotspot_actionscript.as.php | 0 .../hotspot_actionscript_admin.as.php | 0 .../hotspot_admin.inc.php | 4 +- .../hotspot_answers.as.php | 0 .../hotspot_lang_conversion.php | 0 .../hotspot_save.inc.php | 0 .../hotspot_savescore.inc.php | 0 .../hotspot_updatescore.inc.php | 0 main/{exercice => exercise}/index.html | 0 main/{exercice => exercise}/live_stats.php | 0 .../{exercice => exercise}/matching.class.php | 0 .../multiple_answer.class.php | 0 .../multiple_answer_combination.class.php | 0 ...le_answer_combination_true_false.class.php | 0 .../multiple_answer_true_false.class.php | 0 .../oral_expression.class.php | 0 main/{exercice => exercise}/overview.php | 6 +- main/{exercice => exercise}/qti2.php | 10 +- .../{exercice => exercise}/question.class.php | 0 .../question_admin.inc.php | 0 .../question_create.php | 0 .../question_list_admin.inc.php | 0 main/{exercice => exercise}/question_pool.php | 0 main/{exercice => exercise}/quiz_template.xls | Bin main/{exercice => exercise}/result.php | 0 main/{exercice => exercise}/savescores.php | 0 main/{exercice => exercise}/showinframes.php | 6 +- main/{exercice => exercise}/stats.php | 0 .../{exercice => exercise}/tests_category.php | 0 .../unique_answer.class.php | 0 .../unique_answer_no_option.class.php | 0 .../upload_exercise.php | 6 +- main/gradebook/exercise_jump.php | 6 +- main/gradebook/lib/be/exerciselink.class.php | 6 +- main/inc/lib/add_course.lib.inc.php | 2 +- main/inc/lib/course.lib.php | 2 +- main/inc/lib/events.lib.php | 2 +- main/inc/lib/exercise.lib.php | 8 +- main/inc/lib/javascript/hotspot/js/hotspot.js | 12 +- .../tool_processors/quiz_processor.class.php | 2 +- main/inc/lib/tracking.lib.php | 10 +- main/inc/lib/userportal.lib.php | 2 +- main/mySpace/myStudents.php | 4 +- main/newscorm/learnpath.class.php | 4 +- main/newscorm/lp_view.php | 2 +- main/newscorm/resourcelinker.inc.php | 26 +- main/newscorm/resourcelinker.php | 2 +- main/resourcelinker/resourcelinker.inc.php | 16 +- main/resourcelinker/resourcelinker.php | 2 +- main/session/index.php | 4 +- main/tracking/course_log_tools.php | 2 +- main/tracking/userLog.php | 2 +- main/tracking/userlogCSV.php | 2 +- .../CourseBundle/Entity/CQuizRelQuestion.php | 2 +- tests/main/exercice/answer.class.test.php | 2 +- tests/main/exercice/exercise.lib.test.php | 2 +- .../export/qti2/qti2_classes.test.php | 20 +- .../export/scorm/scorm_classes.test.php | 22 +- tests/main/exercice/hotpotatoes.lib.test.php | 24 +- tests/test_manager.inc.php | 16 +- tests/test_suite.php | 26 +- 107 files changed, 421 insertions(+), 412 deletions(-) rename main/{exercice => exercise}/Draggable.php (100%) rename main/{exercice => exercise}/Hpdownload.php (97%) rename main/{exercice => exercise}/MatchingDraggable.php (100%) rename main/{exercice => exercise}/TestCategory.php (100%) rename main/{exercice => exercise}/UniqueAnswerImage.php (100%) rename main/{exercice => exercise}/admin.php (96%) rename main/{exercice => exercise}/adminhp.php (97%) rename main/{exercice => exercise}/aiken.php (91%) rename main/{exercice => exercise}/answer.class.php (100%) rename main/{exercice => exercise}/calculated_answer.class.php (99%) rename main/{exercice => exercise}/evalmathnotation.php (100%) rename main/{exercice => exercise}/exercice.php (100%) rename main/{exercice => exercise}/exercise.class.php (99%) rename main/{exercice => exercise}/exercise.php (98%) rename main/{exercice => exercise}/exercise_admin.php (100%) rename main/{exercice => exercise}/exercise_history.php (97%) rename main/{exercice => exercise}/exercise_reminder.php (100%) rename main/{exercice => exercise}/exercise_report.php (99%) rename main/{exercice => exercise}/exercise_result.class.php (100%) rename main/{exercice => exercise}/exercise_result.php (99%) rename main/{exercice => exercise}/exercise_show.php (99%) rename main/{exercice => exercise}/exercise_submit.php (100%) rename main/{exercice => exercise}/exercise_submit_modal.php (100%) rename main/{exercice => exercise}/export/aiken/aiken_classes.php (100%) rename main/{exercice => exercise}/export/aiken/aiken_import.inc.php (100%) rename main/{exercice => exercise}/export/exercise_import.inc.php (100%) rename main/{exercice => exercise}/export/exercise_import.php (100%) rename main/{exercice => exercise}/export/index.php (100%) rename main/{exercice => exercise}/export/qti2/qti2_classes.php (100%) rename main/{exercice => exercise}/export/qti2/qti2_export.php (100%) rename main/{exercice => exercise}/export/scorm/scorm_classes.php (100%) rename main/{exercice => exercise}/feedback.php (100%) rename main/{exercice => exercise}/fill_blanks.class.php (99%) rename main/{exercice => exercise}/freeanswer.class.php (100%) rename main/{exercice => exercise}/global_multiple_answer.class.php (97%) rename main/{exercice => exercise}/hotpotatoes.lib.php (100%) rename main/{exercice => exercise}/hotpotatoes.php (99%) rename main/{exercice => exercise}/hotpotatoes_exercise_report.php (100%) rename main/{exercice => exercise}/hotpotatoes_exercise_result.class.php (100%) rename main/{exercice => exercise}/hotspot.class.php (100%) rename main/{exercice => exercise}/hotspot.inc.php (100%) rename main/{exercice => exercise}/hotspot_actionscript.as.php (100%) rename main/{exercice => exercise}/hotspot_actionscript_admin.as.php (100%) rename main/{exercice => exercise}/hotspot_admin.inc.php (99%) rename main/{exercice => exercise}/hotspot_answers.as.php (100%) rename main/{exercice => exercise}/hotspot_lang_conversion.php (100%) rename main/{exercice => exercise}/hotspot_save.inc.php (100%) rename main/{exercice => exercise}/hotspot_savescore.inc.php (100%) rename main/{exercice => exercise}/hotspot_updatescore.inc.php (100%) rename main/{exercice => exercise}/index.html (100%) rename main/{exercice => exercise}/live_stats.php (100%) rename main/{exercice => exercise}/matching.class.php (100%) rename main/{exercice => exercise}/multiple_answer.class.php (100%) rename main/{exercice => exercise}/multiple_answer_combination.class.php (100%) rename main/{exercice => exercise}/multiple_answer_combination_true_false.class.php (100%) rename main/{exercice => exercise}/multiple_answer_true_false.class.php (100%) rename main/{exercice => exercise}/oral_expression.class.php (100%) rename main/{exercice => exercise}/overview.php (96%) rename main/{exercice => exercise}/qti2.php (84%) rename main/{exercice => exercise}/question.class.php (100%) rename main/{exercice => exercise}/question_admin.inc.php (100%) rename main/{exercice => exercise}/question_create.php (100%) rename main/{exercice => exercise}/question_list_admin.inc.php (100%) rename main/{exercice => exercise}/question_pool.php (100%) rename main/{exercice => exercise}/quiz_template.xls (100%) rename main/{exercice => exercise}/result.php (100%) rename main/{exercice => exercise}/savescores.php (100%) rename main/{exercice => exercise}/showinframes.php (82%) rename main/{exercice => exercise}/stats.php (100%) rename main/{exercice => exercise}/tests_category.php (100%) rename main/{exercice => exercise}/unique_answer.class.php (100%) rename main/{exercice => exercise}/unique_answer_no_option.class.php (100%) rename main/{exercice => exercise}/upload_exercise.php (99%) diff --git a/.htaccess b/.htaccess index b488d37009..372ab4fee2 100644 --- a/.htaccess +++ b/.htaccess @@ -45,3 +45,6 @@ RewriteRule ^badge/(\d{1,}) main/badge/issued.php?issue=$1 [L] RewriteRule ^skill/(\d{1,})/user/(\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L] # Support deprecated URL (avoid 404) RewriteRule ^badge/(\d{1,})/user/(\d{1,}) main/badge/issued_all.php?skill=$1&user=$2 [L] + +# Support old URLs using the exercice (with a c) folder rather than exercise +RewriteRule ^main/exercice/(.*)$ main/exercise/$1 [QSA,L] \ No newline at end of file diff --git a/composer.json b/composer.json index 8cf644dfc9..e9d2cf1a98 100755 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "main/cron/lang", "main/course_description", "main/dropbox", - "main/exercice", + "main/exercise", "main/gradebook/lib", "main/newscorm", "main/inc/lib", diff --git a/documentation/installation_guide.html b/documentation/installation_guide.html index 50e5b106cb..320bd3e557 100755 --- a/documentation/installation_guide.html +++ b/documentation/installation_guide.html @@ -680,6 +680,7 @@ If you have issues with files taking a long time to download, make sure you reco RewriteRule ^courses/([^/]+)/course-pic.png$ app/courses/$1/course-pic.png [QSA,L] RewriteRule ^session/(\d{1,})/about/?$ main/session/about.php?session_id=$1 [L] RewriteRule ^badge/(\d{1,})/user/(\d{1,}) main/badge/issued.php?skill=$1&user=$2 [L] + RewriteRule ^main/exercice/(.+)$ main/exercise/$1 [QSA,L] </Directory>

Nginx

@@ -718,6 +719,7 @@ If you have issues with files taking a long time to download, make sure you reco rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/courses/([^/]+)/index.php$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/session/([^/]+)/about/?$ /main/session/about.php?session_id=$1 last; + rewrite ^/main/exercice/(.+)$ /main/exercise/$1 last; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; diff --git a/documentation/installation_guide_es_ES.html b/documentation/installation_guide_es_ES.html index 96ba9d2732..8e99e052a7 100755 --- a/documentation/installation_guide_es_ES.html +++ b/documentation/installation_guide_es_ES.html @@ -711,6 +711,7 @@ por ejemplo. El efecto debería ser inmediato. rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/courses/([^/]+)/index.php$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/session/([^/]+)/about/?$ /main/session/about.php?session_id=$1 last; + rewrite ^/main/exercice/(.+)$ /main/exercise/$1 last; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; @@ -777,6 +778,7 @@ Apache2: La configuración para nuestro sitio de ejemplo my.chamilo10.net sería RewriteRule ^courses/([^/]+)/course-pic.png$ app/courses/$1/course-pic.png [QSA,L] RewriteRule ^session/(\d{1,})/about/?$ main/session/about.php?session_id=$1 [L] RewriteRule ^badge/(\d{1,})/user/(\d{1,}) main/badge/issued.php?skill=$1&user=$2 [L] + RewriteRule ^main/exercice/(.+)$ main/exercise/$1 [QSA,L] </Directory> php_value display_errors Off diff --git a/documentation/installation_guide_fr_FR.html b/documentation/installation_guide_fr_FR.html index 7e32ea1953..d409708fe0 100644 --- a/documentation/installation_guide_fr_FR.html +++ b/documentation/installation_guide_fr_FR.html @@ -739,6 +739,7 @@ ou, si vous travaillez avec Apache 2.4, la syntaxe est légèrement différente RewriteRule ^courses/([^/]+)/course-pic.png$ app/courses/$1/course-pic.png [QSA,L] RewriteRule ^session/(\d{1,})/about/?$ main/session/about.php?session_id=$1 [L] RewriteRule "^badge/(\d{1,})/user/(\d{1,})$" main/badge/issued.php?skill=$1&user=$2 [L] + RewriteRule ^main/exercice/(.+)$ main/exercise/$1 [QSA,L] </Directory>

Nginx

@@ -777,6 +778,7 @@ Ce sont uniquement les redirections à placer dans un bloc server{}, comme les a rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/courses/([^/]+)/index.php$ /main/course_home/course_home.php?cDir=$1 last; rewrite ^/session/([^/]+)/about/?$ /main/session/about.php?session_id=$1 last; + rewrite ^/main/exercice/(.+)$ /main/exercise/$1 last; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; diff --git a/main/exercice/Draggable.php b/main/exercise/Draggable.php similarity index 100% rename from main/exercice/Draggable.php rename to main/exercise/Draggable.php diff --git a/main/exercice/Hpdownload.php b/main/exercise/Hpdownload.php similarity index 97% rename from main/exercice/Hpdownload.php rename to main/exercise/Hpdownload.php index 5b53ba32d9..6d4920f7e8 100755 --- a/main/exercice/Hpdownload.php +++ b/main/exercise/Hpdownload.php @@ -128,7 +128,7 @@ if ($content_type == 'text/html') { $newcontent = str_replace($mit,$js_content,$content); $prehref="javascript:void(0);"; - $posthref=$_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; + $posthref = api_get_path(WEB_CODE_PATH) . "main/exercise/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; $newcontent = str_replace($prehref,$posthref,$newcontent); diff --git a/main/exercice/MatchingDraggable.php b/main/exercise/MatchingDraggable.php similarity index 100% rename from main/exercice/MatchingDraggable.php rename to main/exercise/MatchingDraggable.php diff --git a/main/exercice/TestCategory.php b/main/exercise/TestCategory.php similarity index 100% rename from main/exercice/TestCategory.php rename to main/exercise/TestCategory.php diff --git a/main/exercice/UniqueAnswerImage.php b/main/exercise/UniqueAnswerImage.php similarity index 100% rename from main/exercice/UniqueAnswerImage.php rename to main/exercise/UniqueAnswerImage.php diff --git a/main/exercice/admin.php b/main/exercise/admin.php similarity index 96% rename from main/exercice/admin.php rename to main/exercise/admin.php index 095a2c2865..616f5f24bd 100755 --- a/main/exercice/admin.php +++ b/main/exercise/admin.php @@ -186,7 +186,7 @@ if (!is_object($objExercise)) { // Exercise can be edited in their course. if ($objExercise->sessionId != $sessionId) { api_not_allowed(true); - /*header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidreq()); + /*header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq()); exit;*/ } @@ -230,7 +230,7 @@ if ($cancelExercise) { } else { // new exercise // goes back to the exercise list - header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidreq()); + header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq()); exit(); } } @@ -302,7 +302,7 @@ if (isset($_GET['newQuestion']) || isset($_GET['editQuestion']) ) { // shows a link to go back to the question pool if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')){ $interbreadcrumb[]=array( - "url" => api_get_path(WEB_CODE_PATH)."exercice/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(), + "url" => api_get_path(WEB_CODE_PATH)."exercise/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(), "name" => get_lang('QuestionPool') ); } @@ -363,22 +363,22 @@ $inATest = isset($exerciseId) && $exerciseId > 0; if ($inATest) { echo '
'; if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) - echo ''. + echo ''. Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).''; if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) { - echo ''. + echo ''. Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).''; } - echo ''. + echo ''. Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_MEDIUM).''; echo Display::url( Display::return_icon('test_results.png', get_lang('Results'),'',ICON_SIZE_MEDIUM), - api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id + api_get_path(WEB_CODE_PATH).'exercise/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id ); - echo ''. + echo ''. Display::return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).''; $maxScoreAllQuestions = 0; @@ -396,13 +396,13 @@ if ($inATest) { } else if (isset($_GET['newQuestion'])) { // we are in create a new question from question pool not in a test echo ''; } else { // If we are in question_pool but not in an test, go back to question create in pool echo ''; diff --git a/main/exercice/adminhp.php b/main/exercise/adminhp.php similarity index 97% rename from main/exercice/adminhp.php rename to main/exercise/adminhp.php index 49932f6c62..c3768b2abc 100755 --- a/main/exercice/adminhp.php +++ b/main/exercise/adminhp.php @@ -54,7 +54,7 @@ $nameTools = get_lang('adminHP'); Display::display_header($nameTools,"Exercise"); /** @todo probably wrong !!!! */ -require_once(api_get_path(SYS_CODE_PATH).'/exercice/hotpotatoes.lib.php'); +require_once(api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php'); ?> diff --git a/main/exercice/aiken.php b/main/exercise/aiken.php similarity index 91% rename from main/exercice/aiken.php rename to main/exercise/aiken.php index 052821cf0f..a75755276f 100755 --- a/main/exercice/aiken.php +++ b/main/exercise/aiken.php @@ -15,8 +15,8 @@ $lib_path = api_get_path(LIBRARY_PATH); $main_path = api_get_path(SYS_CODE_PATH); // including additional libraries -require_once $main_path.'exercice/export/aiken/aiken_import.inc.php'; -require_once $main_path.'exercice/export/aiken/aiken_classes.php'; +require_once $main_path.'exercise/export/aiken/aiken_import.inc.php'; +require_once $main_path.'exercise/export/aiken/aiken_classes.php'; // section (for the tabs) $this_section = SECTION_COURSES; diff --git a/main/exercice/answer.class.php b/main/exercise/answer.class.php similarity index 100% rename from main/exercice/answer.class.php rename to main/exercise/answer.class.php diff --git a/main/exercice/calculated_answer.class.php b/main/exercise/calculated_answer.class.php similarity index 99% rename from main/exercice/calculated_answer.class.php rename to main/exercise/calculated_answer.class.php index fc92aaad36..88ab4b21c4 100644 --- a/main/exercice/calculated_answer.class.php +++ b/main/exercise/calculated_answer.class.php @@ -138,7 +138,7 @@ class CalculatedAnswer extends Question $notationListButton = Display::url( get_lang('NotationList'), - api_get_path(WEB_PATH).'main/exercice/evalmathnotation.php', + api_get_path(WEB_CODE_PATH).'exercise/evalmathnotation.php', array( 'class' => 'btn btn-info ajax', 'data-title' => get_lang('NotationList'), diff --git a/main/exercice/evalmathnotation.php b/main/exercise/evalmathnotation.php similarity index 100% rename from main/exercice/evalmathnotation.php rename to main/exercise/evalmathnotation.php diff --git a/main/exercice/exercice.php b/main/exercise/exercice.php similarity index 100% rename from main/exercice/exercice.php rename to main/exercise/exercice.php diff --git a/main/exercice/exercise.class.php b/main/exercise/exercise.class.php similarity index 99% rename from main/exercice/exercise.class.php rename to main/exercise/exercise.class.php index 8aa5681209..15548e98ba 100755 --- a/main/exercice/exercise.class.php +++ b/main/exercise/exercise.class.php @@ -5165,7 +5165,7 @@ class Exercise } $url_email = api_get_path(WEB_CODE_PATH) - . 'exercice/exercise_show.php?' + . 'exercise/exercise_show.php?' . api_get_cidreq() . '&id_session=' . $sessionId @@ -5241,7 +5241,7 @@ class Exercise $course_info = api_get_course_info($courseCode); $url_email = api_get_path(WEB_CODE_PATH) - . 'exercice/exercise_show.php?' + . 'exercise/exercise_show.php?' . api_get_cidreq() . '&id_session=' . api_get_session_id() @@ -5337,7 +5337,7 @@ class Exercise $course_info = api_get_course_info($courseCode); $url_email = api_get_path(WEB_CODE_PATH) - . 'exercice/exercise_show.php?' + . 'exercise/exercise_show.php?' . api_get_cidreq() . '&id_session=' . api_get_session_id() diff --git a/main/exercice/exercise.php b/main/exercise/exercise.php similarity index 98% rename from main/exercice/exercise.php rename to main/exercise/exercise.php index e3d8f221bc..7c76278dd5 100644 --- a/main/exercice/exercise.php +++ b/main/exercise/exercise.php @@ -116,7 +116,7 @@ if (!empty($gradebook) && $gradebook == 'view') { $nameTools = get_lang('Exercises'); $errorXmlExport = null; if ($is_allowedToEdit && !empty($choice) && $choice == 'exportqti2') { - require_once api_get_path(SYS_CODE_PATH).'exercice/export/qti2/qti2_export.php'; + require_once api_get_path(SYS_CODE_PATH).'exercise/export/qti2/qti2_export.php'; $export = export_exercise_to_qti($exerciseId, true); $archive_path = api_get_path(SYS_ARCHIVE_PATH); @@ -443,25 +443,25 @@ $total = $total_exercises + $hp_count; $token = Security::get_token(); if ($is_allowedToEdit && $origin != 'learnpath') { - echo ''. + echo ''. Display :: return_icon('new_exercice.png', get_lang('NewEx'), '', ICON_SIZE_MEDIUM).''; - echo ''. + echo ''. Display :: return_icon('new_question.png', get_lang('AddQ'), '', ICON_SIZE_MEDIUM).''; // Question category - echo ''; + echo ''; echo Display::return_icon('green_open.png', get_lang('QuestionCategory'), '', ICON_SIZE_MEDIUM); echo ''; - echo ''; + echo ''; echo Display::return_icon('database.png', get_lang('QuestionPool'), '', ICON_SIZE_MEDIUM); echo ''; //echo Display::url(Display::return_icon('looknfeel.png', get_lang('Media')), 'media.php?' . api_get_cidreq()); // end question category - echo ''.Display :: return_icon('import_hotpotatoes.png', get_lang('ImportHotPotatoesQuiz'), '', ICON_SIZE_MEDIUM).''; + echo ''.Display :: return_icon('import_hotpotatoes.png', get_lang('ImportHotPotatoesQuiz'), '', ICON_SIZE_MEDIUM).''; // link to import qti2 ... - echo ''.Display :: return_icon('import_qti2.png', get_lang('ImportQtiQuiz'), '', ICON_SIZE_MEDIUM).''; - echo ''.Display :: return_icon('import_aiken.png', get_lang('ImportAikenQuiz'), '', ICON_SIZE_MEDIUM).''; - echo ''.Display :: return_icon('import_excel.png', get_lang('ImportExcelQuiz'), '', ICON_SIZE_MEDIUM).''; + echo ''.Display :: return_icon('import_qti2.png', get_lang('ImportQtiQuiz'), '', ICON_SIZE_MEDIUM).''; + echo ''.Display :: return_icon('import_aiken.png', get_lang('ImportAikenQuiz'), '', ICON_SIZE_MEDIUM).''; + echo ''.Display :: return_icon('import_excel.png', get_lang('ImportExcelQuiz'), '', ICON_SIZE_MEDIUM).''; echo Display::url( Display::return_icon( 'clean_all.png', @@ -472,7 +472,7 @@ if ($is_allowedToEdit && $origin != 'learnpath') { '', array( 'onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToEmptyAllTestResults'), ENT_QUOTES, $charset))."')) return false;", - 'href' => api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidreq().'&choice=clean_all_test&sec_token='.$token + 'href' => api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq().'&choice=clean_all_test&sec_token='.$token ) ); } diff --git a/main/exercice/exercise_admin.php b/main/exercise/exercise_admin.php similarity index 100% rename from main/exercice/exercise_admin.php rename to main/exercise/exercise_admin.php diff --git a/main/exercice/exercise_history.php b/main/exercise/exercise_history.php similarity index 97% rename from main/exercice/exercise_history.php rename to main/exercise/exercise_history.php index bdb5fde572..0d614251ab 100755 --- a/main/exercice/exercise_history.php +++ b/main/exercise/exercise_history.php @@ -22,7 +22,7 @@ $is_allowedToEdit = api_is_allowed_to_edit(null,true); $is_tutor = api_is_allowed_to_edit(true); if (!$is_allowedToEdit){ - header('Location: /main/exercice/exercise.php?'.api_get_cidreq()); + header('Location: ' . api_get_path(WEB_CODE_PATH) . 'exercise/exercise.php?' . api_get_cidreq()); exit; } diff --git a/main/exercice/exercise_reminder.php b/main/exercise/exercise_reminder.php similarity index 100% rename from main/exercice/exercise_reminder.php rename to main/exercise/exercise_reminder.php diff --git a/main/exercice/exercise_report.php b/main/exercise/exercise_report.php similarity index 99% rename from main/exercice/exercise_report.php rename to main/exercise/exercise_report.php index 9ee7bb9596..46d3e338bb 100755 --- a/main/exercice/exercise_report.php +++ b/main/exercise/exercise_report.php @@ -151,7 +151,7 @@ if (isset($_REQUEST['comments']) && null, PERSON_NAME_EMAIL_ADDRESS ); - $url = api_get_path(WEB_CODE_PATH).'exercice/result.php?id='.$track_exercise_info['exe_id'].'&'.api_get_cidreq().'&show_headers=1&id_session='.$session_id; + $url = api_get_path(WEB_CODE_PATH).'exercise/result.php?id='.$track_exercise_info['exe_id'].'&'.api_get_cidreq().'&show_headers=1&id_session='.$session_id; $my_post_info = array(); $post_content_id = array(); @@ -261,7 +261,7 @@ if (isset($_REQUEST['comments']) && Database::query($sql); if ($origin == 'tracking_course') { //Redirect to the course detail in lp - header('location: '.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?course='.Security :: remove_XSS($_GET['course'])); + header('location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?course='.Security :: remove_XSS($_GET['course'])); exit; } else { // Redirect to the reporting diff --git a/main/exercice/exercise_result.class.php b/main/exercise/exercise_result.class.php similarity index 100% rename from main/exercice/exercise_result.class.php rename to main/exercise/exercise_result.class.php diff --git a/main/exercice/exercise_result.php b/main/exercise/exercise_result.php similarity index 99% rename from main/exercice/exercise_result.php rename to main/exercise/exercise_result.php index fa5dae3cb4..9a31671fc6 100755 --- a/main/exercice/exercise_result.php +++ b/main/exercise/exercise_result.php @@ -151,7 +151,7 @@ if ($objExercise->selectAttempts() > 0) { if ($remainingAttempts) { $attemptButton = Display::toolbarButton( get_lang('AnotherAttempt'), - api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?' . api_get_cidreq() . '&' . http_build_query([ + api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . api_get_cidreq() . '&' . http_build_query([ 'exerciseId' => $objExercise->id ]), 'pencil-square-o', diff --git a/main/exercice/exercise_show.php b/main/exercise/exercise_show.php similarity index 99% rename from main/exercice/exercise_show.php rename to main/exercise/exercise_show.php index 7e866929b7..6003d700f3 100755 --- a/main/exercice/exercise_show.php +++ b/main/exercise/exercise_show.php @@ -855,7 +855,7 @@ if ($isFeedbackAllowed) { if ($isFeedbackAllowed) { if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) { - $formUrl = api_get_path(WEB_CODE_PATH) . 'exercice/exercise_report.php?' . api_get_cidreq() . '&'; + $formUrl = api_get_path(WEB_CODE_PATH) . 'exercise/exercise_report.php?' . api_get_cidreq() . '&'; $formUrl .= http_build_query([ 'exerciseId' => $exercise_id, 'filter' => 2, @@ -874,7 +874,7 @@ if ($isFeedbackAllowed) { echo ' '; echo ' '; } else { - $formUrl = api_get_path(WEB_CODE_PATH) . 'exercice/exercise_report.php?' . api_get_cidreq() . '&'; + $formUrl = api_get_path(WEB_CODE_PATH) . 'exercise/exercise_report.php?' . api_get_cidreq() . '&'; $formUrl .= http_build_query([ 'exerciseId' => $exercise_id, 'filter' => 1, diff --git a/main/exercice/exercise_submit.php b/main/exercise/exercise_submit.php similarity index 100% rename from main/exercice/exercise_submit.php rename to main/exercise/exercise_submit.php diff --git a/main/exercice/exercise_submit_modal.php b/main/exercise/exercise_submit_modal.php similarity index 100% rename from main/exercice/exercise_submit_modal.php rename to main/exercise/exercise_submit_modal.php diff --git a/main/exercice/export/aiken/aiken_classes.php b/main/exercise/export/aiken/aiken_classes.php similarity index 100% rename from main/exercice/export/aiken/aiken_classes.php rename to main/exercise/export/aiken/aiken_classes.php diff --git a/main/exercice/export/aiken/aiken_import.inc.php b/main/exercise/export/aiken/aiken_import.inc.php similarity index 100% rename from main/exercice/export/aiken/aiken_import.inc.php rename to main/exercise/export/aiken/aiken_import.inc.php diff --git a/main/exercice/export/exercise_import.inc.php b/main/exercise/export/exercise_import.inc.php similarity index 100% rename from main/exercice/export/exercise_import.inc.php rename to main/exercise/export/exercise_import.inc.php diff --git a/main/exercice/export/exercise_import.php b/main/exercise/export/exercise_import.php similarity index 100% rename from main/exercice/export/exercise_import.php rename to main/exercise/export/exercise_import.php diff --git a/main/exercice/export/index.php b/main/exercise/export/index.php similarity index 100% rename from main/exercice/export/index.php rename to main/exercise/export/index.php diff --git a/main/exercice/export/qti2/qti2_classes.php b/main/exercise/export/qti2/qti2_classes.php similarity index 100% rename from main/exercice/export/qti2/qti2_classes.php rename to main/exercise/export/qti2/qti2_classes.php diff --git a/main/exercice/export/qti2/qti2_export.php b/main/exercise/export/qti2/qti2_export.php similarity index 100% rename from main/exercice/export/qti2/qti2_export.php rename to main/exercise/export/qti2/qti2_export.php diff --git a/main/exercice/export/scorm/scorm_classes.php b/main/exercise/export/scorm/scorm_classes.php similarity index 100% rename from main/exercice/export/scorm/scorm_classes.php rename to main/exercise/export/scorm/scorm_classes.php diff --git a/main/exercice/feedback.php b/main/exercise/feedback.php similarity index 100% rename from main/exercice/feedback.php rename to main/exercise/feedback.php diff --git a/main/exercice/fill_blanks.class.php b/main/exercise/fill_blanks.class.php similarity index 99% rename from main/exercice/fill_blanks.class.php rename to main/exercise/fill_blanks.class.php index 45a290f4c1..16e6d3e734 100755 --- a/main/exercice/fill_blanks.class.php +++ b/main/exercise/fill_blanks.class.php @@ -757,7 +757,7 @@ class FillBlanks extends Question $tblTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $courseId = api_get_course_int_id(); - require_once api_get_path(SYS_PATH).'main/exercice/fill_blanks.class.php'; + require_once api_get_path(SYS_PATH).'main/exercise/fill_blanks.class.php'; // request to have all the answers of student for this question // student may have doing it several time diff --git a/main/exercice/freeanswer.class.php b/main/exercise/freeanswer.class.php similarity index 100% rename from main/exercice/freeanswer.class.php rename to main/exercise/freeanswer.class.php diff --git a/main/exercice/global_multiple_answer.class.php b/main/exercise/global_multiple_answer.class.php similarity index 97% rename from main/exercice/global_multiple_answer.class.php rename to main/exercise/global_multiple_answer.class.php index f98ecbff0a..dbcc71a8a4 100755 --- a/main/exercice/global_multiple_answer.class.php +++ b/main/exercise/global_multiple_answer.class.php @@ -1,243 +1,243 @@ -type = GLOBAL_MULTIPLE_ANSWER; - $this->isContent = $this->getIsContent(); - } - - /** - * function which redefines Question::createAnswersForm - * @param FormValidator $form - */ - public function createAnswersForm($form) - { - $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; - $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); - - $obj_ex = $_SESSION['objExercise']; - - /* Mise en variable de Affichage "Reponses" et son icone, "N�", "Vrai", "Reponse" */ - $html = ' - - - - '; - - $html .=''; - $html .=''; - $form->addElement( - 'label', - get_lang('Answers') . - '
'.Display::return_icon('fill_field.png'), - $html - ); - $defaults = array(); - $correct = 0; - $answer = false; - if (!empty($this->id)) { - $answer = new Answer($this->id); - $answer->read(); - if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) { - $nb_answers = $answer->nbrAnswers; - } - } - - #le nombre de r�ponses est bien enregistr� sous la forme int(nb) - - /* Ajout mise en forme nb reponse */ - $form->addElement('hidden', 'nb_answers'); - $boxes_names = array(); - - /* V�rification : Cr�action d'au moins une r�ponse */ - if ($nb_answers < 1) { - $nb_answers = 1; - Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); - } - - //D�but affichage score global dans la modification d'une question - $scoreA = "0"; //par reponse - $scoreG = "0"; //Global - - /* boucle pour sauvegarder les donn�es dans le tableau defaults */ - for ($i = 1; $i <= $nb_answers; ++$i) { - /* si la reponse est de type objet */ - if (is_object($answer)) { - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; - $defaults['correct[' . $i . ']'] = $answer->correct[$i]; - - // start - $scoreA = $answer->weighting[$i]; - } - if ($scoreA > 0) { - $scoreG = $scoreG + $scoreA; - } - //------------- Fin - //------------- Debut si un des scores par reponse est egal � 0 : la coche vaut 1 (coch�) - if ($scoreA == 0) { - $defaults['pts'] = 1; - } - - $renderer = & $form->defaultRenderer(); - - $renderer->setElementTemplate('', 'correct['.$i.']'); - $renderer->setElementTemplate('', 'counter['.$i.']'); - $renderer->setElementTemplate('', 'answer['.$i.']'); - $renderer->setElementTemplate('', 'comment['.$i.']'); - //$renderer->setElementTemplate('', 'weighting['.$i.']'); - - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); - $answer_number->freeze(); - - $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"'); - $boxes_names[] = 'correct[' . $i . ']'; - - $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); - - $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); - - $form->addElement('html', ''); - } - //--------- Mise en variable du score global lors d'une modification de la question/r�ponse - $defaults['weighting[1]'] = (round($scoreG)); - - $form->addElement('html', '
- ' . get_lang('Number') . ' - - ' . get_lang('True') . ' - - ' . get_lang('Answer') . ' - ' . get_lang('Comment') . '
{error}
{element}
{error}
{element}
{error}
{element}
{error}
{element}
{error}
{element}
'); - - //$form -> addElement ('html', '
'); - $form->add_multiple_required_rule($boxes_names, get_lang('ChooseAtLeastOneCheckbox'), 'multiple_required'); - - //only 1 answer the all deal ... - $form->addElement('text', 'weighting[1]', get_lang('Score')); - - global $pts; - //--------- Creation coche pour ne pas prendre en compte les n�gatifs - $form->addElement('checkbox', 'pts', '', get_lang('NoNegativeScore')); - $form->addElement('html', '
'); - - // Affiche un message si le score n'est pas renseign� - $form->addRule('weighting[1]', get_lang('ThisFieldIsRequired'), 'required'); - - global $text, $class; - - if ($obj_ex->edit_exercise_in_lp == true) { - $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers'); - $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers'); - $form->addButtonSave($text, 'submitQuestion'); - // setting the save button here and not in the question class.php - } - - $renderer->setElementTemplate('{element} ', 'lessAnswers'); - $renderer->setElementTemplate('{element} ', 'submitQuestion'); - $renderer->setElementTemplate('{element}', 'moreAnswers'); - - $form->addElement('html', '
'); - - $defaults['correct'] = $correct; - - if (!empty($this->id)) { - $form->setDefaults($defaults); - } else { - if ($this->isContent == 1) { - $form->setDefaults($defaults); - } - } - $form->setConstants(array('nb_answers' => $nb_answers)); - } - - /** - * abstract function which creates the form to create / edit the answers of the question - * @param FormValidator $form - */ - function processAnswersCreation($form) - { - $questionWeighting = $nbrGoodAnswers = 0; - $objAnswer = new Answer($this->id); - $nb_answers = $form->getSubmitValue('nb_answers'); - - // Score total - $answer_score = trim($form->getSubmitValue('weighting[1]')); - - // Reponses correctes - $nbr_corrects = 0; - for ($i = 1; $i <= $nb_answers; $i++) { - $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); - if ($goodAnswer) { - $nbr_corrects++; - } - } - // Set question weighting (score total) - $questionWeighting = $answer_score; - - // Set score per answer - $nbr_corrects = $nbr_corrects == 0 ? 1 : $nbr_corrects; - $answer_score = $nbr_corrects == 0 ? 0 : $answer_score; - - $answer_score = ($answer_score / $nbr_corrects); - - //$answer_score �quivaut � la valeur d'une bonne r�ponse - // cr�ation variable pour r�cuperer la valeur de la coche pour la prise en compte des n�gatifs - $test = $form->getSubmitValue('pts'); - - for ($i = 1; $i <= $nb_answers; $i++) { - $answer = trim($form->getSubmitValue('answer[' . $i . ']')); - $comment = trim($form->getSubmitValue('comment[' . $i . ']')); - $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); - - if ($goodAnswer) { - $weighting = abs($answer_score); - } else { - if ($test == 1) { - $weighting = 0; - } else { - $weighting = -abs($answer_score); - } - } - - $objAnswer->createAnswer($answer, $goodAnswer, $comment, $weighting, $i); - } - // saves the answers into the data base - $objAnswer->save(); - - // sets the total weighting of the question --> sert � donner le score total pendant l'examen - $this->updateWeighting($questionWeighting); - $this->save(); - } - - public function return_header( - $feedback_type = null, - $counter = null, - $score = null - ) { - $header = parent::return_header($feedback_type, $counter, $score); - $header .= ' - - - - '; - $header .= ''; - $header .= ''; - - return $header; - } -} +type = GLOBAL_MULTIPLE_ANSWER; + $this->isContent = $this->getIsContent(); + } + + /** + * function which redefines Question::createAnswersForm + * @param FormValidator $form + */ + public function createAnswersForm($form) + { + $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; + $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); + + $obj_ex = $_SESSION['objExercise']; + + /* Mise en variable de Affichage "Reponses" et son icone, "N�", "Vrai", "Reponse" */ + $html = '
' . get_lang("Choice") . '' . get_lang("ExpectedChoice") . '' . get_lang("Answer") . '' . get_lang("Comment") . '
+ + + + '; + + $html .=''; + $html .=''; + $form->addElement( + 'label', + get_lang('Answers') . + '
'.Display::return_icon('fill_field.png'), + $html + ); + $defaults = array(); + $correct = 0; + $answer = false; + if (!empty($this->id)) { + $answer = new Answer($this->id); + $answer->read(); + if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) { + $nb_answers = $answer->nbrAnswers; + } + } + + #le nombre de r�ponses est bien enregistr� sous la forme int(nb) + + /* Ajout mise en forme nb reponse */ + $form->addElement('hidden', 'nb_answers'); + $boxes_names = array(); + + /* V�rification : Cr�action d'au moins une r�ponse */ + if ($nb_answers < 1) { + $nb_answers = 1; + Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); + } + + //D�but affichage score global dans la modification d'une question + $scoreA = "0"; //par reponse + $scoreG = "0"; //Global + + /* boucle pour sauvegarder les donn�es dans le tableau defaults */ + for ($i = 1; $i <= $nb_answers; ++$i) { + /* si la reponse est de type objet */ + if (is_object($answer)) { + $defaults['answer[' . $i . ']'] = $answer->answer[$i]; + $defaults['comment[' . $i . ']'] = $answer->comment[$i]; + $defaults['correct[' . $i . ']'] = $answer->correct[$i]; + + // start + $scoreA = $answer->weighting[$i]; + } + if ($scoreA > 0) { + $scoreG = $scoreG + $scoreA; + } + //------------- Fin + //------------- Debut si un des scores par reponse est egal � 0 : la coche vaut 1 (coch�) + if ($scoreA == 0) { + $defaults['pts'] = 1; + } + + $renderer = & $form->defaultRenderer(); + + $renderer->setElementTemplate('', 'correct['.$i.']'); + $renderer->setElementTemplate('', 'counter['.$i.']'); + $renderer->setElementTemplate('', 'answer['.$i.']'); + $renderer->setElementTemplate('', 'comment['.$i.']'); + //$renderer->setElementTemplate('', 'weighting['.$i.']'); + + $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); + $answer_number->freeze(); + + $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"'); + $boxes_names[] = 'correct[' . $i . ']'; + + $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); + $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); + + $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); + + $form->addElement('html', ''); + } + //--------- Mise en variable du score global lors d'une modification de la question/r�ponse + $defaults['weighting[1]'] = (round($scoreG)); + + $form->addElement('html', '
+ ' . get_lang('Number') . ' + + ' . get_lang('True') . ' + + ' . get_lang('Answer') . ' + ' . get_lang('Comment') . '
{error}
{element}
{error}
{element}
{error}
{element}
{error}
{element}
{error}
{element}
'); + + //$form -> addElement ('html', '
'); + $form->add_multiple_required_rule($boxes_names, get_lang('ChooseAtLeastOneCheckbox'), 'multiple_required'); + + //only 1 answer the all deal ... + $form->addElement('text', 'weighting[1]', get_lang('Score')); + + global $pts; + //--------- Creation coche pour ne pas prendre en compte les n�gatifs + $form->addElement('checkbox', 'pts', '', get_lang('NoNegativeScore')); + $form->addElement('html', '
'); + + // Affiche un message si le score n'est pas renseign� + $form->addRule('weighting[1]', get_lang('ThisFieldIsRequired'), 'required'); + + global $text, $class; + + if ($obj_ex->edit_exercise_in_lp == true) { + $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers'); + $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers'); + $form->addButtonSave($text, 'submitQuestion'); + // setting the save button here and not in the question class.php + } + + $renderer->setElementTemplate('{element} ', 'lessAnswers'); + $renderer->setElementTemplate('{element} ', 'submitQuestion'); + $renderer->setElementTemplate('{element}', 'moreAnswers'); + + $form->addElement('html', ''); + + $defaults['correct'] = $correct; + + if (!empty($this->id)) { + $form->setDefaults($defaults); + } else { + if ($this->isContent == 1) { + $form->setDefaults($defaults); + } + } + $form->setConstants(array('nb_answers' => $nb_answers)); + } + + /** + * abstract function which creates the form to create / edit the answers of the question + * @param FormValidator $form + */ + function processAnswersCreation($form) + { + $questionWeighting = $nbrGoodAnswers = 0; + $objAnswer = new Answer($this->id); + $nb_answers = $form->getSubmitValue('nb_answers'); + + // Score total + $answer_score = trim($form->getSubmitValue('weighting[1]')); + + // Reponses correctes + $nbr_corrects = 0; + for ($i = 1; $i <= $nb_answers; $i++) { + $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); + if ($goodAnswer) { + $nbr_corrects++; + } + } + // Set question weighting (score total) + $questionWeighting = $answer_score; + + // Set score per answer + $nbr_corrects = $nbr_corrects == 0 ? 1 : $nbr_corrects; + $answer_score = $nbr_corrects == 0 ? 0 : $answer_score; + + $answer_score = ($answer_score / $nbr_corrects); + + //$answer_score �quivaut � la valeur d'une bonne r�ponse + // cr�ation variable pour r�cuperer la valeur de la coche pour la prise en compte des n�gatifs + $test = $form->getSubmitValue('pts'); + + for ($i = 1; $i <= $nb_answers; $i++) { + $answer = trim($form->getSubmitValue('answer[' . $i . ']')); + $comment = trim($form->getSubmitValue('comment[' . $i . ']')); + $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); + + if ($goodAnswer) { + $weighting = abs($answer_score); + } else { + if ($test == 1) { + $weighting = 0; + } else { + $weighting = -abs($answer_score); + } + } + + $objAnswer->createAnswer($answer, $goodAnswer, $comment, $weighting, $i); + } + // saves the answers into the data base + $objAnswer->save(); + + // sets the total weighting of the question --> sert � donner le score total pendant l'examen + $this->updateWeighting($questionWeighting); + $this->save(); + } + + public function return_header( + $feedback_type = null, + $counter = null, + $score = null + ) { + $header = parent::return_header($feedback_type, $counter, $score); + $header .= ' + + + + '; + $header .= ''; + $header .= ''; + + return $header; + } +} diff --git a/main/exercice/hotpotatoes.lib.php b/main/exercise/hotpotatoes.lib.php similarity index 100% rename from main/exercice/hotpotatoes.lib.php rename to main/exercise/hotpotatoes.lib.php diff --git a/main/exercice/hotpotatoes.php b/main/exercise/hotpotatoes.php similarity index 99% rename from main/exercice/hotpotatoes.php rename to main/exercise/hotpotatoes.php index 242639f05c..d058a688cb 100755 --- a/main/exercice/hotpotatoes.php +++ b/main/exercise/hotpotatoes.php @@ -31,7 +31,7 @@ if (!empty($gradebook) && $gradebook == 'view') { } // The breadcrumbs. $interbreadcrumb[] = array( - 'url' => api_get_path(WEB_CODE_PATH) . '.exercice/exercise.php?' . api_get_cidreq(), + 'url' => api_get_path(WEB_CODE_PATH) . '.exercise/exercise.php?' . api_get_cidreq(), 'name' => get_lang('Exercises') ); diff --git a/main/exercice/hotpotatoes_exercise_report.php b/main/exercise/hotpotatoes_exercise_report.php similarity index 100% rename from main/exercice/hotpotatoes_exercise_report.php rename to main/exercise/hotpotatoes_exercise_report.php diff --git a/main/exercice/hotpotatoes_exercise_result.class.php b/main/exercise/hotpotatoes_exercise_result.class.php similarity index 100% rename from main/exercice/hotpotatoes_exercise_result.class.php rename to main/exercise/hotpotatoes_exercise_result.class.php diff --git a/main/exercice/hotspot.class.php b/main/exercise/hotspot.class.php similarity index 100% rename from main/exercice/hotspot.class.php rename to main/exercise/hotspot.class.php diff --git a/main/exercice/hotspot.inc.php b/main/exercise/hotspot.inc.php similarity index 100% rename from main/exercice/hotspot.inc.php rename to main/exercise/hotspot.inc.php diff --git a/main/exercice/hotspot_actionscript.as.php b/main/exercise/hotspot_actionscript.as.php similarity index 100% rename from main/exercice/hotspot_actionscript.as.php rename to main/exercise/hotspot_actionscript.as.php diff --git a/main/exercice/hotspot_actionscript_admin.as.php b/main/exercise/hotspot_actionscript_admin.as.php similarity index 100% rename from main/exercice/hotspot_actionscript_admin.as.php rename to main/exercise/hotspot_actionscript_admin.as.php diff --git a/main/exercice/hotspot_admin.inc.php b/main/exercise/hotspot_admin.inc.php similarity index 99% rename from main/exercice/hotspot_admin.inc.php rename to main/exercise/hotspot_admin.inc.php index 15092a80cc..f53d20b15d 100755 --- a/main/exercice/hotspot_admin.inc.php +++ b/main/exercise/hotspot_admin.inc.php @@ -64,7 +64,7 @@ if ($modifyIn) { unset($buttonBack); } -$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId; +$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId; // the answer form has been submitted $submitAnswers = isset($_POST['submitAnswers']) ? true : false; @@ -572,7 +572,7 @@ if ($modifyAnswers) { Display::display_normal_message($msgErr); //main API } - $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq(); + $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq(); ?>
diff --git a/main/exercice/hotspot_answers.as.php b/main/exercise/hotspot_answers.as.php similarity index 100% rename from main/exercice/hotspot_answers.as.php rename to main/exercise/hotspot_answers.as.php diff --git a/main/exercice/hotspot_lang_conversion.php b/main/exercise/hotspot_lang_conversion.php similarity index 100% rename from main/exercice/hotspot_lang_conversion.php rename to main/exercise/hotspot_lang_conversion.php diff --git a/main/exercice/hotspot_save.inc.php b/main/exercise/hotspot_save.inc.php similarity index 100% rename from main/exercice/hotspot_save.inc.php rename to main/exercise/hotspot_save.inc.php diff --git a/main/exercice/hotspot_savescore.inc.php b/main/exercise/hotspot_savescore.inc.php similarity index 100% rename from main/exercice/hotspot_savescore.inc.php rename to main/exercise/hotspot_savescore.inc.php diff --git a/main/exercice/hotspot_updatescore.inc.php b/main/exercise/hotspot_updatescore.inc.php similarity index 100% rename from main/exercice/hotspot_updatescore.inc.php rename to main/exercise/hotspot_updatescore.inc.php diff --git a/main/exercice/index.html b/main/exercise/index.html similarity index 100% rename from main/exercice/index.html rename to main/exercise/index.html diff --git a/main/exercice/live_stats.php b/main/exercise/live_stats.php similarity index 100% rename from main/exercice/live_stats.php rename to main/exercise/live_stats.php diff --git a/main/exercice/matching.class.php b/main/exercise/matching.class.php similarity index 100% rename from main/exercice/matching.class.php rename to main/exercise/matching.class.php diff --git a/main/exercice/multiple_answer.class.php b/main/exercise/multiple_answer.class.php similarity index 100% rename from main/exercice/multiple_answer.class.php rename to main/exercise/multiple_answer.class.php diff --git a/main/exercice/multiple_answer_combination.class.php b/main/exercise/multiple_answer_combination.class.php similarity index 100% rename from main/exercice/multiple_answer_combination.class.php rename to main/exercise/multiple_answer_combination.class.php diff --git a/main/exercice/multiple_answer_combination_true_false.class.php b/main/exercise/multiple_answer_combination_true_false.class.php similarity index 100% rename from main/exercice/multiple_answer_combination_true_false.class.php rename to main/exercise/multiple_answer_combination_true_false.class.php diff --git a/main/exercice/multiple_answer_true_false.class.php b/main/exercise/multiple_answer_true_false.class.php similarity index 100% rename from main/exercice/multiple_answer_true_false.class.php rename to main/exercise/multiple_answer_true_false.class.php diff --git a/main/exercice/oral_expression.class.php b/main/exercise/oral_expression.class.php similarity index 100% rename from main/exercice/oral_expression.class.php rename to main/exercise/oral_expression.class.php diff --git a/main/exercice/overview.php b/main/exercise/overview.php similarity index 96% rename from main/exercice/overview.php rename to main/exercise/overview.php index d8c4c2e654..3e05fc6465 100755 --- a/main/exercice/overview.php +++ b/main/exercise/overview.php @@ -78,7 +78,7 @@ $edit_link = ''; if ($is_allowed_to_edit && $objExercise->sessionId == $sessionId) { $edit_link = Display::url( Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), - api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$objExercise->id + api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$objExercise->id ); } $iconExercise = Display::return_icon('test-quiz.png', null, array(), ICON_SIZE_MEDIUM); @@ -118,7 +118,7 @@ if (!empty($attempt_list)) { // 2. Exercise button // Notice we not add there the lp_item_view_id because is not already generated -$exercise_url = api_get_path(WEB_CODE_PATH).'exercice/exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.$extra_params; +$exercise_url = api_get_path(WEB_CODE_PATH) . 'exercise/exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.$extra_params; $exercise_url_button = Display::url( $label, $exercise_url, @@ -184,7 +184,7 @@ if (!empty($attempts)) { $attempt_result['exe_result'], $attempt_result['exe_weighting'] ); - $attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?'; + $attempt_url = api_get_path(WEB_CODE_PATH) . 'exercise/result.php?'; $attempt_url .= api_get_cidreq() . '&show_headers=1&'; $attempt_url .= http_build_query([ 'id' => $attempt_result['exe_id'] diff --git a/main/exercice/qti2.php b/main/exercise/qti2.php similarity index 84% rename from main/exercice/qti2.php rename to main/exercise/qti2.php index cd95b7e26b..a34731d272 100755 --- a/main/exercice/qti2.php +++ b/main/exercise/qti2.php @@ -22,7 +22,7 @@ if (!api_is_allowed_to_edit(null, true)) { // the breadcrumbs $interbreadcrumb[]= array ( - "url" => api_get_path(WEB_CODE_PATH)."exercice/exercise.php?".api_get_cidreq(), + "url" => api_get_path(WEB_CODE_PATH) . "exercise/exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises') ); $is_allowedToEdit = api_is_allowed_to_edit(null, true); @@ -34,7 +34,7 @@ function ch_qti2_display_form() { $name_tools = get_lang('ImportQtiQuiz'); $form = ''; $formValidator = new FormValidator( @@ -67,8 +67,8 @@ function ch_qti2_import_file($array_file) if ($process && $unzip == 1) { $main_path = api_get_path(SYS_CODE_PATH); - require_once $main_path.'exercice/export/exercise_import.inc.php'; - require_once $main_path.'exercice/export/qti2/qti2_classes.php'; + require_once $main_path.'exercise/export/exercise_import.inc.php'; + require_once $main_path.'exercise/export/qti2/qti2_classes.php'; return import_exercise($array_file['name']); } @@ -84,7 +84,7 @@ if ((api_is_allowed_to_edit(null, true))) { $imported = ch_qti2_import_file($_FILES['userFile']); if (is_numeric($imported) && !empty($imported)) { - header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&exerciseId='.$imported); + header('Location: '.api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$imported); exit; } else { $message = Display::return_message(get_lang($imported)); diff --git a/main/exercice/question.class.php b/main/exercise/question.class.php similarity index 100% rename from main/exercice/question.class.php rename to main/exercise/question.class.php diff --git a/main/exercice/question_admin.inc.php b/main/exercise/question_admin.inc.php similarity index 100% rename from main/exercice/question_admin.inc.php rename to main/exercise/question_admin.inc.php diff --git a/main/exercice/question_create.php b/main/exercise/question_create.php similarity index 100% rename from main/exercice/question_create.php rename to main/exercise/question_create.php diff --git a/main/exercice/question_list_admin.inc.php b/main/exercise/question_list_admin.inc.php similarity index 100% rename from main/exercice/question_list_admin.inc.php rename to main/exercise/question_list_admin.inc.php diff --git a/main/exercice/question_pool.php b/main/exercise/question_pool.php similarity index 100% rename from main/exercice/question_pool.php rename to main/exercise/question_pool.php diff --git a/main/exercice/quiz_template.xls b/main/exercise/quiz_template.xls similarity index 100% rename from main/exercice/quiz_template.xls rename to main/exercise/quiz_template.xls diff --git a/main/exercice/result.php b/main/exercise/result.php similarity index 100% rename from main/exercice/result.php rename to main/exercise/result.php diff --git a/main/exercice/savescores.php b/main/exercise/savescores.php similarity index 100% rename from main/exercice/savescores.php rename to main/exercise/savescores.php diff --git a/main/exercice/showinframes.php b/main/exercise/showinframes.php similarity index 82% rename from main/exercice/showinframes.php rename to main/exercise/showinframes.php index 0f6e2df9bb..7e80be4b7d 100755 --- a/main/exercice/showinframes.php +++ b/main/exercise/showinframes.php @@ -8,7 +8,7 @@ */ require_once '../inc/global.inc.php'; -require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'; +require_once api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php'; $_course = api_get_course_info(); $time = time(); @@ -38,9 +38,9 @@ if ($content == '') { if (SaveScoreVariable==0) { SaveScoreVariable = 1; if (C.ie) { - document.location.href = '".api_get_path(WEB_PATH)."main/exercice/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score; + document.location.href = '" . api_get_path(WEB_CODE_PATH) . "exercise/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score; } else { - window.location.href = '".api_get_path(WEB_PATH)."main/exercice/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score; + window.location.href = '" . api_get_path(WEB_CODE_PATH) . "exercise/savescores.php?lp_view_id=$lpViewId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=".Security::remove_XSS($time)."&test=".$doc_url."&uid=".$user_id."&cid=".$cid."&score='+Score; } } } diff --git a/main/exercice/stats.php b/main/exercise/stats.php similarity index 100% rename from main/exercice/stats.php rename to main/exercise/stats.php diff --git a/main/exercice/tests_category.php b/main/exercise/tests_category.php similarity index 100% rename from main/exercice/tests_category.php rename to main/exercise/tests_category.php diff --git a/main/exercice/unique_answer.class.php b/main/exercise/unique_answer.class.php similarity index 100% rename from main/exercice/unique_answer.class.php rename to main/exercise/unique_answer.class.php diff --git a/main/exercice/unique_answer_no_option.class.php b/main/exercise/unique_answer_no_option.class.php similarity index 100% rename from main/exercice/unique_answer_no_option.class.php rename to main/exercise/unique_answer_no_option.class.php diff --git a/main/exercice/upload_exercise.php b/main/exercise/upload_exercise.php similarity index 99% rename from main/exercice/upload_exercise.php rename to main/exercise/upload_exercise.php index aac9a6d76e..96c910b5fe 100755 --- a/main/exercice/upload_exercise.php +++ b/main/exercise/upload_exercise.php @@ -85,7 +85,7 @@ function lp_upload_quiz_main() { $form->addElement('header', get_lang('ImportExcelQuiz')); $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload')); - $link = ''. + $link = ''. Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')).get_lang('DownloadExcelTemplate').''; $form->addElement('label', '', $link); @@ -621,8 +621,8 @@ function lp_upload_quiz_action_handling() { header('location: ../newscorm/lp_controller.php?'.api_get_cidreq().'&action=add_item&type=step&lp_id='.Security::remove_XSS($_GET['lp_id'])); exit; } else { - // header('location: exercice.php?' . api_get_cidreq()); - echo ''; + // header('location: exercise.php?' . api_get_cidreq()); + echo ''; } } } diff --git a/main/gradebook/exercise_jump.php b/main/gradebook/exercise_jump.php index 8c154c5386..c783ed74d2 100755 --- a/main/gradebook/exercise_jump.php +++ b/main/gradebook/exercise_jump.php @@ -22,7 +22,7 @@ $type = Security::remove_XSS($_GET['type']); $doExerciseUrl = ''; if (isset($_GET['doexercise'])) { - $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?' . http_build_query([ + $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . http_build_query([ 'session_id' => $session_id, 'cidReq' => $cidReq, 'gradebook' => $gradebook, @@ -35,14 +35,14 @@ if (isset($_GET['doexercise'])) { // no support for hot potatoes if ($type == LINK_HOTPOTATOES) { - $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercice/exercice.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq); + $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/exercice.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq); } if (isset($_GET['doexercise'])) { header('Location: '.$doExerciseUrl); exit; } else { - $url = api_get_path(WEB_CODE_PATH).'exercice/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq); + $url = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq); if (isset($_GET['gradebook'])) { $url .= '&gradebook=view&exerciseId='.intval($_GET['exerciseId']); diff --git a/main/gradebook/lib/be/exerciselink.class.php b/main/gradebook/lib/be/exerciselink.class.php index caed75a93a..23d7a9d69d 100755 --- a/main/gradebook/lib/be/exerciselink.class.php +++ b/main/gradebook/lib/be/exerciselink.class.php @@ -103,7 +103,7 @@ class ExerciseLink extends AbstractLink ip.visibility='1' "; - require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'; + require_once api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php'; $exerciseInLP = array(); if (!$this->is_hp) { $result = Database::query($sql); @@ -191,7 +191,7 @@ class ExerciseLink extends AbstractLink $tblDoc = Database::get_course_table(TABLE_DOCUMENT); /* the following query should be similar (in conditions) to the one used - in exercice/exercice.php, look for note-query-exe-results marker*/ + in exercise/exercise.php, look for note-query-exe-results marker*/ $session_id = $this->get_session_id(); $courseId = $this->getCourseId(); $exercise = new Exercise($courseId); @@ -332,7 +332,7 @@ class ExerciseLink extends AbstractLink public function get_name() { $documentPath = api_get_path(SYS_COURSE_PATH).$this->course_code."/document"; - require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'; + require_once api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php'; $data = $this->get_exercise_data(); if ($this->is_hp == 1) { if (isset($data['path'])) { diff --git a/main/inc/lib/add_course.lib.inc.php b/main/inc/lib/add_course.lib.inc.php index a85b28d37e..0eb0dcf5ca 100755 --- a/main/inc/lib/add_course.lib.inc.php +++ b/main/inc/lib/add_course.lib.inc.php @@ -519,7 +519,7 @@ class AddCourse ); Database::query( "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id) - VALUES ($course_id, 6, '" . TOOL_QUIZ . "','exercice/exercice.php','quiz.gif','" . self::string2binary( + VALUES ($course_id, 6, '" . TOOL_QUIZ . "','exercise/exercise.php','quiz.gif','" . self::string2binary( api_get_setting('course_create_active_tools', 'quiz') ) . "','0','squaregrey.gif',0,'_self','authoring','0')" ); diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index 537d221274..ba56ff6fa5 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -5737,7 +5737,7 @@ class CourseManager $result = $objExercise->read($exercise_redirect); if (!empty($exercise_redirect) && !empty($result)) { - $form_data['action'] = api_get_path(WEB_CODE_PATH).'exercice/overview.php?exerciseId='.$exercise_redirect.'&cidReq='.$course_info['code']; + $form_data['action'] = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?exerciseId='.$exercise_redirect.'&cidReq='.$course_info['code']; $form_data['message'] .= '
'.get_lang('YouCanAccessTheExercise'); $form_data['button'] = Display::button( 'next', diff --git a/main/inc/lib/events.lib.php b/main/inc/lib/events.lib.php index 7a74dd758b..223c7cfdb1 100644 --- a/main/inc/lib/events.lib.php +++ b/main/inc/lib/events.lib.php @@ -316,7 +316,7 @@ class Event * * @author Sebastien Piraux * @author Julio Montoya Armas Reworked 2010 - * @desc Record result of user when an exercice was done + * @desc Record result of user when an exercise was done */ public static function update_event_exercice( $exeid, diff --git a/main/inc/lib/exercise.lib.php b/main/inc/lib/exercise.lib.php index 6822b2d967..737e160924 100644 --- a/main/inc/lib/exercise.lib.php +++ b/main/inc/lib/exercise.lib.php @@ -556,7 +556,7 @@ class ExerciseLib break; case FILL_IN_BLANKS: // display the question, with field empty, for student to fill it, - // or filled to display the answer in the Question preview of the exercice/admin.php page + // or filled to display the answer in the Question preview of the exercise/admin.php page $displayForStudent = true; $listAnswerInformations = FillBlanks::getAnswerInfo($answer); $separatorStartRegexp = FillBlanks::escapeForRegexp($listAnswerInformations['blankseparatorstart']); @@ -574,7 +574,7 @@ class ExerciseLib $studentAnswerList = $arrayStudentAnswer['studentanswer']; } - // If the question must be shown with the answer (in page exercice/admin.php) for teacher preview + // If the question must be shown with the answer (in page exercise/admin.php) for teacher preview // set the student-answer to the correct answer if ($debug_mark_answer) { $studentAnswerList = $correctAnswerList; @@ -1461,7 +1461,7 @@ HOTSPOT; $result = array(); $apiIsAllowedToEdit = api_is_allowed_to_edit(); $urlBase = api_get_path(WEB_CODE_PATH) . - 'exercice/hotpotatoes_exercise_report.php?action=delete&' . + 'exercise/hotpotatoes_exercise_report.php?action=delete&' . api_get_cidreq() . '&id='; while ($data = Database::fetch_array($res)) { $actions = null; @@ -1987,7 +1987,7 @@ HOTSPOT; } else { $attempt_url = api_get_path( WEB_CODE_PATH - ) . 'exercice/result.php?' . api_get_cidreq() . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId; + ) . 'exercise/result.php?' . api_get_cidreq() . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId; $attempt_link = Display::url( get_lang('Show'), $attempt_url, diff --git a/main/inc/lib/javascript/hotspot/js/hotspot.js b/main/inc/lib/javascript/hotspot/js/hotspot.js index 96f85972b2..6375d964fd 100755 --- a/main/inc/lib/javascript/hotspot/js/hotspot.js +++ b/main/inc/lib/javascript/hotspot/js/hotspot.js @@ -1139,13 +1139,13 @@ window.HotspotQuestion = (function () { switch (config.for) { case 'admin': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript_admin.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_actionscript_admin.as.php', { modifyAnswers: parseInt(config.questionId) }); break; case 'user': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_actionscript.as.php', { modifyAnswers: parseInt(config.questionId), exe_id: parseInt(config.exerciseId) }); @@ -1154,7 +1154,7 @@ window.HotspotQuestion = (function () { case 'solution': //no break case 'preview': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_answers.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_answers.as.php', { modifyAnswers: parseInt(config.questionId), exe_id: parseInt(config.exerciseId) }); @@ -1763,13 +1763,13 @@ window.DelineationQuestion = (function () { switch (config.for) { case 'admin': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript_admin.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_actionscript_admin.as.php', { modifyAnswers: parseInt(config.questionId) }); break; case 'user': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_actionscript.as.php', { modifyAnswers: parseInt(config.questionId) }); break; @@ -1777,7 +1777,7 @@ window.DelineationQuestion = (function () { case 'solution': //no break case 'preview': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_answers.as.php', { + xhrQuestion = $.getJSON(config.relPath+'main/exercise/hotspot_answers.as.php', { modifyAnswers: parseInt(config.questionId), exe_id: parseInt(config.exerciseId) }); diff --git a/main/inc/lib/search/tool_processors/quiz_processor.class.php b/main/inc/lib/search/tool_processors/quiz_processor.class.php index 320de4e328..2f86b36f3f 100755 --- a/main/inc/lib/search/tool_processors/quiz_processor.class.php +++ b/main/inc/lib/search/tool_processors/quiz_processor.class.php @@ -70,7 +70,7 @@ class quiz_processor extends search_processor { $visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_QUIZ, $exercise_id); if ($visibility) { list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $exercise_id); - $url = api_get_path(WEB_PATH) . 'main/exercice/exercise_submit.php?cidReq=%s&exerciseId=%s'; + $url = api_get_path(WEB_CODE_PATH) . 'exercise/exercise_submit.php?cidReq=%s&exerciseId=%s'; $url = sprintf($url, $courseid, $exercise_id); $result = array( 'toolid' => TOOL_QUIZ, diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index b77bf6eb8c..6ab2544938 100755 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -959,7 +959,7 @@ class Tracking '; } else { $output .= '
'; } @@ -969,7 +969,7 @@ class Tracking ' . get_lang('ShowAndQualifyAttempt') . ''; } else { $output .= ''; } } @@ -4799,7 +4799,7 @@ class Tracking ); $html .= ''; - $url = api_get_path(WEB_CODE_PATH)."exercice/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; + $url = api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; if ($visible_return['value'] == true) { $exercices['title'] = Display::url( @@ -4858,7 +4858,7 @@ class Tracking $weighting = $exercise_stat['exe_weighting']; $exe_id = $exercise_stat['exe_id']; - $latest_attempt_url .= api_get_path(WEB_CODE_PATH).'exercice/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id; + $latest_attempt_url .= api_get_path(WEB_CODE_PATH) . 'exercise/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id; $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url); $my_score = 0; if (!empty($weighting) && intval($weighting) != 0) { @@ -6092,7 +6092,7 @@ class TrackingCourseLog break; case 'quiz': $table_name = TABLE_QUIZ_TEST; - $link_tool = 'exercice/exercice.php'; + $link_tool = 'exercise/exercise.php'; $id_tool = 'id'; break; case 'glossary': diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 76a0211e78..f99b587d07 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -79,7 +79,7 @@ class IndexManager if (!empty($exercise_list)) { $exercise_list = msort($exercise_list, 'tms'); $my_exercise = $exercise_list[0]; - $url = Display::url($my_exercise['title'], api_get_path(WEB_CODE_PATH).'exercice/overview.php?exerciseId='.$my_exercise['id'].'&cidReq='.$my_exercise['course_code'].'&id_session='.$my_exercise['session_id']); + $url = Display::url($my_exercise['title'], api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$my_exercise['id'].'&cidReq='.$my_exercise['course_code'].'&id_session='.$my_exercise['session_id']); $this->tpl->assign('exercise_url', $url); $this->tpl->assign('exercise_end_date', api_convert_and_format_date($my_exercise['end_time'], DATE_FORMAT_SHORT)); } diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index 2f1a75976a..63627beb4a 100755 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -1144,14 +1144,14 @@ if (!empty($student_id)) { if (Database :: num_rows($result_last_attempt) > 0) { $id_last_attempt = Database :: result($result_last_attempt, 0, 0); if ($count_attempts > 0) - echo ' + echo ' '.Display::return_icon('quiz.gif').' '; } echo ''; echo ''; diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 79b85df75f..44de3024ed 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -6304,7 +6304,7 @@ class learnpath $return .= $exercise->description.'
'; $return .= Display::url( get_lang('GoToExercise'), - api_get_path(WEB_CODE_PATH).'exercice/overview.php?'.api_get_cidreq().'&exerciseId='.$exercise->id, + api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . api_get_cidreq() . '&exerciseId=' . $exercise->id, ['class' => 'btn btn-primary'] ); } @@ -8895,7 +8895,7 @@ class learnpath $return .= '
  • '; $return .= Display::return_icon('new_test_small.gif'); - $return .= '' . + $return .= '' . get_lang('NewExercise') . ''; $return .= '
  • '; diff --git a/main/newscorm/lp_view.php b/main/newscorm/lp_view.php index 7ec6acd646..c74e579797 100755 --- a/main/newscorm/lp_view.php +++ b/main/newscorm/lp_view.php @@ -331,7 +331,7 @@ if ( if (intval($_GET['fb_type']) > 0) { $src = 'blank.php?msg=exerciseFinished'; } else { - $src = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?origin=learnpath&id=' . $safe_exe_id.'&'.api_get_cidreq(); + $src = api_get_path(WEB_CODE_PATH) . 'exercise/result.php?origin=learnpath&id=' . $safe_exe_id.'&'.api_get_cidreq(); if ($debug) { error_log('Calling URL: ' . $src); diff --git a/main/newscorm/resourcelinker.inc.php b/main/newscorm/resourcelinker.inc.php index 04617501fa..fb409c9744 100755 --- a/main/newscorm/resourcelinker.inc.php +++ b/main/newscorm/resourcelinker.inc.php @@ -23,7 +23,7 @@ if (!empty($_course['language'])){ require_once $resource_linker_file; } } -require_once '../exercice/hotpotatoes.lib.php'; +require_once '../exercise/hotpotatoes.lib.php'; /* FUNCTIONS */ @@ -244,13 +244,13 @@ function display_addedresource_link($type, $id, $style = '') $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); - echo ''.$myrow['title']."
    \n"; + echo ''.$myrow['title']."
    \n"; break; case 'Forum': $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); $myrow = Database::fetch_array($result); - echo ''.$myrow['forum_name']."
    \n"; + echo ''.$myrow['forum_name']."
    \n"; break; case 'Thread': //=topics //@deprecated bb_posts, bb_posts_text, bb_forums @@ -532,7 +532,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ } } } else { - echo "".shorten($myrow['title'], ($length-3*$level)).""; + echo "".shorten($myrow['title'], ($length-3*$level)).""; } break; @@ -583,7 +583,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ } } } else { - echo " ".shorten($name,($length-3*$level)).""; + echo " ".shorten($name,($length-3*$level)).""; } break; @@ -1115,7 +1115,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) if ($builder != 'builder') { $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; } else { - $link .= "../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; + $link .= "../exercise/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; } break; case 'HotPotatoes': @@ -1132,7 +1132,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) if ($builder != 'builder') { $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; } else { - $link .= "../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']; + $link .= "../exercise/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']; } break; case 'Forum': @@ -1548,13 +1548,13 @@ function rl_get_html_resource_link($course_code, $type, $id, $style='', $new_win $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); - $output = ''.$myrow['title']."
    \n"; + $output = ''.$myrow['title']."
    \n"; break; case TOOL_FORUM: $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); $myrow = Database::fetch_array($result); - $output = ''.$myrow['forum_name']."
    \n"; + $output = ''.$myrow['forum_name']."
    \n"; break; case TOOL_THREAD: //=topics //$tbl_forum = Database::get_course_table(TABLE_FORUM); @@ -1564,7 +1564,7 @@ function rl_get_html_resource_link($course_code, $type, $id, $style='', $new_win $sql_title = "SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=".$id; $result_title = Database::query($sql_title); $myrow_title = Database::fetch_array($result_title); - $output = ''.$myrow_title['post_title']."
    \n"; + $output = ''.$myrow_title['post_title']."
    \n"; break; case TOOL_POST: $tbl_post = Database::get_course_table(TABLE_FORUM_POST); @@ -1572,7 +1572,7 @@ function rl_get_html_resource_link($course_code, $type, $id, $style='', $new_win $sql = "SELECT * FROM $tbl_post p WHERE c_id = $course_id AND p.post_id = $id"; $result = Database::query($sql); $post = Database::fetch_array($result); - $output = ''.$post['post_title']."
    \n"; + $output = ''.$post['post_title']."
    \n"; break; case TOOL_DOCUMENT: $tbl_doc = Database::get_course_table(TABLE_DOCUMENT); @@ -1661,7 +1661,7 @@ function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_pa if ($row_item['title'] != '') { $myrow['title'] = $row_item['title']; } - $link .= $main_dir_path.'exercice/overview.php?cidReq='.$course_code.'&session_id='.$session_id.'&lp_init=1&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$id_in_path.'&exerciseId='.$id; + $link .= $main_dir_path . 'exercise/overview.php?cidReq='.$course_code.'&session_id='.$session_id.'&lp_init=1&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$id_in_path.'&exerciseId='.$id; } break; case 'hotpotatoes': //lowercase because of strtolower above @@ -1669,7 +1669,7 @@ function rl_get_resource_link_for_learnpath($course_id, $learnpath_id, $id_in_pa $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); $path = $myrow['path']; - $link .= $main_dir_path.'exercice/showinframes.php?file='.$path.'' . + $link .= $main_dir_path . 'exercise/showinframes.php?file='.$path.'' . '&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().'' . '&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$id_in_path.'&lp_view_id='.$lpViewId; break; diff --git a/main/newscorm/resourcelinker.php b/main/newscorm/resourcelinker.php index edf95e6bc4..190ab5a8a2 100755 --- a/main/newscorm/resourcelinker.php +++ b/main/newscorm/resourcelinker.php @@ -367,7 +367,7 @@ if ($_GET['source_id']) { unset ($from_learnpath); break; case '4': // coming from exercises: edit topic - $url = "../exercice/admin.php?modifyAnswers=$modifyAnswers"; + $url = "../exercise/admin.php?modifyAnswers=$modifyAnswers"; $originaltoolname = get_lang('ExerciseAnswers'); $breadcrumbelement = array ('url' => $url, 'name' => $originaltoolname); session_unregister('from_learnpath'); diff --git a/main/resourcelinker/resourcelinker.inc.php b/main/resourcelinker/resourcelinker.inc.php index 204a9fc66e..f4fa9f4bf0 100755 --- a/main/resourcelinker/resourcelinker.inc.php +++ b/main/resourcelinker/resourcelinker.inc.php @@ -17,7 +17,7 @@ use ChamiloSession as Session; * INIT SECTION */ -include(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'); +include(api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php'); /** * FUNCTIONS @@ -273,13 +273,13 @@ function display_addedresource_link($type, $id, $style='') $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); $myrow = Database::fetch_array($result); - echo ''.$myrow['title']."
    \n"; + echo ''.$myrow['title']."
    \n"; break; case 'Forum': $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); $myrow = Database::fetch_array($result); - echo ''.$myrow['forum_name']."
    \n"; + echo ''.$myrow['forum_name']."
    \n"; break; case 'Thread': //=topics //deprecated @@ -292,7 +292,7 @@ function display_addedresource_link($type, $id, $style='') $sql_title = "SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"]; $result_title = Database::query($sql_title); $myrow_title = Database::fetch_array($result_title); - echo ''.$myrow_title['post_title']."
    \n"; + echo ''.$myrow_title['post_title']."
    \n"; break; case 'Post': //deprecated @@ -572,7 +572,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ } else { - echo "".shorten($myrow["title"],($length-3*$level)).""; + echo "".shorten($myrow["title"],($length-3*$level)).""; } break; @@ -630,7 +630,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_ } else { - echo " ".shorten($name,($length-3*$level)).""; + echo " ".shorten($name,($length-3*$level)).""; } break; @@ -1203,7 +1203,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) } else { - $link .= "../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; + $link .= "../exercise/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; } break; @@ -1225,7 +1225,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path) } else { - $link .= "../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id'].""; + $link .= "../exercise/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id'].""; } break; diff --git a/main/resourcelinker/resourcelinker.php b/main/resourcelinker/resourcelinker.php index 0c7638ae53..d54eb26453 100755 --- a/main/resourcelinker/resourcelinker.php +++ b/main/resourcelinker/resourcelinker.php @@ -313,7 +313,7 @@ if ($_GET["source_id"]) unset ($from_learnpath); break; case "4" : // coming from exercises: edit topic - $url = "../exercice/admin.php?modifyAnswers=$modifyAnswers"; + $url = "../exercise/admin.php?modifyAnswers=$modifyAnswers"; $originaltoolname = get_lang("ExerciseAnswers"); $breadcrumbelement = array ("url" => $url, "name" => $originaltoolname); session_unregister('from_learnpath'); diff --git a/main/session/index.php b/main/session/index.php index 6b9a42065b..4e5c6190fb 100755 --- a/main/session/index.php +++ b/main/session/index.php @@ -332,7 +332,7 @@ foreach ($final_array as $session_data) { $exercise_info->exercise = Display::url( $exercise_info->exercise, - api_get_path(WEB_CODE_PATH)."exercice/result.php?cidReq=$my_course_code&id={$exercise_result['exe_id']}&id_session=$session_id&show_headers=1", + api_get_path(WEB_CODE_PATH) . "exercise/result.php?cidReq=$my_course_code&id={$exercise_result['exe_id']}&id_session=$session_id&show_headers=1", array('target'=>SESSION_LINK_TARGET,'class'=>'exercise-result-link') ); @@ -358,7 +358,7 @@ foreach ($final_array as $session_data) { } $exercise_info->exercise = Display::url( $exercise_info->exercise, - api_get_path(WEB_CODE_PATH)."exercice/overview.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id", + api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id", array('target'=>SESSION_LINK_TARGET) ); diff --git a/main/tracking/course_log_tools.php b/main/tracking/course_log_tools.php index 9663564acf..cf274f4e9c 100755 --- a/main/tracking/course_log_tools.php +++ b/main/tracking/course_log_tools.php @@ -250,7 +250,7 @@ if ($exerciseReporting) { $quiz_avg_score = round(($quiz_avg_score / $studentCount), 2).'%'; $url = api_get_path( WEB_CODE_PATH - ).'exercice/overview.php?exerciseId='.$quiz['id'].$course_path_params; + ) . 'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params; echo '
    ' . get_lang("Choice") . '' . get_lang("ExpectedChoice") . '' . get_lang("Answer") . '' . get_lang("Comment") . '
    - + ' . get_lang('ShowAttempt') . ' - + ' . get_lang('ShowAndQualifyAttempt') . '
    '; - $all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId"; + $all_attempt_url = "../exercise/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId"; echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url ); echo '
    '.Display::url( $quiz['title'], diff --git a/main/tracking/userLog.php b/main/tracking/userLog.php index b58baaef20..f6531d792b 100755 --- a/main/tracking/userLog.php +++ b/main/tracking/userLog.php @@ -26,7 +26,7 @@ $is_allowed = true; /* Libraries */ require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php'; -require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php'; +require_once api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php'; /* Header */ diff --git a/main/tracking/userlogCSV.php b/main/tracking/userlogCSV.php index a554aa6dd0..9adc6cafa6 100755 --- a/main/tracking/userlogCSV.php +++ b/main/tracking/userlogCSV.php @@ -27,7 +27,7 @@ $is_allowed = true; /* Libraries */ require_once api_get_path(SYS_CODE_PATH) . 'resourcelinker/resourcelinker.inc.php'; -require_once api_get_path(SYS_CODE_PATH) . 'exercice/hotpotatoes.lib.php'; +require_once api_get_path(SYS_CODE_PATH) . 'exercise/hotpotatoes.lib.php'; /* Header */ diff --git a/src/Chamilo/CourseBundle/Entity/CQuizRelQuestion.php b/src/Chamilo/CourseBundle/Entity/CQuizRelQuestion.php index d8de6fce34..021c6f4ab8 100644 --- a/src/Chamilo/CourseBundle/Entity/CQuizRelQuestion.php +++ b/src/Chamilo/CourseBundle/Entity/CQuizRelQuestion.php @@ -13,7 +13,7 @@ use Doctrine\ORM\Mapping as ORM; * indexes={ * @ORM\Index(name="course", columns={"c_id"}), * @ORM\Index(name="question", columns={"question_id"}), - * @ORM\Index(name="exercice", columns={"exercice_id"}) + * @ORM\Index(name="exercise", columns={"exercice_id"}) * } * ) * @ORM\Entity diff --git a/tests/main/exercice/answer.class.test.php b/tests/main/exercice/answer.class.test.php index c22e3ff5a6..e9939b0b2b 100755 --- a/tests/main/exercice/answer.class.test.php +++ b/tests/main/exercice/answer.class.test.php @@ -11,7 +11,7 @@ class TestAnswer extends UnitTestCase { public function setUp() { /* //Create a new exercise - require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php'; + require_once api_get_path(SYS_CODE_PATH).'exercise/exercise.class.php'; require_once api_get_path(SYS_CODE_PATH).'inc/lib/pear/HTML/QuickForm.php'; $this->aAnswer = new Answer(2); $this->aAnswer->read(); diff --git a/tests/main/exercice/exercise.lib.test.php b/tests/main/exercice/exercise.lib.test.php index 72291eba48..70658cb426 100755 --- a/tests/main/exercice/exercise.lib.test.php +++ b/tests/main/exercice/exercise.lib.test.php @@ -1,5 +1,5 @@ UnitTestCase('QTI2 library - main/exercice/export/qti2/qti2_classes.test.php'); + $this->UnitTestCase('QTI2 library - main/exercise/export/qti2/qti2_classes.test.php'); } public function setUp() { diff --git a/tests/main/exercice/export/scorm/scorm_classes.test.php b/tests/main/exercice/export/scorm/scorm_classes.test.php index 41332356fb..eae2ed516c 100755 --- a/tests/main/exercice/export/scorm/scorm_classes.test.php +++ b/tests/main/exercice/export/scorm/scorm_classes.test.php @@ -1,15 +1,15 @@ UnitTestCase('SCORM exercises export library - main/exercice/export/scorm/scorm_classes.test.php'); + $this->UnitTestCase('SCORM exercises export library - main/exercise/export/scorm/scorm_classes.test.php'); } public function setUp() { diff --git a/tests/main/exercice/hotpotatoes.lib.test.php b/tests/main/exercice/hotpotatoes.lib.test.php index 78e821c9b9..b8b6f93020 100755 --- a/tests/main/exercice/hotpotatoes.lib.test.php +++ b/tests/main/exercice/hotpotatoes.lib.test.php @@ -1,10 +1,10 @@ UnitTestCase('Hotpotatoes exercises library - main/exercice/hotpotatoes.lib.test.php'); + $this->UnitTestCase('Hotpotatoes exercises library - main/exercise/hotpotatoes.lib.test.php'); } function testCheckImageName() { @@ -18,7 +18,7 @@ class TestHotpotatoes extends UnitTestCase { } function testCheckSubFolder() { - $path='Location: /main/exercice/'; + $path='Location: /main/exercise/'; $res=CheckSubFolder($path); $this->assertTrue(is_numeric($res)); //var_dump($res); @@ -42,7 +42,7 @@ class TestHotpotatoes extends UnitTestCase { } function testGenerateHpFolder() { - $folder='main/exercice/hotpotatoes.lib.php'; + $folder='main/exercise/hotpotatoes.lib.php'; $res=GenerateHpFolder($folder); $this->assertTrue(is_string($res)); //var_dump($res); @@ -61,21 +61,21 @@ class TestHotpotatoes extends UnitTestCase { /* Deprecated function testGetFileName() { - $fname='main/exercice/hotpotatoes.lib.php'; + $fname='main/exercise/hotpotatoes.lib.php'; $res=GetFileName($fname); $this->assertTrue(is_string($res)); //var_dump($res); }*/ function testGetFolderName() { - $fname='main/exercice/hotpotatoes.lib.php'; + $fname='main/exercise/hotpotatoes.lib.php'; $res=GetFolderName($fname); $this->assertTrue(is_string($res)); //var_dump($res); } function testGetFolderPath() { - $fname='main/exercice/hotpotatoes.lib.php'; + $fname='main/exercise/hotpotatoes.lib.php'; $res=GetFolderPath($fname); $this->assertTrue(is_string($res)); //var_dump($res); @@ -101,7 +101,7 @@ class TestHotpotatoes extends UnitTestCase { function testGetQuizName() { $course_code = 'COURSETEST'; $fname='exercice_submit.php'; - $fpath='main/exercice/exercice_submit.php'; + $fpath='main/exercise/exercice_submit.php'; $res=GetQuizName($fname,$fpath); $this->assertTrue(is_string($res)); @@ -117,14 +117,14 @@ class TestHotpotatoes extends UnitTestCase { function testhotpotatoes_init() { $base = api_get_path(SYS_CODE_PATH); - $baseWorkDir=$base.'exercice/'; + $baseWorkDir=$base.'exercise/'; $res=hotpotatoes_init($baseWorkDir); $this->assertFalse($res); //var_dump($res); } function testHotPotGCt() { - $folder='/main/exercice'; + $folder='/main/exercise'; $flag=4; $userID=1; $res=HotPotGCt($folder,$flag,$userID); @@ -156,7 +156,7 @@ class TestHotpotatoes extends UnitTestCase { function testSetComment() { global $dbTable; - $path='/main/exercice'; + $path='/main/exercise'; $comment='testing this function'; $comment = Database::escape_string($comment); $query = "UPDATE $dbTable set comment='$comment' where path='$path'"; @@ -168,7 +168,7 @@ class TestHotpotatoes extends UnitTestCase { function testWriteFileCont() { $course_code = 'COURSETEST'; - $full_file_path='/main/exercice/'; + $full_file_path='/main/exercise/'; $content='test test test'; $res=WriteFileCont($full_file_path,$content); $this->assertTrue(is_bool($res)); diff --git a/tests/test_manager.inc.php b/tests/test_manager.inc.php index c45a696074..f7d9ffdf08 100755 --- a/tests/test_manager.inc.php +++ b/tests/test_manager.inc.php @@ -38,14 +38,14 @@ require_once $maindir.'permissions/permissions_functions.inc.php'; require_once $maindir.'dropbox/dropbox_class.inc.php'; require_once $maindir.'dropbox/dropbox_functions.inc.php'; require_once $maindir.'survey/survey.lib.php'; -require_once $maindir.'exercice/export/scorm/scorm_classes.php'; -require_once $maindir.'exercice/export/qti2/qti2_classes.php'; -require_once $maindir.'exercice/export/exercise_import.inc.php'; -require_once $maindir.'exercice/exercise_result.class.php'; -require_once $maindir.'exercice/answer.class.php'; -require_once $maindir.'exercice/exercise.class.php'; -require_once $maindir.'exercice/fill_blanks.class.php'; -require_once $maindir.'exercice/freeanswer.class.php'; +require_once $maindir.'exercise/export/scorm/scorm_classes.php'; +require_once $maindir.'exercise/export/qti2/qti2_classes.php'; +require_once $maindir.'exercise/export/exercise_import.inc.php'; +require_once $maindir.'exercise/exercise_result.class.php'; +require_once $maindir.'exercise/answer.class.php'; +require_once $maindir.'exercise/exercise.class.php'; +require_once $maindir.'exercise/fill_blanks.class.php'; +require_once $maindir.'exercise/freeanswer.class.php'; require_once $maindir.'forum/forumfunction.inc.php'; /* require_once $maindir.'gradebook/lib/be/gradebookitem.class.php'; diff --git a/tests/test_suite.php b/tests/test_suite.php index c2f371c6f4..ae7272fd62 100755 --- a/tests/test_suite.php +++ b/tests/test_suite.php @@ -118,7 +118,7 @@ class TestsSuite extends TestSuite { $this->addFile(api_get_path(SYS_TEST_PATH).'/main/auth/openid/xrds.lib.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/chat/chat_functions.lib.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/conference/get_translation.lib.test.php'); - $this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/hotpotatoes.lib.test.php'); + $this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/hotpotatoes.lib.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/newscorm/scorm.lib.test.php'); //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/survey/survey.lib.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/user/userInfoLib.test.php'); @@ -130,8 +130,8 @@ class TestsSuite extends TestSuite { //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/dropbox/dropbox_class.inc.test.php'); //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/dropbox/dropbox_functions.inc.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/search/search_suggestions.test.php'); - $this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/export/qti2/qti2_classes.test.php'); - $this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/export/scorm/scorm_classes.test.php'); + $this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/export/qti2/qti2_classes.test.php'); + $this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/export/scorm/scorm_classes.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/inc/lib/usermanager.lib.test.php'); $this->addFile(api_get_path(SYS_TEST_PATH).'/main/inc/lib/groupmanager.lib.test.php'); //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/inc/lib/image.lib.test.php'); @@ -147,20 +147,20 @@ class TestsSuite extends TestSuite { //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/inc/lib/xmd.lib.test.php'); // These files are not used and is not finished implement, not available to test - //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/export/qti/qti_classes.test.php'); - //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/export/qti2/qti2_export.test.php'); - //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/export/exercise_import.inc.test.php'); - //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/export/scorm/scorm_export.test.php'); + //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/export/qti/qti_classes.test.php'); + //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/export/qti2/qti2_export.test.php'); + //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/export/exercise_import.inc.test.php'); + //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/export/scorm/scorm_export.test.php'); // EXERCISES - //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/answer.class.test.php'); - //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/exercise_result.class.test.php'); + //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/answer.class.test.php'); + //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/exercise_result.class.test.php'); //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/inc/lib/exercise_show_functions.lib.test.php'); - //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/exercise.class.test.php'); + //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/exercise.class.test.php'); // This files have problem with class and call objects, is not available to test - //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/exercise.lib.test.php'); - //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/fill_blanks.class.test.php'); - //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercice/freeanswer.class.test.php'); + //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/exercise.lib.test.php'); + //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/fill_blanks.class.test.php'); + //$this->addFile(api_get_path(SYS_TEST_PATH).'/main/exercise/freeanswer.class.test.php'); // FORUM //$this->addFile(api_get_path(SYS_TEST_PATH).'main/forum/forumfunction.inc.test.php');