Code Duplication    Length = 3-9 lines in 5 locations

main/survey/preview.php 1 location

@@ 127-133 (lines=7) @@
124
		$result = Database::query($sql);
125
        $questions_exists = true;
126
        if (Database::num_rows($result)) {
127
    		while ($row = Database::fetch_array($result)) {
128
    			if ($row['type'] == 'pagebreak') {
129
    				$counter++;
130
    			} else {
131
    				$paged_questions[$counter][] = $row['question_id'];
132
    			}
133
    		}
134
        } else {
135
            $questions_exists = false;
136
        }

main/inc/lib/events.lib.php 1 location

@@ 1370-1372 (lines=3) @@
1367
            $sql = "SELECT * FROM $table_track_attempt
1368
                    WHERE exe_id = {$row['exe_id']}";
1369
            $res_question = Database::query($sql);
1370
            while ($row_q = Database::fetch_array($res_question, 'ASSOC')) {
1371
                $list[$row['exe_id']]['question_list'][$row_q['question_id']][] = $row_q;
1372
            }
1373
        }
1374
        return $list;
1375
    }

main/forum/forumfunction.inc.php 1 location

@@ 1886-1892 (lines=7) @@
1883
    $result = Database::query($sql);
1884
    $list = array();
1885
    $alreadyAdded = array();
1886
    while ($row = Database::fetch_array($result, 'ASSOC')) {
1887
        if (in_array($row['thread_id'], $alreadyAdded)) {
1888
            continue;
1889
        }
1890
        $list[] = $row;
1891
        $alreadyAdded[] = $row['thread_id'];
1892
    }
1893
1894
    return $list;
1895
}

main/inc/lib/course.lib.php 1 location

@@ 2804-2812 (lines=9) @@
2801
        $result = Database::query($sql);
2802
2803
        if (Database::num_rows($result)) {
2804
            while ($row = Database::fetch_array($result, 'ASSOC')) {
2805
                if (!empty($skipCourseList)) {
2806
                    if (in_array($row['real_id'], $skipCourseList)) {
2807
                        continue;
2808
                    }
2809
                }
2810
                $course_list[] = $row;
2811
                $codes[] = $row['real_id'];
2812
            }
2813
        }
2814
2815
        if ($include_sessions === true) {

main/survey/fillsurvey.php 1 location

@@ 624-631 (lines=8) @@
621
                    WHERE c_id = $course_id AND survey_id = '".intval($survey_invitation['survey_id'])."'
622
                    ORDER BY sort ASC";
623
            $result = Database::query($sql);
624
            while ($row = Database::fetch_array($result, 'ASSOC')) {
625
                if ($row['type'] == 'pagebreak') {
626
                    $counter++;
627
                } else {
628
                    // ids from question of the current survey
629
                    $paged_questions[$counter][] = $row['question_id'];
630
                }
631
            }
632
            $_SESSION['paged_questions'] = $paged_questions;
633
        } else {
634
            $paged_questions = $_SESSION['paged_questions'];