Code Duplication    Length = 6-7 lines in 5 locations

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

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

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

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

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

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

main/newscorm/learnpath.class.php 1 location

@@ 8835-8841 (lines=7) @@
8832
        $categorizedLinks = array();
8833
        $categories = array();
8834
8835
        while ($link = Database :: fetch_array($links)) {
8836
            if (!$link['category_id']) {
8837
                $link['category_title'] = get_lang('Uncategorized');
8838
            }
8839
            $categories[$link['category_id']] = $link['category_title'];
8840
            $categorizedLinks[$link['category_id']][$link['link_id']] = $link;
8841
        }
8842
8843
        $linksHtmlCode =
8844
            '<script>

main/survey/survey.lib.php 1 location

@@ 2320-2326 (lines=7) @@
2317
                $result = Database::query($sql);
2318
                $number_of_answers = array();
2319
                $data = array();
2320
                while ($row = Database::fetch_array($result)) {
2321
                    if (!isset($number_of_answers[$row['question_id']])) {
2322
                        $number_of_answers[$row['question_id']] = 0;
2323
                    }
2324
                    $number_of_answers[$row['question_id']] += $row['total'];
2325
                    $data[$row['option_id']] = $row;
2326
                }
2327
2328
                foreach ($options as $option) {
2329
                    $optionText = strip_tags($option['option_text']);