Code Duplication    Length = 15-18 lines in 2 locations

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

@@ 285-302 (lines=18) @@
282
                if (($extend_this || $extend_all) && $num > 0) {
283
                    $row = Database :: fetch_array($result);
284
                    $result_disabled_ext_all = false;
285
                    if ($row['item_type'] == 'quiz') {
286
                        // Check results_disabled in quiz table.
287
                        $my_path = Database::escape_string($row['path']);
288
289
                        $sql = "SELECT results_disabled
290
                                FROM $TBL_QUIZ
291
                                WHERE
292
                                    c_id = $course_id AND
293
                                    id ='" . $my_path . "'";
294
                        $res_result_disabled = Database::query($sql);
295
                        $row_result_disabled = Database::fetch_row($res_result_disabled);
296
297
                        if (Database::num_rows($res_result_disabled) > 0 &&
298
                            (int) $row_result_disabled[0] === 1
299
                        ) {
300
                            $result_disabled_ext_all = true;
301
                        }
302
                    }
303
304
                    // If there are several attempts, and the link to extend has been clicked, show each attempt...
305
                    if (($counter % 2) == 0) {
@@ 549-563 (lines=15) @@
546
547
                    $result_disabled_ext_all = false;
548
549
                    if ($row['item_type'] == 'quiz') {
550
                        // Check results_disabled in quiz table.
551
                        $my_path = Database::escape_string($my_path);
552
                        $sql = "SELECT results_disabled
553
                                FROM $TBL_QUIZ
554
                                WHERE c_id = $course_id AND id ='" . $my_path . "'";
555
                        $res_result_disabled = Database::query($sql);
556
                        $row_result_disabled = Database::fetch_row($res_result_disabled);
557
558
                        if (Database::num_rows($res_result_disabled) > 0 &&
559
                            (int) $row_result_disabled[0] === 1
560
                        ) {
561
                            $result_disabled_ext_all = true;
562
                        }
563
                    }
564
565
                    // Check if there are interactions below
566
                    $extend_this_attempt = 0;