Code Duplication    Length = 18-18 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 7426-7443 (lines=18) @@
7423
                        $selectedValue = 0;
7424
                        // fills the list-box
7425
                        $item = 0;
7426
                        foreach ($select_items as $val) {
7427
                            // set $debug_mark_answer to true at public static function start to
7428
                            // show the correct answer with a suffix '-x'
7429
                            $selected = '';
7430
                            if ($debug_mark_answer) {
7431
                                if ($val['id'] == $answerCorrect) {
7432
                                    $selected = 'selected="selected"';
7433
                                    $selectedValue = $val['id'];
7434
                                }
7435
                            }
7436
                            if (isset($user_choice[$matching_correct_answer]) && $val['id'] == $user_choice[$matching_correct_answer]['answer']) {
7437
                                $selected = 'selected="selected"';
7438
                                $selectedValue = $val['id'];
7439
                            }
7440
                            //$s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
7441
                            $s .= '<option value="'.$item.'" '.$selected.'>'.$val['letter'].'</option>';
7442
                            $item++;
7443
                        }
7444
7445
                        if (!empty($answerCorrect) && !empty($selectedValue)) {
7446
                            $s.= '<script>
@@ 7513-7530 (lines=18) @@
7510
                        $selectedValue = 0;
7511
                        // fills the list-box
7512
                        $item = 0;
7513
                        foreach ($select_items as $val) {
7514
                            // set $debug_mark_answer to true at function start to
7515
                            // show the correct answer with a suffix '-x'
7516
                            $selected = '';
7517
                            if ($debug_mark_answer) {
7518
                                if ($val['id'] == $answerCorrect) {
7519
                                    $selected = 'selected="selected"';
7520
                                    $selectedValue = $val['id'];
7521
                                }
7522
                            }
7523
                            if (isset($user_choice[$matching_correct_answer]) && $val['id'] == $user_choice[$matching_correct_answer]['answer']) {
7524
                                $selected = 'selected="selected"';
7525
                                $selectedValue = $val['id'];
7526
                            }
7527
                            $s .= '<option value="'.$item.'" '.$selected.'>'.$val['letter'].'</option>';
7528
                            $item++;
7529
                        }
7530
                        $s .= '</select>';
7531
7532
                        if (!empty($answerCorrect) && !empty($selectedValue)) {
7533
                            $s.= '<script>