Code Duplication    Length = 6-7 lines in 4 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/survey/survey.lib.php 1 location

@@ 2248-2254 (lines=7) @@
2245
                $result = Database::query($sql);
2246
                $number_of_answers = array();
2247
                $data = array();
2248
                while ($row = Database::fetch_array($result)) {
2249
                    if (!isset($number_of_answers[$row['question_id']])) {
2250
                        $number_of_answers[$row['question_id']] = 0;
2251
                    }
2252
                    $number_of_answers[$row['question_id']] += $row['total'];
2253
                    $data[$row['option_id']] = $row;
2254
                }
2255
2256
                foreach ($options as $option) {
2257
                    $optionText = strip_tags($option['option_text']);

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)) {