Code Duplication    Length = 15-18 lines in 2 locations

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

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