Code Duplication    Length = 6-9 lines in 3 locations

main/mySpace/myStudents.php 1 location

@@ 261-269 (lines=9) @@
258
            user_id = ".intval($user_info['user_id']);
259
$rs = Database::query($sql);
260
261
while ($row = Database :: fetch_array($rs)) {
262
    if ($drh_can_access_all_courses) {
263
        $courses_in_session[0][] = $row['c_id'];
264
    } else {
265
        if (isset($courses[$row['c_id']])) {
266
            $courses_in_session[0][] = $row['c_id'];
267
        }
268
    }
269
}
270
271
// Get the list of sessions where the user is subscribed as student
272
$sql = 'SELECT session_id, c_id

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

@@ 2323-2328 (lines=6) @@
2320
2321
        $progress = array();
2322
        $viewCount = array();
2323
        while ($row = Database::fetch_array($result, 'ASSOC')) {
2324
            if (!isset($viewCount[$row['lp_id']])) {
2325
                $progress[$row['lp_id']] = $row['progress'];
2326
            }
2327
            $viewCount[$row['lp_id']] = $row['view_count'];
2328
        }
2329
2330
        // Fill with lp ids
2331
        if (!empty($lpIdList)) {

main/survey/survey.lib.php 1 location

@@ 2285-2291 (lines=7) @@
2282
                $result = Database::query($sql);
2283
                $number_of_answers = array();
2284
                $data = array();
2285
                while ($row = Database::fetch_array($result, 'ASSOC')) {
2286
                    if (!isset($number_of_answers[$row['question_id']])) {
2287
                        $number_of_answers[$row['question_id']] = 0;
2288
                    }
2289
                    $number_of_answers[$row['question_id']] += $row['total'];
2290
                    $data[$row['option_id']] = $row;
2291
                }
2292
2293
                foreach ($options as $option) {
2294
                    $optionText = strip_tags($option['option_text']);