Code Duplication    Length = 15-15 lines in 2 locations

main/exercice/exercise.class.php 2 locations

@@ 3583-3597 (lines=15) @@
3580
                            if (!$switchable_answer_set) {
3581
                                // Needed to parse ' and " characters
3582
                                $user_tags[$i] = stripslashes($user_tags[$i]);
3583
                                if ($correct_tags[$i] == $user_tags[$i]) {
3584
                                    // gives the related weighting to the student
3585
                                    $questionScore += $answerWeighting[$i];
3586
                                    // increments total score
3587
                                    $totalScore += $answerWeighting[$i];
3588
                                    // adds the word in green at the end of the string
3589
                                    $answer .= $correct_tags[$i];
3590
                                } elseif (!empty($user_tags[$i])) {
3591
                                    // else if the word entered by the student IS NOT the same as the one defined by the professor
3592
                                    // adds the word in red at the end of the string, and strikes it
3593
                                    $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>';
3594
                                } else {
3595
                                    // adds a tabulation if no word has been typed by the student
3596
                                    $answer .= ''; // remove &nbsp; that causes issue
3597
                                }
3598
                            } else {
3599
                                // switchable fill in the blanks
3600
                                if (in_array($user_tags[$i], $correct_tags)) {
@@ 3803-3817 (lines=15) @@
3800
                        }
3801
                        // Needed to parse ' and " characters
3802
                        $userTags[$i] = stripslashes($userTags[$i]);
3803
                        if ($correctTags[$i] == $userTags[$i]) {
3804
                            // gives the related weighting to the student
3805
                            $questionScore += $answerWeighting[$i];
3806
                            // increments total score
3807
                            $totalScore += $answerWeighting[$i];
3808
                            // adds the word in green at the end of the string
3809
                            $answer .= $correctTags[$i];
3810
                        } elseif (!empty($userTags[$i])) {
3811
                            // else if the word entered by the student IS NOT the same as the one defined by the professor
3812
                            // adds the word in red at the end of the string, and strikes it
3813
                            $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>';
3814
                        } else {
3815
                            // adds a tabulation if no word has been typed by the student
3816
                            $answer .= ''; // remove &nbsp; that causes issue
3817
                        }
3818
                        // adds the correct word, followed by ] to close the blank
3819
                        $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>]';
3820
                        if (isset($realText[$i +1])) {