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

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

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']);

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

@@ 2543-2548 (lines=6) @@
2540
2541
        $progress = array();
2542
        $viewCount = array();
2543
        while ($row = Database::fetch_array($result, 'ASSOC')) {
2544
            if (!isset($viewCount[$row['lp_id']])) {
2545
                $progress[$row['lp_id']] = $row['progress'];
2546
            }
2547
            $viewCount[$row['lp_id']] = $row['view_count'];
2548
        }
2549
2550
        // Fill with lp ids
2551
        if (!empty($lpIdList)) {

main/lp/learnpath.class.php 1 location

@@ 9450-9456 (lines=7) @@
9447
        $categorizedLinks = array();
9448
        $categories = array();
9449
9450
        while ($link = Database::fetch_array($result)) {
9451
            if (!$link['category_id']) {
9452
                $link['category_title'] = get_lang('Uncategorized');
9453
            }
9454
            $categories[$link['category_id']] = $link['category_title'];
9455
            $categorizedLinks[$link['category_id']][$link['link_id']] = $link;
9456
        }
9457
9458
        $linksHtmlCode =
9459
            '<script>