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

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

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

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

main/survey/survey.lib.php 1 location

@@ 2285-2291 (lines=7) @@
2282
                $result = Database::query($sql);
2283
                $number_of_answers = array();
2284
                $data = array();
2285
                while ($row = Database::fetch_array($result, 'ASSOC')) {
2286
                    if (!isset($number_of_answers[$row['question_id']])) {
2287
                        $number_of_answers[$row['question_id']] = 0;
2288
                    }
2289
                    $number_of_answers[$row['question_id']] += $row['total'];
2290
                    $data[$row['option_id']] = $row;
2291
                }
2292
2293
                foreach ($options as $option) {
2294
                    $optionText = strip_tags($option['option_text']);