diff --git a/public/main/exercise/admin.php b/public/main/exercise/admin.php
index f9f22f11a2..d07af1e369 100644
--- a/public/main/exercise/admin.php
+++ b/public/main/exercise/admin.php
@@ -275,7 +275,7 @@ if ('thisExercise' === $modifyIn) {
}
}
-$htmlHeadXtra[] = api_get_build_js('exercise.js');
+$htmlHeadXtra[] = api_get_build_js('legacy_exercise.js');
$template = new Template();
$templateName = $template->get_template('exercise/submit.js.tpl');
diff --git a/public/main/exercise/exercise_reminder.php b/public/main/exercise/exercise_reminder.php
index c30d4e03b8..75acf5f405 100644
--- a/public/main/exercise/exercise_reminder.php
+++ b/public/main/exercise/exercise_reminder.php
@@ -58,7 +58,7 @@ if ($time_control) {
$htmlHeadXtra[] = $objExercise->showTimeControlJS($time_left);
}
-$htmlHeadXtra[] = api_get_build_js('exercise.js');
+$htmlHeadXtra[] = api_get_build_js('legacy_exercise.js');
$htmlHeadXtra[] = api_get_css_asset('pretty-checkbox/dist/pretty-checkbox.min.css');
$exe_id = 0;
diff --git a/public/main/exercise/exercise_submit.php b/public/main/exercise/exercise_submit.php
index aa78d64744..675ccee9b5 100644
--- a/public/main/exercise/exercise_submit.php
+++ b/public/main/exercise/exercise_submit.php
@@ -68,7 +68,7 @@ if ($showGlossary) {
//$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
//$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
//$htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
-$htmlHeadXtra[] = api_get_build_js('exercise.js');
+$htmlHeadXtra[] = api_get_build_js('legacy_exercise.js');
$htmlHeadXtra[] = '';
//$htmlHeadXtra[] = '';
if ('true' === api_get_setting('exercise.quiz_prevent_copy_paste')) {
diff --git a/public/main/exercise/multiple_answer.class.php b/public/main/exercise/multiple_answer.class.php
index b68ce19c63..467fdef447 100644
--- a/public/main/exercise/multiple_answer.class.php
+++ b/public/main/exercise/multiple_answer.class.php
@@ -75,10 +75,10 @@ class MultipleAnswer extends Question
for ($i = 1; $i <= $nb_answers; $i++) {
$form->addHtml('
');
if (is_object($answer)) {
- $defaults['answer['.$i.']'] = $answer->answer[$i];
- $defaults['comment['.$i.']'] = $answer->comment[$i];
- $defaults['weighting['.$i.']'] = float_format($answer->weighting[$i], 1);
- $defaults['correct['.$i.']'] = $answer->correct[$i];
+ $defaults['answer['.$i.']'] = $answer->answer[$i] ?? '';
+ $defaults['comment['.$i.']'] = $answer->comment[$i] ?? '';
+ $defaults['weighting['.$i.']'] = isset($answer->weighting[$i]) ? float_format($answer->weighting[$i], 1) : 0;
+ $defaults['correct['.$i.']'] = $answer->correct[$i] ?? '';
} else {
$defaults['answer[1]'] = get_lang('Lack of Vitamin A');
$defaults['comment[1]'] = get_lang('The Vitamin A is responsible for...');
diff --git a/public/main/exercise/oral_expression.class.php b/public/main/exercise/oral_expression.class.php
index bcba571a08..03943b80f1 100644
--- a/public/main/exercise/oral_expression.class.php
+++ b/public/main/exercise/oral_expression.class.php
@@ -97,8 +97,11 @@ class OralExpression extends Question
$variable = 'oral_expression_asset_'.$attempt->getQuestionId();
+ $asset = null;
$assetId = ChamiloSession::read($variable);
- $asset = Container::getAssetRepository()->find(Uuid::fromRfc4122($assetId));
+ if (!empty($assetId)) {
+ $asset = Container::getAssetRepository()->find(Uuid::fromRfc4122($assetId));
+ }
if (null === $asset) {
return;
diff --git a/public/main/exercise/question_admin.inc.php b/public/main/exercise/question_admin.inc.php
index 01845bda3b..467dd68210 100644
--- a/public/main/exercise/question_admin.inc.php
+++ b/public/main/exercise/question_admin.inc.php
@@ -75,8 +75,8 @@ if (is_object($objQuestion)) {
} else {
// New question
$page = 1;
- $length = api_get_setting('exercise.question_pagination_length');
- if (!empty($length)) {
+ $length = (int) api_get_setting('exercise.question_pagination_length');
+ if ($length > 0) {
$page = round($objExercise->getQuestionCount() / $length);
}
Display::addFlash(Display::return_message(get_lang('Item added')));
diff --git a/public/main/exercise/result.php b/public/main/exercise/result.php
index d20b7bac60..ec5a6317cf 100644
--- a/public/main/exercise/result.php
+++ b/public/main/exercise/result.php
@@ -68,7 +68,7 @@ if ($student_id === $current_user_id && ExerciseSignaturePlugin::exerciseHasSign
}
$htmlHeadXtra[] = '';
-$htmlHeadXtra[] = api_get_build_js('exercise.js');
+$htmlHeadXtra[] = api_get_build_js('legacy_exercise.js');
if ($show_headers) {
$interbreadcrumb[] = [
diff --git a/public/main/inc/lib/exercise.lib.php b/public/main/inc/lib/exercise.lib.php
index 08a006c39a..e054dacf22 100644
--- a/public/main/inc/lib/exercise.lib.php
+++ b/public/main/inc/lib/exercise.lib.php
@@ -5169,12 +5169,14 @@ EOT;
$additionalActions = api_get_setting('exercise.exercise_additional_teacher_modify_actions', true) ?: [];
$actions = [];
- foreach ($additionalActions as $additionalAction) {
- $actions[] = call_user_func(
- $additionalAction,
- $exerciseId,
- $iconSize
- );
+ if (is_array($additionalActions)) {
+ foreach ($additionalActions as $additionalAction) {
+ $actions[] = call_user_func(
+ $additionalAction,
+ $exerciseId,
+ $iconSize
+ );
+ }
}
return implode(PHP_EOL, $actions);
diff --git a/src/CourseBundle/Entity/CQuiz.php b/src/CourseBundle/Entity/CQuiz.php
index 387f7cf084..48b075f213 100644
--- a/src/CourseBundle/Entity/CQuiz.php
+++ b/src/CourseBundle/Entity/CQuiz.php
@@ -171,6 +171,7 @@ class CQuiz extends AbstractResource implements ResourceInterface, ResourceShowC
$this->reviewAnswers = 0;
$this->randomByCategory = 0;
$this->displayCategoryName = 0;
+ $this->hideAttemptsTable = false;
$this->pageResultConfiguration = [];
$this->attempts = new ArrayCollection();
}