@@ 2091-2112 (lines=22) @@ | ||
2088 | } |
|
2089 | ||
2090 | // Fix correct answers |
|
2091 | if (in_array($question->quiz_type, [DRAGGABLE, MATCHING, MATCHING_DRAGGABLE])) { |
|
2092 | $onlyAnswersFlip = array_flip($onlyAnswers); |
|
2093 | foreach ($correctAnswers as $answer_id => $correct_answer) { |
|
2094 | $params = array(); |
|
2095 | if (isset($allAnswers[$correct_answer]) && |
|
2096 | isset($onlyAnswersFlip[$allAnswers[$correct_answer]]) |
|
2097 | ) { |
|
2098 | $params['correct'] = $onlyAnswersFlip[$allAnswers[$correct_answer]]; |
|
2099 | Database::update( |
|
2100 | $table_ans, |
|
2101 | $params, |
|
2102 | array( |
|
2103 | 'id = ? AND c_id = ? AND question_id = ? ' => array( |
|
2104 | $answer_id, |
|
2105 | $this->destination_course_id, |
|
2106 | $new_id, |
|
2107 | ), |
|
2108 | ) |
|
2109 | ); |
|
2110 | } |
|
2111 | } |
|
2112 | } |
|
2113 | ||
2114 | $this->course->resources[RESOURCE_QUIZQUESTION][$id]->destination_id = $new_id; |
|
2115 | } |
@@ 908-929 (lines=22) @@ | ||
905 | } |
|
906 | ||
907 | // Fix correct answers |
|
908 | if (in_array($newQuestion->type, [DRAGGABLE, MATCHING, MATCHING_DRAGGABLE])) { |
|
909 | $onlyAnswersFlip = array_flip($onlyAnswers); |
|
910 | foreach ($correctAnswers as $answer_id => $correct_answer) { |
|
911 | $params = array(); |
|
912 | if (isset($allAnswers[$correct_answer]) && |
|
913 | isset($onlyAnswersFlip[$allAnswers[$correct_answer]]) |
|
914 | ) { |
|
915 | $params['correct'] = $onlyAnswersFlip[$allAnswers[$correct_answer]]; |
|
916 | Database::update( |
|
917 | $tableAnswer, |
|
918 | $params, |
|
919 | array( |
|
920 | 'id = ? AND c_id = ? AND question_id = ? ' => array( |
|
921 | $answer_id, |
|
922 | $courseId, |
|
923 | $newQuestionId, |
|
924 | ), |
|
925 | ) |
|
926 | ); |
|
927 | } |
|
928 | } |
|
929 | } |
|
930 | } |
|
931 | } |
|
932 |