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/inc/lib/tracking.lib.php 1 location

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

main/lp/learnpath.class.php 1 location

@@ 9171-9177 (lines=7) @@
9168
        $categorizedLinks = array();
9169
        $categories = array();
9170
9171
        while ($link = Database::fetch_array($result)) {
9172
            if (!$link['category_id']) {
9173
                $link['category_title'] = get_lang('Uncategorized');
9174
            }
9175
            $categories[$link['category_id']] = $link['category_title'];
9176
            $categorizedLinks[$link['category_id']][$link['link_id']] = $link;
9177
        }
9178
9179
        $linksHtmlCode =
9180
            '<script>

main/survey/surveyUtil.class.php 1 location

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