Code Duplication    Length = 18-18 lines in 2 locations

main/exercice/exercise.class.php 2 locations

@@ 7352-7369 (lines=18) @@
7349
                        $selectedValue = 0;
7350
                        // fills the list-box
7351
                        $item = 0;
7352
                        foreach ($select_items as $val) {
7353
                            // set $debug_mark_answer to true at public static function start to
7354
                            // show the correct answer with a suffix '-x'
7355
                            $selected = '';
7356
                            if ($debug_mark_answer) {
7357
                                if ($val['id'] == $answerCorrect) {
7358
                                    $selected = 'selected="selected"';
7359
                                    $selectedValue = $val['id'];
7360
                                }
7361
                            }
7362
                            if (isset($user_choice[$matching_correct_answer]) && $val['id'] == $user_choice[$matching_correct_answer]['answer']) {
7363
                                $selected = 'selected="selected"';
7364
                                $selectedValue = $val['id'];
7365
                            }
7366
                            //$s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
7367
                            $s .= '<option value="'.$item.'" '.$selected.'>'.$val['letter'].'</option>';
7368
                            $item++;
7369
                        }
7370
7371
                        if (!empty($answerCorrect) && !empty($selectedValue)) {
7372
                            $s.= '<script>
@@ 7439-7456 (lines=18) @@
7436
                        $selectedValue = 0;
7437
                        // fills the list-box
7438
                        $item = 0;
7439
                        foreach ($select_items as $val) {
7440
                            // set $debug_mark_answer to true at function start to
7441
                            // show the correct answer with a suffix '-x'
7442
                            $selected = '';
7443
                            if ($debug_mark_answer) {
7444
                                if ($val['id'] == $answerCorrect) {
7445
                                    $selected = 'selected="selected"';
7446
                                    $selectedValue = $val['id'];
7447
                                }
7448
                            }
7449
                            if (isset($user_choice[$matching_correct_answer]) && $val['id'] == $user_choice[$matching_correct_answer]['answer']) {
7450
                                $selected = 'selected="selected"';
7451
                                $selectedValue = $val['id'];
7452
                            }
7453
                            $s .= '<option value="'.$item.'" '.$selected.'>'.$val['letter'].'</option>';
7454
                            $item++;
7455
                        }
7456
                        $s .= '</select>';
7457
7458
                        if (!empty($answerCorrect) && !empty($selectedValue)) {
7459
                            $s.= '<script>