Code Duplication    Length = 15-18 lines in 2 locations

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

@@ 321-338 (lines=18) @@
318
                if (($extend_this || $extend_all) && $num > 0) {
319
                    $row = Database::fetch_array($result);
320
                    $result_disabled_ext_all = false;
321
                    if ($row['item_type'] == 'quiz') {
322
                        // Check results_disabled in quiz table.
323
                        $my_path = Database::escape_string($row['path']);
324
325
                        $sql = "SELECT results_disabled
326
                                FROM $TBL_QUIZ
327
                                WHERE
328
                                    c_id = $course_id AND
329
                                    id ='".$my_path."'";
330
                        $res_result_disabled = Database::query($sql);
331
                        $row_result_disabled = Database::fetch_row($res_result_disabled);
332
333
                        if (Database::num_rows($res_result_disabled) > 0 &&
334
                            (int) $row_result_disabled[0] === 1
335
                        ) {
336
                            $result_disabled_ext_all = true;
337
                        }
338
                    }
339
340
                    // If there are several attempts, and the link to extend has been clicked, show each attempt...
341
                    if (($counter % 2) == 0) {
@@ 607-621 (lines=15) @@
604
                    $my_path = $row['path'];
605
                    $result_disabled_ext_all = false;
606
607
                    if ($row['item_type'] == 'quiz') {
608
                        // Check results_disabled in quiz table.
609
                        $my_path = Database::escape_string($my_path);
610
                        $sql = "SELECT results_disabled
611
                                FROM $TBL_QUIZ
612
                                WHERE c_id = $course_id AND id ='".$my_path."'";
613
                        $res_result_disabled = Database::query($sql);
614
                        $row_result_disabled = Database::fetch_row($res_result_disabled);
615
616
                        if (Database::num_rows($res_result_disabled) > 0 &&
617
                            (int) $row_result_disabled[0] === 1
618
                        ) {
619
                            $result_disabled_ext_all = true;
620
                        }
621
                    }
622
623
                    // Check if there are interactions below
624
                    $extend_this_attempt = 0;