Code Duplication    Length = 18-18 lines in 2 locations

main/exercice/exercise.class.php 2 locations

@@ 7271-7288 (lines=18) @@
7268
                        $selectedValue = 0;
7269
                        // fills the list-box
7270
                        $item = 0;
7271
                        foreach ($select_items as $val) {
7272
                            // set $debug_mark_answer to true at public static function start to
7273
                            // show the correct answer with a suffix '-x'
7274
                            $selected = '';
7275
                            if ($debug_mark_answer) {
7276
                                if ($val['id'] == $answerCorrect) {
7277
                                    $selected = 'selected="selected"';
7278
                                    $selectedValue = $val['id'];
7279
                                }
7280
                            }
7281
                            if (isset($user_choice[$matching_correct_answer]) && $val['id'] == $user_choice[$matching_correct_answer]['answer']) {
7282
                                $selected = 'selected="selected"';
7283
                                $selectedValue = $val['id'];
7284
                            }
7285
                            //$s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
7286
                            $s .= '<option value="'.$item.'" '.$selected.'>'.$val['letter'].'</option>';
7287
                            $item++;
7288
                        }
7289
7290
                        if (!empty($answerCorrect) && !empty($selectedValue)) {
7291
                            $s.= '<script>
@@ 7358-7375 (lines=18) @@
7355
                        $selectedValue = 0;
7356
                        // fills the list-box
7357
                        $item = 0;
7358
                        foreach ($select_items as $val) {
7359
                            // set $debug_mark_answer to true at function start to
7360
                            // show the correct answer with a suffix '-x'
7361
                            $selected = '';
7362
                            if ($debug_mark_answer) {
7363
                                if ($val['id'] == $answerCorrect) {
7364
                                    $selected = 'selected="selected"';
7365
                                    $selectedValue = $val['id'];
7366
                                }
7367
                            }
7368
                            if (isset($user_choice[$matching_correct_answer]) && $val['id'] == $user_choice[$matching_correct_answer]['answer']) {
7369
                                $selected = 'selected="selected"';
7370
                                $selectedValue = $val['id'];
7371
                            }
7372
                            //$s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
7373
                            $s .= '<option value="'.$item.'" '.$selected.'>'.$val['letter'].'</option>';
7374
                            $item++;
7375
                        }
7376
                        $s .= '</select>';
7377
7378
                        if (!empty($answerCorrect) && !empty($selectedValue)) {