Code Duplication    Length = 18-18 lines in 2 locations

main/exercice/exercise.class.php 2 locations

@@ 7335-7352 (lines=18) @@
7332
                        $selectedValue = 0;
7333
                        // fills the list-box
7334
                        $item = 0;
7335
                        foreach ($select_items as $val) {
7336
                            // set $debug_mark_answer to true at public static function start to
7337
                            // show the correct answer with a suffix '-x'
7338
                            $selected = '';
7339
                            if ($debug_mark_answer) {
7340
                                if ($val['id'] == $answerCorrect) {
7341
                                    $selected = 'selected="selected"';
7342
                                    $selectedValue = $val['id'];
7343
                                }
7344
                            }
7345
                            if (isset($user_choice[$matching_correct_answer]) && $val['id'] == $user_choice[$matching_correct_answer]['answer']) {
7346
                                $selected = 'selected="selected"';
7347
                                $selectedValue = $val['id'];
7348
                            }
7349
                            //$s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
7350
                            $s .= '<option value="'.$item.'" '.$selected.'>'.$val['letter'].'</option>';
7351
                            $item++;
7352
                        }
7353
7354
                        if (!empty($answerCorrect) && !empty($selectedValue)) {
7355
                            $s.= '<script>
@@ 7422-7439 (lines=18) @@
7419
                        $selectedValue = 0;
7420
                        // fills the list-box
7421
                        $item = 0;
7422
                        foreach ($select_items as $val) {
7423
                            // set $debug_mark_answer to true at function start to
7424
                            // show the correct answer with a suffix '-x'
7425
                            $selected = '';
7426
                            if ($debug_mark_answer) {
7427
                                if ($val['id'] == $answerCorrect) {
7428
                                    $selected = 'selected="selected"';
7429
                                    $selectedValue = $val['id'];
7430
                                }
7431
                            }
7432
                            if (isset($user_choice[$matching_correct_answer]) && $val['id'] == $user_choice[$matching_correct_answer]['answer']) {
7433
                                $selected = 'selected="selected"';
7434
                                $selectedValue = $val['id'];
7435
                            }
7436
                            $s .= '<option value="'.$item.'" '.$selected.'>'.$val['letter'].'</option>';
7437
                            $item++;
7438
                        }
7439
                        $s .= '</select>';
7440
7441
                        if (!empty($answerCorrect) && !empty($selectedValue)) {
7442
                            $s.= '<script>