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

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

main/survey/survey.lib.php 1 location

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