Code Duplication    Length = 18-18 lines in 2 locations

main/exercice/exercise.class.php 2 locations

@@ 7282-7299 (lines=18) @@
7279
                        $selectedValue = 0;
7280
                        // fills the list-box
7281
                        $item = 0;
7282
                        foreach ($select_items as $val) {
7283
                            // set $debug_mark_answer to true at public static function start to
7284
                            // show the correct answer with a suffix '-x'
7285
                            $selected = '';
7286
                            if ($debug_mark_answer) {
7287
                                if ($val['id'] == $answerCorrect) {
7288
                                    $selected = 'selected="selected"';
7289
                                    $selectedValue = $val['id'];
7290
                                }
7291
                            }
7292
                            if (isset($user_choice[$matching_correct_answer]) && $val['id'] == $user_choice[$matching_correct_answer]['answer']) {
7293
                                $selected = 'selected="selected"';
7294
                                $selectedValue = $val['id'];
7295
                            }
7296
                            //$s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
7297
                            $s .= '<option value="'.$item.'" '.$selected.'>'.$val['letter'].'</option>';
7298
                            $item++;
7299
                        }
7300
7301
                        if (!empty($answerCorrect) && !empty($selectedValue)) {
7302
                            $s.= '<script>
@@ 7369-7386 (lines=18) @@
7366
                        $selectedValue = 0;
7367
                        // fills the list-box
7368
                        $item = 0;
7369
                        foreach ($select_items as $val) {
7370
                            // set $debug_mark_answer to true at function start to
7371
                            // show the correct answer with a suffix '-x'
7372
                            $selected = '';
7373
                            if ($debug_mark_answer) {
7374
                                if ($val['id'] == $answerCorrect) {
7375
                                    $selected = 'selected="selected"';
7376
                                    $selectedValue = $val['id'];
7377
                                }
7378
                            }
7379
                            if (isset($user_choice[$matching_correct_answer]) && $val['id'] == $user_choice[$matching_correct_answer]['answer']) {
7380
                                $selected = 'selected="selected"';
7381
                                $selectedValue = $val['id'];
7382
                            }
7383
                            //$s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
7384
                            $s .= '<option value="'.$item.'" '.$selected.'>'.$val['letter'].'</option>';
7385
                            $item++;
7386
                        }
7387
                        $s .= '</select>';
7388
7389
                        if (!empty($answerCorrect) && !empty($selectedValue)) {