Code Duplication    Length = 15-15 lines in 2 locations

main/exercice/exercise.class.php 2 locations

@@ 3611-3625 (lines=15) @@
3608
                            if (!$switchable_answer_set) {
3609
                                // Needed to parse ' and " characters
3610
                                $user_tags[$i] = stripslashes($user_tags[$i]);
3611
                                if ($correct_tags[$i] == $user_tags[$i]) {
3612
                                    // gives the related weighting to the student
3613
                                    $questionScore += $answerWeighting[$i];
3614
                                    // increments total score
3615
                                    $totalScore += $answerWeighting[$i];
3616
                                    // adds the word in green at the end of the string
3617
                                    $answer .= $correct_tags[$i];
3618
                                } elseif (!empty($user_tags[$i])) {
3619
                                    // else if the word entered by the student IS NOT the same as the one defined by the professor
3620
                                    // adds the word in red at the end of the string, and strikes it
3621
                                    $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>';
3622
                                } else {
3623
                                    // adds a tabulation if no word has been typed by the student
3624
                                    $answer .= ''; // remove &nbsp; that causes issue
3625
                                }
3626
                            } else {
3627
                                // switchable fill in the blanks
3628
                                if (in_array($user_tags[$i], $correct_tags)) {
@@ 3842-3856 (lines=15) @@
3839
                        }
3840
                        // Needed to parse ' and " characters
3841
                        $userTags[$i] = stripslashes($userTags[$i]);
3842
                        if ($correctTags[$i] == $userTags[$i]) {
3843
                            // gives the related weighting to the student
3844
                            $questionScore += $answerWeighting[$i];
3845
                            // increments total score
3846
                            $totalScore += $answerWeighting[$i];
3847
                            // adds the word in green at the end of the string
3848
                            $answer .= $correctTags[$i];
3849
                        } elseif (!empty($userTags[$i])) {
3850
                            // else if the word entered by the student IS NOT the same as the one defined by the professor
3851
                            // adds the word in red at the end of the string, and strikes it
3852
                            $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>';
3853
                        } else {
3854
                            // adds a tabulation if no word has been typed by the student
3855
                            $answer .= ''; // remove &nbsp; that causes issue
3856
                        }
3857
                        // adds the correct word, followed by ] to close the blank
3858
                        $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>]';
3859
                        if (isset($realText[$i +1])) {