|
@@ -1890,7 +1890,7 @@ class Exercise
|
|
}
|
|
}
|
|
$class .= ' question-validate-btn'; // used to select it with jquery
|
|
$class .= ' question-validate-btn'; // used to select it with jquery
|
|
$all_button = ' <a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>';
|
|
$all_button = ' <a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>';
|
|
- $all_button .= ' <span id="save_all_reponse"></span>';
|
|
|
|
|
|
+ $all_button .= ' ' . Display::span(null, ['id' => 'save_all_reponse']);
|
|
$html .= $all_button;
|
|
$html .= $all_button;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2772,6 +2772,8 @@ class Exercise
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+ case DRAGGABLE:
|
|
|
|
+ //no break
|
|
case MATCHING:
|
|
case MATCHING:
|
|
if ($from_database) {
|
|
if ($from_database) {
|
|
$sql = 'SELECT id, answer, id_auto
|
|
$sql = 'SELECT id, answer, id_auto
|
|
@@ -2824,20 +2826,38 @@ class Exercise
|
|
if ($s_user_answer == $i_answer_correct_answer) {
|
|
if ($s_user_answer == $i_answer_correct_answer) {
|
|
$questionScore += $i_answerWeighting;
|
|
$questionScore += $i_answerWeighting;
|
|
$totalScore += $i_answerWeighting;
|
|
$totalScore += $i_answerWeighting;
|
|
- if (isset($real_list[$i_answer_id])) {
|
|
|
|
- $user_answer = '<span>'.$real_list[$i_answer_id].'</span>';
|
|
|
|
|
|
+ if ($answerType == DRAGGABLE) {
|
|
|
|
+ $user_answer = Display::label(get_lang('Correct'), 'success');
|
|
|
|
+ } else {
|
|
|
|
+ if (isset($real_list[$i_answer_id])) {
|
|
|
|
+ $user_answer = Display::span($real_list[$i_answer_id]);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- $user_answer = '<span style="color: #FF0000; text-decoration: line-through;">'.$real_list[$s_user_answer].'</span>';
|
|
|
|
|
|
+ if ($answerType == DRAGGABLE) {
|
|
|
|
+ $user_answer = Display::label(get_lang('NotCorrect'), 'danger');
|
|
|
|
+ } else {
|
|
|
|
+ $user_answer = Display::span(
|
|
|
|
+ $real_list[$s_user_answer],
|
|
|
|
+ ['style' => 'color: #FF0000; text-decoration: line-through;']
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } elseif ($answerType == DRAGGABLE) {
|
|
|
|
+ $user_answer = Display::label(get_lang('Incorrect'), 'danger');
|
|
}
|
|
}
|
|
|
|
|
|
if ($show_result) {
|
|
if ($show_result) {
|
|
echo '<tr>';
|
|
echo '<tr>';
|
|
- echo '<td>'.$s_answer_label.'</td>';
|
|
|
|
- echo '<td>'.$user_answer;
|
|
|
|
- if (isset($real_list[$i_answer_correct_answer])) {
|
|
|
|
- echo ' <b><span style="color: #008000;">'.$real_list[$i_answer_correct_answer].'</span></b> ';
|
|
|
|
|
|
+ echo '<td>' . $s_answer_label . '</td>';
|
|
|
|
+ echo '<td>' . $user_answer;
|
|
|
|
+ if ($answerType == MATCHING) {
|
|
|
|
+ if (isset($real_list[$i_answer_correct_answer])) {
|
|
|
|
+ echo Display::span(
|
|
|
|
+ $real_list[$i_answer_correct_answer],
|
|
|
|
+ ['style' => 'color: #008000; font-weight: bold;']
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|
|
echo '</td>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
echo '</tr>';
|
|
@@ -2850,10 +2870,13 @@ class Exercise
|
|
$questionScore += $answerWeighting;
|
|
$questionScore += $answerWeighting;
|
|
$totalScore += $answerWeighting;
|
|
$totalScore += $answerWeighting;
|
|
|
|
|
|
- $user_answer = '<span>'.$answerMatching[$choice[$answerAutoId]].'</span>';
|
|
|
|
|
|
+ $user_answer = Display::span($answerMatching[$choice[$answerAutoId]]);
|
|
} else {
|
|
} else {
|
|
if (isset($answerMatching[$choice[$answerAutoId]])) {
|
|
if (isset($answerMatching[$choice[$answerAutoId]])) {
|
|
- $user_answer = '<span style="color: #FF0000; text-decoration: line-through;">'.$answerMatching[$choice[$answerAutoId]].'</span>';
|
|
|
|
|
|
+ $user_answer = Display::span(
|
|
|
|
+ $answerMatching[$choice[$answerAutoId]],
|
|
|
|
+ ['style' => 'color: #FF0000; text-decoration: line-through;']
|
|
|
|
+ );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$matching[$answerAutoId] = $choice[$answerAutoId];
|
|
$matching[$answerAutoId] = $choice[$answerAutoId];
|
|
@@ -2951,7 +2974,13 @@ class Exercise
|
|
if ($from == 'exercise_result') {
|
|
if ($from == 'exercise_result') {
|
|
if ($debug) error_log('Showing questions $from '.$from);
|
|
if ($debug) error_log('Showing questions $from '.$from);
|
|
//display answers (if not matching type, or if the answer is correct)
|
|
//display answers (if not matching type, or if the answer is correct)
|
|
- if ($answerType != MATCHING || $answerCorrect) {
|
|
|
|
|
|
+ if (
|
|
|
|
+ !in_array(
|
|
|
|
+ $answerType,
|
|
|
|
+ [MATCHING, DRAGGABLE]
|
|
|
|
+ ) ||
|
|
|
|
+ $answerCorrect
|
|
|
|
+ ) {
|
|
if (
|
|
if (
|
|
in_array(
|
|
in_array(
|
|
$answerType,
|
|
$answerType,
|
|
@@ -3218,10 +3247,15 @@ class Exercise
|
|
}
|
|
}
|
|
} elseif($answerType == MATCHING) {
|
|
} elseif($answerType == MATCHING) {
|
|
echo '<tr>';
|
|
echo '<tr>';
|
|
- echo '<td>' . $answerMatching[$answerId] . '</td>';
|
|
|
|
- echo '<td>' . $user_answer . ' / <b>'
|
|
|
|
- . '<span style="color: #008000;">' . $answerMatching[$answerCorrect] . '</span>'
|
|
|
|
- . '</b></td>';
|
|
|
|
|
|
+ echo Display::tag('td', $answerMatching[$answerId]);
|
|
|
|
+ echo Display::tag(
|
|
|
|
+ 'td',
|
|
|
|
+ "$user_answer / " . Display::tag(
|
|
|
|
+ 'strong',
|
|
|
|
+ $answerMatching[$answerCorrect],
|
|
|
|
+ ['style' => 'color: #008000; font-weight: bold;']
|
|
|
|
+ )
|
|
|
|
+ );
|
|
echo '</tr>';
|
|
echo '</tr>';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -3535,12 +3569,19 @@ class Exercise
|
|
$answerComment
|
|
$answerComment
|
|
);
|
|
);
|
|
break;
|
|
break;
|
|
|
|
+ case DRAGGABLE:
|
|
|
|
+ //no break
|
|
case MATCHING:
|
|
case MATCHING:
|
|
echo '<tr>';
|
|
echo '<tr>';
|
|
- echo '<td>' . $answerMatching[$answerId] . '</td>';
|
|
|
|
- echo '<td>' . $user_answer . ' / <b>'
|
|
|
|
- . '<span style="color: #008000;">' . $answerMatching[$answerCorrect] . '</span></b>'
|
|
|
|
- . '</td>';
|
|
|
|
|
|
+ echo Display::tag('td', $answerMatching[$answerId]);
|
|
|
|
+ echo Display::tag(
|
|
|
|
+ 'td',
|
|
|
|
+ "$user_answer / " . Display::tag(
|
|
|
|
+ 'strong',
|
|
|
|
+ $answerMatching[$answerCorrect],
|
|
|
|
+ ['style' => 'color: #008000; font-weight: bold;']
|
|
|
|
+ )
|
|
|
|
+ );
|
|
echo '</tr>';
|
|
echo '</tr>';
|
|
|
|
|
|
break;
|
|
break;
|
|
@@ -3842,7 +3883,7 @@ class Exercise
|
|
} else {
|
|
} else {
|
|
Event::saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
|
|
Event::saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
|
|
}
|
|
}
|
|
- } elseif ($answerType == MATCHING) {
|
|
|
|
|
|
+ } elseif (in_array($answerType, [MATCHING, DRAGGABLE])) {
|
|
if (isset($matching)) {
|
|
if (isset($matching)) {
|
|
foreach ($matching as $j => $val) {
|
|
foreach ($matching as $j => $val) {
|
|
Event::saveQuestionAttempt($questionScore, $val, $quesId, $exeId, $j, $this->id);
|
|
Event::saveQuestionAttempt($questionScore, $val, $quesId, $exeId, $j, $this->id);
|