Code Duplication    Length = 18-18 lines in 2 locations

main/exercise/exercise.class.php 2 locations

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