diff --git a/assets/css/app.scss b/assets/css/app.scss index 1f8b07888e..cde8c87b19 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -466,6 +466,35 @@ table#skill_holder { color: rgb(46 117 163 / var(--tw-text-opacity)); } +.question_description img, .question_options img { + display: inherit !important; +} + +.question_options .droppable { + padding: 5px; + text-align: center; + background-color: #ECF0F1; + border: dotted #dddddd 2px; + border-radius: 4px; + color: #666666; + display: inline-block; + width: 85%; + margin-bottom: 0; +} + +.question_options .droppable-item { + background-color: #84bd00; + color: #FFF; + padding: 3px 0 3px 5px; + width: 20%; +} + +.question_options .droppable-item .number { + font-size: 16px; + font-weight: bold; + display: inline-block; +} + /* **************************************************** END SKILL **************************************************** */ diff --git a/public/main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php b/public/main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php index f8a978c3d6..9b7102a121 100644 --- a/public/main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php +++ b/public/main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php @@ -141,8 +141,10 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question foreach ($optionData as $id => $data) { $rdoCorrect = $form->addElement('radio', 'correct['.$i.']', null, null, $id); - if (isset($_POST['correct']) && isset($_POST['correct'][$i]) && $id == $_POST['correct'][$i]) { + if (isset($_POST['correct']) && isset($_POST['correct'][$i]) && $j == $_POST['correct'][$i]) { $rdoCorrect->setValue(Security::remove_XSS($_POST['correct'][$i])); + } else { + $rdoCorrect->setValue($j); } $j++; if (3 == $j) { @@ -246,9 +248,9 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question $question = $repo->find($this->id); $options = $question->getOptions(); - if (!empty($options)) { + if (!$options->isEmpty()) { foreach ($options as $optionData) { - $optionData->setName($optionData); + $optionData->setName($optionData->getName()); } } else { for ($i = 1; $i <= 8; $i++) { diff --git a/public/main/exercise/exercise.class.php b/public/main/exercise/exercise.class.php index 35838f6eb1..c59b90d7af 100644 --- a/public/main/exercise/exercise.class.php +++ b/public/main/exercise/exercise.class.php @@ -3763,7 +3763,7 @@ class Exercise } } else { // false answer and student is Unsure or PrettySur - if ($quiz_question_options[$studentChoiceDegree]['position'] >= 3 + if (isset($quiz_question_options[$studentChoiceDegree]) && $quiz_question_options[$studentChoiceDegree]['position'] >= 3 && $quiz_question_options[$studentChoiceDegree]['position'] < 9) { $questionScore += $false_score; } else { diff --git a/public/main/exercise/multiple_answer_true_false.class.php b/public/main/exercise/multiple_answer_true_false.class.php index b3d7bd0e7a..9b20dfe14f 100644 --- a/public/main/exercise/multiple_answer_true_false.class.php +++ b/public/main/exercise/multiple_answer_true_false.class.php @@ -118,8 +118,10 @@ class MultipleAnswerTrueFalse extends Question foreach ($optionData as $id => $data) { $rdoCorrect = $form->addElement('radio', 'correct['.$i.']', null, null, $id); - if (isset($_POST['correct']) && isset($_POST['correct'][$i]) && $id == $_POST['correct'][$i]) { + if (isset($_POST['correct']) && isset($_POST['correct'][$i]) && $j == $_POST['correct'][$i]) { $rdoCorrect->setValue(Security::remove_XSS($_POST['correct'][$i])); + } else { + $rdoCorrect->setValue($j); } $j++; if (3 == $j) { @@ -251,9 +253,9 @@ class MultipleAnswerTrueFalse extends Question $options = $question->getOptions(); $em = Database::getManager(); - if (!empty($options)) { + if (!$options->isEmpty()) { foreach ($options as $optionData) { - $optionData->setName($optionData); + $optionData->setName($optionData->getName()); } } else { for ($i = 1; $i <= 3; $i++) { diff --git a/public/main/inc/lib/exercise.lib.php b/public/main/inc/lib/exercise.lib.php index c63a77dd83..808b227f7a 100644 --- a/public/main/inc/lib/exercise.lib.php +++ b/public/main/inc/lib/exercise.lib.php @@ -632,6 +632,7 @@ class ExerciseLib $s .= Display::tag('td', $answer); if (!empty($quizQuestionOptions)) { + $j = 1; foreach ($quizQuestionOptions as $id => $item) { if (isset($myChoice[$numAnswer]) && $id == $myChoice[$numAnswer]) { $attributes = [ @@ -643,7 +644,7 @@ class ExerciseLib } if ($debug_mark_answer) { - if ($id == $answerCorrect) { + if ($j == $answerCorrect) { $attributes['checked'] = 1; $attributes['selected'] = 1; } @@ -658,6 +659,7 @@ class ExerciseLib ), ['style' => ''] ); + $j++; } } @@ -686,6 +688,7 @@ class ExerciseLib $s .= Display::tag('td', $answer); if (!empty($quizQuestionOptions)) { + $j = 1; foreach ($quizQuestionOptions as $id => $item) { if (isset($myChoice[$numAnswer]) && $id == $myChoice[$numAnswer]) { $attributes = ['checked' => 1, 'selected' => 1]; @@ -706,7 +709,7 @@ class ExerciseLib $attributes1['onChange'] = 'RadioValidator('.$questionId.', '.$numAnswer.')'; if ($debug_mark_answer) { - if ($id == $answerCorrect) { + if ($j == $answerCorrect) { $attributes['checked'] = 1; $attributes['selected'] = 1; } @@ -739,6 +742,7 @@ class ExerciseLib ] ); } + $j++; } }