Code Duplication    Length = 15-18 lines in 2 locations

main/inc/lib/tracking.lib.php 2 locations

@@ 298-315 (lines=18) @@
295
                if (($extend_this || $extend_all) && $num > 0) {
296
                    $row = Database :: fetch_array($result);
297
                    $result_disabled_ext_all = false;
298
                    if ($row['item_type'] == 'quiz') {
299
                        // Check results_disabled in quiz table.
300
                        $my_path = Database::escape_string($row['path']);
301
302
                        $sql = "SELECT results_disabled
303
                                FROM $TBL_QUIZ
304
                                WHERE
305
                                    c_id = $course_id AND
306
                                    id ='" . $my_path . "'";
307
                        $res_result_disabled = Database::query($sql);
308
                        $row_result_disabled = Database::fetch_row($res_result_disabled);
309
310
                        if (Database::num_rows($res_result_disabled) > 0 &&
311
                            (int) $row_result_disabled[0] === 1
312
                        ) {
313
                            $result_disabled_ext_all = true;
314
                        }
315
                    }
316
317
                    // If there are several attempts, and the link to extend has been clicked, show each attempt...
318
                    if (($counter % 2) == 0) {
@@ 562-576 (lines=15) @@
559
560
                    $result_disabled_ext_all = false;
561
562
                    if ($row['item_type'] == 'quiz') {
563
                        // Check results_disabled in quiz table.
564
                        $my_path = Database::escape_string($my_path);
565
                        $sql = "SELECT results_disabled
566
                                FROM $TBL_QUIZ
567
                                WHERE c_id = $course_id AND id ='" . $my_path . "'";
568
                        $res_result_disabled = Database::query($sql);
569
                        $row_result_disabled = Database::fetch_row($res_result_disabled);
570
571
                        if (Database::num_rows($res_result_disabled) > 0 &&
572
                            (int) $row_result_disabled[0] === 1
573
                        ) {
574
                            $result_disabled_ext_all = true;
575
                        }
576
                    }
577
578
                    // Check if there are interactions below
579
                    $extend_this_attempt = 0;