Code Duplication    Length = 5-8 lines in 3 locations

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

@@ 891-897 (lines=7) @@
888
        $sql_query = sprintf($sql, $course['real_id']);
889
        $result = Database::query($sql_query);
890
        $arrLesson = array(array());
891
        while ($row = Database::fetch_array($result)) {
892
            if (empty($arrLesson[$row['session_id']]['lessons_total'])) {
893
                $arrLesson[$row['session_id']]['lessons_total'] = 1;
894
            } else {
895
                $arrLesson[$row['session_id']]['lessons_total'] ++;
896
            }
897
        }
898
899
        /**
900
         *  Exercises

main/exercice/exercise.php 1 location

@@ 1006-1010 (lines=5) @@
1003
1004
$result = Database::query($sql);
1005
1006
while ($row = Database :: fetch_array($result, 'ASSOC')) {
1007
    $attribute['path'][] = $row['path'];
1008
    $attribute['visibility'][] = $row['visibility'];
1009
    $attribute['comment'][] = $row['comment'];
1010
}
1011
1012
$nbrActiveTests = 0;
1013
if (isset($attribute['path']) && is_array($attribute['path'])) {

main/survey/survey.lib.php 1 location

@@ 948-955 (lines=8) @@
945
        // Getting the information of the question options
946
947
        $result = Database::query($sqlOption);
948
        while ($row = Database::fetch_array($result, 'ASSOC')) {
949
            /** @todo this should be renamed to options instead of answers */
950
            $return['answers'][] = $row['option_text'];
951
            $return['values'][] = $row['value'];
952
953
            /** @todo this can be done more elegantly (used in reporting) */
954
            $return['answersid'][] = $row['question_option_id'];
955
        }
956
957
        return $return;
958
    }