Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/6061/head
Yannick Warnier 7 months ago
commit 82f4ca6a96
  1. 36
      main/exercise/exercise.class.php
  2. 2
      main/exercise/exercise_show.php
  3. 6
      main/inc/lib/exercise.lib.php
  4. 18
      main/inc/lib/exercise_show_functions.lib.php

@ -3872,8 +3872,8 @@ class Exercise
if ($answerType == MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY) {
$choiceTmp = $choice;
$choice = isset($choiceTmp['choice']) ? $choiceTmp['choice'] : '';
$choiceDegreeCertainty = isset($choiceTmp['choiceDegreeCertainty']) ? $choiceTmp['choiceDegreeCertainty'] : '';
$choice = $choiceTmp['choice'] ?? '';
$choiceDegreeCertainty = $choiceTmp['choiceDegreeCertainty'] ?? '';
}
if ($answerType == FREE_ANSWER ||
@ -3888,12 +3888,12 @@ class Exercise
$generatedFile = '';
if ($answerType == ORAL_EXPRESSION) {
$exe_info = Event::get_exercise_results_by_attempt($exeId);
$exe_info = isset($exe_info[$exeId]) ? $exe_info[$exeId] : null;
$exe_info = $exe_info[$exeId] ?? null;
$objQuestionTmp->initFile(
api_get_session_id(),
isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id(),
isset($exe_info['exe_exo_id']) ? $exe_info['exe_exo_id'] : $this->iid,
isset($exe_info['exe_id']) ? $exe_info['exe_id'] : $exeId
$exe_info['exe_user_id'] ?? api_get_user_id(),
$exe_info['exe_exo_id'] ?? $this->iid,
$exe_info['exe_id'] ?? $exeId
);
// Probably this attempt came in an exercise all question by page
@ -4068,7 +4068,7 @@ class Exercise
$userAnsweredQuestion = !empty($choice);
}
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
$studentChoice = $choice[$answerAutoId] ?? null;
if (isset($studentChoice)) {
$correctAnswerId[] = $answerAutoId;
if ($studentChoice == $answerCorrect) {
@ -4110,8 +4110,8 @@ class Exercise
}
}
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
$studentChoiceDegree = isset($choiceDegreeCertainty[$answerAutoId]) ? $choiceDegreeCertainty[$answerAutoId] : null;
$studentChoice = $choice[$answerAutoId] ?? null;
$studentChoiceDegree = $choiceDegreeCertainty[$answerAutoId] ?? null;
// student score update
if (!empty($studentChoice)) {
@ -4150,14 +4150,14 @@ class Exercise
$choice[$row['answer']] = 1;
}
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
$studentChoice = $choice[$answerAutoId] ?? null;
$real_answers[$answerId] = (bool) $studentChoice;
if ($studentChoice) {
$questionScore += $answerWeighting;
}
} else {
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
$studentChoice = $choice[$answerAutoId] ?? null;
$real_answers[$answerId] = (bool) $studentChoice;
if (isset($studentChoice)
@ -4178,13 +4178,13 @@ class Exercise
while ($row = Database::fetch_array($resultans)) {
$choice[$row['answer']] = 1;
}
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
$studentChoice = $choice[$answerAutoId] ?? null;
$real_answers[$answerId] = (bool) $studentChoice;
if ($studentChoice) {
$questionScore += $answerWeighting;
}
} else {
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
$studentChoice = $choice[$answerAutoId] ?? null;
if (isset($studentChoice)) {
$questionScore += $answerWeighting;
}
@ -4209,13 +4209,13 @@ class Exercise
$choice[$my_answer_id] = $option;
}
}
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : '';
$studentChoice = $choice[$answerAutoId] ?? '';
$real_answers[$answerId] = false;
if ($answerCorrect == $studentChoice) {
$real_answers[$answerId] = true;
}
} else {
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : '';
$studentChoice = $choice[$answerAutoId] ?? '';
$real_answers[$answerId] = false;
if ($answerCorrect == $studentChoice) {
$real_answers[$answerId] = true;
@ -4232,7 +4232,7 @@ class Exercise
$choice[$row['answer']] = 1;
}
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
$studentChoice = $choice[$answerAutoId] ?? null;
if (1 == $answerCorrect) {
$real_answers[$answerId] = false;
if ($studentChoice) {
@ -4245,7 +4245,7 @@ class Exercise
}
}
} else {
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
$studentChoice = $choice[$answerAutoId] ?? null;
if (1 == $answerCorrect) {
$real_answers[$answerId] = false;
if ($studentChoice) {
@ -5745,7 +5745,7 @@ class Exercise
break;
case ORAL_EXPRESSION:
echo '<tr>
<td valign="top">'.
<td>'.
ExerciseShowFunctions::display_oral_expression_answer(
$feedback_type,
$choice,

@ -416,7 +416,7 @@ if ($allowRecordAudio && $allowTeacherCommentAudio) {
}
foreach ($questionList as $questionId) {
$choice = isset($exerciseResult[$questionId]) ? $exerciseResult[$questionId] : '';
$choice = $exerciseResult[$questionId] ?? '';
// destruction of the Question object
unset($objQuestionTmp);
$questionWeighting = 0;

@ -5399,7 +5399,7 @@ EOT;
$exerciseResult = Session::read('exerciseResult');
$exerciseResultCoordinates = Session::read('exerciseResultCoordinates');
$delineationResults = Session::read('hotspot_delineation_result');
$delineationResults = isset($delineationResults[$objExercise->iid]) ? $delineationResults[$objExercise->iid] : null;
$delineationResults = $delineationResults[$objExercise->iid] ?? null;
}
$countPendingQuestions = 0;
@ -5414,8 +5414,8 @@ EOT;
$choice = null;
$delineationChoice = null;
if ($loadChoiceFromSession) {
$choice = isset($exerciseResult[$questionId]) ? $exerciseResult[$questionId] : null;
$delineationChoice = isset($delineationResults[$questionId]) ? $delineationResults[$questionId] : null;
$choice = $exerciseResult[$questionId] ?? null;
$delineationChoice = $delineationResults[$questionId] ?? null;
}
// We're inside *one* question. Go through each possible answer for this question

@ -221,13 +221,19 @@ class ExerciseShowFunctions
echo '<tr><td>&nbsp;</td></tr>';
}
} else {
echo '<tr>';
echo '<td>';
if (!empty($answer)) {
echo Security::remove_XSS($answer);
$text = '';
if (is_array($answer) && !empty($answer['answer'])) {
$text = $answer['answer'];
} elseif (!is_array($answer)) {
$text = $answer;
}
if (!empty($text)) {
echo '<tr><td>';
echo Security::remove_XSS($text);
echo '</td></tr>';
}
echo '</td>';
echo '</tr>';
}
}

Loading…
Cancel
Save