Code Duplication    Length = 6-7 lines in 5 locations

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

@@ 75-80 (lines=6) @@
72
        $res = Database::query($sql);
73
        if ($res !== false) {
74
            $i = 0;
75
            while ($resA = Database::fetch_array($res, 'NUM')) {
76
                $resu[$i][0] = $resA[0];
77
                $resu[$i][1] = $resA[1];
78
                $resu[$i][2] = $resA[2];
79
                $i++;
80
            }
81
        }
82
83
        return $resu;

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

@@ 908-914 (lines=7) @@
905
                if (!isset($thematic_id) && !isset($description_type)) {
906
                    // group all data group by thematic id
907
                    $tmp = array();
908
                    while ($row = Database::fetch_array($rs, 'ASSOC')) {
909
                        $tmp[] = $row['thematic_id'];
910
                        if (in_array($row['thematic_id'], $tmp)) {
911
                            $row['session_id'] = $thematic_plan_complete_list[$row['id']];
912
                            $data[$row['thematic_id']][$row['description_type']] = $row;
913
                        }
914
                    }
915
                } else {
916
                    while ($row = Database::fetch_array($rs, 'ASSOC')) {
917
                        $row['session_id'] = $thematic_plan_complete_list[$row['id']];

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

@@ 2420-2425 (lines=6) @@
2417
2418
        $progress = array();
2419
        $viewCount = array();
2420
        while ($row = Database::fetch_array($result, 'ASSOC')) {
2421
            if (!isset($viewCount[$row['lp_id']])) {
2422
                $progress[$row['lp_id']] = $row['progress'];
2423
            }
2424
            $viewCount[$row['lp_id']] = $row['view_count'];
2425
        }
2426
2427
        // Fill with lp ids
2428
        if (!empty($lpIdList)) {

main/lp/learnpath.class.php 1 location

@@ 9398-9404 (lines=7) @@
9395
        $categorizedLinks = array();
9396
        $categories = array();
9397
9398
        while ($link = Database::fetch_array($result)) {
9399
            if (!$link['category_id']) {
9400
                $link['category_title'] = get_lang('Uncategorized');
9401
            }
9402
            $categories[$link['category_id']] = $link['category_title'];
9403
            $categorizedLinks[$link['category_id']][$link['link_id']] = $link;
9404
        }
9405
9406
        $linksHtmlCode =
9407
            '<script>

main/survey/surveyUtil.class.php 1 location

@@ 589-595 (lines=7) @@
586
                $result = Database::query($sql);
587
                $number_of_answers = array();
588
                $data = array();
589
                while ($row = Database::fetch_array($result, 'ASSOC')) {
590
                    if (!isset($number_of_answers[$row['question_id']])) {
591
                        $number_of_answers[$row['question_id']] = 0;
592
                    }
593
                    $number_of_answers[$row['question_id']] += $row['total'];
594
                    $data[$row['option_id']] = $row;
595
                }
596
597
                foreach ($options as $option) {
598
                    $optionText = strip_tags($option['option_text']);