chamilo/chamilo-lms

View on GitHub
public/main/inc/ajax/exercise.ajax.php

Summary

Maintainability
A
0 mins
Test Coverage

Variable "session_id" is not in valid camel caps format
Open

$session_id = isset($_REQUEST['session_id']) ? (int) $_REQUEST['session_id'] : api_get_session_id();

Variable "session_id" is not in valid camel caps format
Open

            $session_id,

Variable "where_condition" is not in valid camel caps format
Open

                WHERE $where_condition ";

Variable "expired_time" is not in valid camel caps format
Open

                        ($oExe->expired_time * 60) -

Variable "course_code" is not in valid camel caps format
Open

$course_code = isset($_REQUEST['cidReq']) ? $_REQUEST['cidReq'] : api_get_course_id();

Variable "count_questions" is not in valid camel caps format
Open

                $count_questions = Database::fetch_array(

Variable "result_count" is not in valid camel caps format
Open

                    $result_count,

Variable "count_questions" is not in valid camel caps format
Open

                $count_questions = $count_questions['count_question_id'];

Variable "track_exercise" is not in valid camel caps format
Open

                FROM $track_exercise

Variable "total_pages" is not in valid camel caps format
Open

            $page = $total_pages;

Variable "total_pages" is not in valid camel caps format
Open

        $response->total = $total_pages;

Variable "track_exercise" is not in valid camel caps format
Open

                    FROM  $track_exercise  t

Variable "total_pages" is not in valid camel caps format
Open

                $total_pages = ceil($count / $limit);

Variable "current_course_tool" is not in valid camel caps format
Open

$current_course_tool = TOOL_QUIZ;

Variable "exercise_id" is not in valid camel caps format
Open

        $where_condition = " orig_lp_id = 0 AND exe_exo_id = $exercise_id AND start_date > '$now' ";

Variable "where_condition" is not in valid camel caps format
Open

                    WHERE t.status = 'incomplete' AND $where_condition

Variable "session_id" is not in valid camel caps format
Open

        $session_id = (!empty($_GET['session_id'])) ? (int) $_GET['session_id'] : 0;

Variable "exercise_id" is not in valid camel caps format
Open

        $exercise_id = (int) $_GET['exercise_id'];

Variable "track_exercise" is not in valid camel caps format
Open

        $track_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);

Variable "track_attempt" is not in valid camel caps format
Open

        $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);

Variable "total_pages" is not in valid camel caps format
Open

        $total_pages = 0;

Variable "user_table" is not in valid camel caps format
Open

        $user_table = Database::get_main_table(TABLE_MAIN_USER);

Variable "where_condition" is not in valid camel caps format
Open

        $where_condition = " orig_lp_id = 0 AND exe_exo_id = $exercise_id AND start_date > '$now' ";

Variable "count_questions" is not in valid camel caps format
Open

                $count_questions = $count_questions['count_question_id'];

Variable "expired_time" is not in valid camel caps format
Open

                if (!empty($oExe->expired_time)) {

Variable "track_attempt" is not in valid camel caps format
Open

                    LEFT JOIN $track_attempt a

Variable "exercise_id" is not in valid camel caps format
Open

        $oExe->read($exercise_id);

Variable "result_count" is not in valid camel caps format
Open

                $result_count = Database::query($sql);

Variable "total_pages" is not in valid camel caps format
Open

        if ($page > $total_pages) {

Variable "user_table" is not in valid camel caps format
Open

                FROM $user_table u

Variable "track_attempt" is not in valid camel caps format
Open

                            FROM $track_attempt a

Variable "course_id" is not in valid camel caps format
Open

            $course_id,

Variable "count_questions" is not in valid camel caps format
Open

                $row['count_questions'] = $count_questions;

Variable "course_id" is not in valid camel caps format
Open

$course_id = api_get_course_int_id();

Variable "course_id" is not in valid camel caps format
Open

        $course_id = (isset($_GET['course_id']) && !empty($_GET['course_id'])) ? (int) $_GET['course_id'] : 0;

CASE statements must be defined using a colon
Open

    case 'get_live_stats':

Variable "TBL_QUESTIONS" is not in valid camel caps format
Open

            $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);

Variable "exercise_id" is not in valid camel caps format
Open

                            $exercise_id,

Variable "learnpath_id" is not in valid camel caps format
Open

        $learnpath_id = isset($_REQUEST['learnpath_id']) ? (int) $_REQUEST['learnpath_id'] : 0;

Variable "exercise_stat_info" is not in valid camel caps format
Open

        $exercise_id = $exercise_stat_info['exe_exo_id'];

Variable "exercise_stat_info" is not in valid camel caps format
Open

            $total_score = $exercise_stat_info['score'];

Variable "remind_list" is not in valid camel caps format
Open

                if (isset($remind_list[0])) {

Variable "question_list" is not in valid camel caps format
Open

            foreach ($question_list as $my_question_id) {

Variable "my_question_id" is not in valid camel caps format
Open

            if ('simple' === $type && $question_id != $my_question_id) {

Variable "my_question_id" is not in valid camel caps format
Open

                    error_log('Skipping question '.$my_question_id.' in single-question save action');

Variable "my_choice" is not in valid camel caps format
Open

                $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id])

Variable "exercise_id" is not in valid camel caps format
Open

                $exercise_id,

Variable "course_info" is not in valid camel caps format
Open

        $course_info = api_get_course_info_by_id($course_id);

Variable "course_id" is not in valid camel caps format
Open

        $course_id = $course_info['real_id'];

Variable "exercise_stat_info" is not in valid camel caps format
Open

        if (!empty($exercise_stat_info)) {

Variable "remind_list" is not in valid camel caps format
Open

                $remind_list = $new_list;

Variable "bd_reminder_list" is not in valid camel caps format
Open

                        array_push($bd_reminder_list, $remind_list[0]);

Variable "my_question_id" is not in valid camel caps format
Open

            foreach ($question_list as $my_question_id) {

Variable "my_question_id" is not in valid camel caps format
Open

        foreach ($question_list as $my_question_id) {

Variable "my_question_id" is not in valid camel caps format
Open

            $my_choice = isset($choice[$my_question_id]) ? $choice[$my_question_id] : null;

Variable "my_question_id" is not in valid camel caps format
Open

            $objQuestionTmp = Question::read($my_question_id, $objExercise->course);

Variable "my_question_id" is not in valid camel caps format
Open

                    $myChoiceDegreeCertainty = $choiceDegreeCertainty[$my_question_id];

Variable "my_question_id" is not in valid camel caps format
Open

                $hotspot_delineation_result = $_SESSION['hotspot_delineation_result'][$objExercise->getId()][$my_question_id];

Variable "my_question_id" is not in valid camel caps format
Open

            if (isset($attemptList) && !empty($attemptList[$my_question_id])) {

Variable "session_id" is not in valid camel caps format
Open

                    $session_id,

Variable "course_id" is not in valid camel caps format
Open

                        $course_id,

Variable "exercise_stat_info" is not in valid camel caps format
Open

                    $duration = $exercise_stat_info['exe_duration'];

Multi-line function call not indented correctly; expected 20 spaces but found 24
Open

                        ).' ['.($h > 0 ? $h.':' : '').sprintf('%02d', $m).':'.sprintf('%02d', $s).']';

Variable "learnpath_item_id" is not in valid camel caps format
Open

        $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? (int) $_REQUEST['learnpath_item_id'] : 0;

Variable "bd_reminder_list" is not in valid camel caps format
Open

            $bd_reminder_list = explode(',', $exercise_stat_info['questions_to_check']);

Variable "question_list" is not in valid camel caps format
Open

            foreach ($question_list as $my_question_id) {

Variable "my_question_id" is not in valid camel caps format
Open

                $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id])

Variable "my_question_id" is not in valid camel caps format
Open

                    $total_score -= $attemptList[$my_question_id]['marks'];

Variable "my_question_id" is not in valid camel caps format
Open

                    $my_question_id,

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            $row['start_date'],

Variable "new_list" is not in valid camel caps format
Open

            foreach ($new_list as $new_order_id) {

Variable "exercise_id" is not in valid camel caps format
Open

        $exercise_id = isset($_REQUEST['exercise_id']) ? (int) $_REQUEST['exercise_id'] : null;

Variable "new_question_list" is not in valid camel caps format
Open

            foreach ($new_question_list as $new_order_id) {

Variable "session_id" is not in valid camel caps format
Open

                    $course_id.'/'.$session_id.

Variable "my_question_id" is not in valid camel caps format
Open

            foreach ($question_list as $my_question_id) {

Variable "my_question_id" is not in valid camel caps format
Open

                if (isset($attemptList[$my_question_id]) &&

Variable "hot_spot_coordinates" is not in valid camel caps format
Open

                    $hot_spot_coordinates,

Variable "exercise_stat_info" is not in valid camel caps format
Open

                $exercise_stat_info['orig_lp_item_id']

Variable "session_id" is not in valid camel caps format
Open

                $session_id,

Variable "exercise_stat_info" is not in valid camel caps format
Open

                $exercise_stat_info['orig_lp_id'],

Variable "exercise_stat_info" is not in valid camel caps format
Open

                $exercise_stat_info['orig_lp_item_id'],

Variable "new_list" is not in valid camel caps format
Open

            $new_list = $_REQUEST['exercise_list'];

Variable "new_order_id" is not in valid camel caps format
Open

            foreach ($new_question_list as $new_order_id) {

Variable "TBL_QUESTIONS" is not in valid camel caps format
Open

                    $TBL_QUESTIONS,

Variable "my_question_id" is not in valid camel caps format
Open

                $objQuestionTmp = Question::read($my_question_id, $objExercise->course);

Variable "my_question_id" is not in valid camel caps format
Open

                    ? $_REQUEST['free_choice'][$my_question_id]

Variable "hotspot_delineation_result" is not in valid camel caps format
Open

            $hotspot_delineation_result = null;

Variable "my_question_id" is not in valid camel caps format
Open

                    $my_question_id

Variable "total_score" is not in valid camel caps format
Open

                    $total_score -= $attemptList[$my_question_id]['marks'];

Variable "hotspot_delineation_result" is not in valid camel caps format
Open

                    $hotspot_delineation_result,

Variable "total_score" is not in valid camel caps format
Open

                error_log("total_score: $total_score ");

Variable "exercise_stat_info" is not in valid camel caps format
Open

                if (!empty($exercise_stat_info['exe_duration'])) {

Variable "exercise_stat_info" is not in valid camel caps format
Open

                $exercise_stat_info['orig_lp_item_view_id'],

Variable "course_info" is not in valid camel caps format
Open

        $course_info = api_get_course_info_by_id($course_id);

Variable "remind_list" is not in valid camel caps format
Open

            error_log('remind_list = '.print_r($remind_list, 1));

Variable "exercise_stat_info" is not in valid camel caps format
Open

        $exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exeId);

Variable "remind_list" is not in valid camel caps format
Open

                $remind_list = $bd_reminder_list;

Variable "remind_list" is not in valid camel caps format
Open

                        array_push($bd_reminder_list, $remind_list[0]);

Variable "total_weight" is not in valid camel caps format
Open

        $total_weight = 0;

Variable "my_question_id" is not in valid camel caps format
Open

                $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id])

Variable "course_id" is not in valid camel caps format
Open

                    $course_id,

Variable "total_score" is not in valid camel caps format
Open

            $total_score += $result['score'];

Variable "total_score" is not in valid camel caps format
Open

                $total_score,

Variable "course_id" is not in valid camel caps format
Open

        $course_info = api_get_course_info_by_id($course_id);

Variable "exercise_id" is not in valid camel caps format
Open

        $exercise_id = $exercise_stat_info['exe_exo_id'];

Variable "my_choice" is not in valid camel caps format
Open

            $my_choice = isset($choice[$my_question_id]) ? $choice[$my_question_id] : null;

Variable "my_question_id" is not in valid camel caps format
Open

                            error_log("Question duration = 0, in exeId: $exeId, question_id: $my_question_id");

Variable "exercise_stat_info" is not in valid camel caps format
Open

                if (!empty($exercise_stat_info['exe_duration'])) {

Variable "course_info" is not in valid camel caps format
Open

        $course_id = $course_info['real_id'];

Variable "course_id" is not in valid camel caps format
Open

        $course_info = api_get_course_info_by_id($course_id);

Variable "hot_spot_coordinates" is not in valid camel caps format
Open

        $hot_spot_coordinates = isset($_REQUEST['hotspot']) ? $_REQUEST['hotspot'] : [];

Variable "remind_list" is not in valid camel caps format
Open

            if (empty($remind_list)) {

Variable "remind_list" is not in valid camel caps format
Open

                    $remind_list = $bd_reminder_list;

Variable "bd_reminder_list" is not in valid camel caps format
Open

                    $remind_list = $bd_reminder_list;

Variable "old_result" is not in valid camel caps format
Open

                $total_score = $total_score - $old_result['score'];

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            DATE_TIME_FORMAT_LONG

Variable "remind_list" is not in valid camel caps format
Open

        $remind_list = isset($_REQUEST['remind_list']) && !empty($_REQUEST['remind_list'])

Variable "session_id" is not in valid camel caps format
Open

            $sql = "DELETE FROM $table WHERE session_id = $session_id AND c_id = $course_id";

Variable "bd_reminder_list" is not in valid camel caps format
Open

                    if (!in_array($remind_list[0], $bd_reminder_list)) {

Variable "course_id" is not in valid camel caps format
Open

            $sql = "DELETE FROM $table WHERE session_id = $session_id AND c_id = $course_id";

Variable "total_weight" is not in valid camel caps format
Open

                $total_weight += $objQuestionTmp->selectWeighting();

Variable "course_id" is not in valid camel caps format
Open

                        'c_id' => $course_id,

Variable "course_id" is not in valid camel caps format
Open

        $course_id = $course_info['real_id'];

Variable "exercise_stat_info" is not in valid camel caps format
Open

            $exeId = $exercise_stat_info['exe_id'];

Variable "remind_list" is not in valid camel caps format
Open

                    if (!in_array($remind_list[0], $bd_reminder_list)) {

Variable "expired_time" is not in valid camel caps format
Open

                if (0 != $objExercise->expired_time) {

Variable "my_question_id" is not in valid camel caps format
Open

            $my_choice = isset($choice[$my_question_id]) ? $choice[$my_question_id] : null;

Variable "hotspot_delineation_result" is not in valid camel caps format
Open

                $hotspot_delineation_result = $_SESSION['hotspot_delineation_result'][$objExercise->getId()][$my_question_id];

Variable "old_result" is not in valid camel caps format
Open

                $old_result = $objExercise->manage_answer(

Variable "session_id" is not in valid camel caps format
Open

                        $session_id,

Variable "my_question_id" is not in valid camel caps format
Open

                    isset($attemptList[$my_question_id]['marks'])

Variable "my_choice" is not in valid camel caps format
Open

                    $my_choice,

Variable "exercise_id" is not in valid camel caps format
Open

        if (empty($exercise_id)) {

Variable "hot_spot_coordinates" is not in valid camel caps format
Open

            error_log('hot_spot_coordinates = '.print_r($hot_spot_coordinates, 1));

Variable "exercise_stat_info" is not in valid camel caps format
Open

            $bd_reminder_list = explode(',', $exercise_stat_info['questions_to_check']);

Variable "new_list" is not in valid camel caps format
Open

                $new_list = [];

Variable "bd_reminder_list" is not in valid camel caps format
Open

                foreach ($bd_reminder_list as $item) {

Variable "my_question_id" is not in valid camel caps format
Open

                    $my_question_id,

Variable "question_list" is not in valid camel caps format
Open

        $question_list = Session::read('questionList');

Variable "learnpath_item_id" is not in valid camel caps format
Open

                        $learnpath_item_id

Variable "question_id" is not in valid camel caps format
Open

            if ('simple' === $type && $question_id != $my_question_id) {

Variable "total_score" is not in valid camel caps format
Open

                $total_score = $total_score - $old_result['score'];

Variable "my_question_id" is not in valid camel caps format
Open

                    $my_question_id,

Variable "hotspot_delineation_result" is not in valid camel caps format
Open

                    $hotspot_delineation_result,

Variable "total_weight" is not in valid camel caps format
Open

                error_log("total_weight: $total_weight ");

Variable "exercise_stat_info" is not in valid camel caps format
Open

                $exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exeId);

Variable "exercise_stat_info" is not in valid camel caps format
Open

                    $duration += $exercise_stat_info['exe_duration'];

Variable "bd_reminder_list" is not in valid camel caps format
Open

                $remind_list = $bd_reminder_list;

Variable "question_id" is not in valid camel caps format
Open

                    if ($item != $question_id) {

Variable "new_list" is not in valid camel caps format
Open

                        $new_list[] = $item;

Variable "learnpath_id" is not in valid camel caps format
Open

                        $learnpath_id,

Variable "my_question_id" is not in valid camel caps format
Open

                        $my_question_id

Variable "my_choice" is not in valid camel caps format
Open

                $myChoiceTmp['choice'] = $my_choice;

Variable "exercise_stat_info" is not in valid camel caps format
Open

                $exercise_stat_info['orig_lp_id'],

Variable "new_order_id" is not in valid camel caps format
Open

                        'exercise_id' => (int) $new_order_id,

Variable "new_question_list" is not in valid camel caps format
Open

            $new_question_list = $_POST['question_id_list'];

Variable "new_order_id" is not in valid camel caps format
Open

                            (int) $new_order_id,

Variable "course_info" is not in valid camel caps format
Open

        $course_id = $course_info['real_id'];

Variable "question_id" is not in valid camel caps format
Open

        $question_id = isset($_REQUEST['question_id']) ? (int) $_REQUEST['question_id'] : null;

Variable "question_list" is not in valid camel caps format
Open

        if (empty($question_list) || empty($objExercise)) {

Variable "new_list" is not in valid camel caps format
Open

                $remind_list = $new_list;

Variable "question_list" is not in valid camel caps format
Open

        foreach ($question_list as $my_question_id) {

Variable "total_score" is not in valid camel caps format
Open

                $total_score = $total_score - $old_result['score'];

Variable "total_weight" is not in valid camel caps format
Open

                $total_weight,

Variable "session_id" is not in valid camel caps format
Open

                        'session_id' => $session_id,

Variable "course_id" is not in valid camel caps format
Open

                    $course_id.'/'.$session_id.

Variable "my_question_id" is not in valid camel caps format
Open

                if (!empty($choice[$my_question_id])) {

Variable "my_question_id" is not in valid camel caps format
Open

                if (isset($choiceDegreeCertainty[$my_question_id])) {

Variable "new_order_id" is not in valid camel caps format
Open

            foreach ($new_list as $new_order_id) {

Variable "question_list" is not in valid camel caps format
Open

                if (empty($question_list)) {

Variable "total_score" is not in valid camel caps format
Open

            $total_score = $exercise_stat_info['score'];

Variable "total_weight" is not in valid camel caps format
Open

                $total_weight += $objQuestionTmp->selectWeighting();

Variable "my_question_id" is not in valid camel caps format
Open

                    error_log("delete_attempt exe_id : $exeId, my_question_id: $my_question_id");

Variable "hot_spot_coordinates" is not in valid camel caps format
Open

                    $hot_spot_coordinates,

Variable "my_question_id" is not in valid camel caps format
Open

                        unset($questionStart[$my_question_id]);

Variable "exercise_stat_info" is not in valid camel caps format
Open

        $questionsCount = count(explode(',', $exercise_stat_info['data_tracking']));

Variable "my_question_id" is not in valid camel caps format
Open

                    if (isset($questionStart[$my_question_id])) {

Variable "question_list" is not in valid camel caps format
Open

                $question_list,

Variable "remind_list" is not in valid camel caps format
Open

                $remind_list

Line indented incorrectly; expected 8 spaces, found 16
Open

                if (!empty($oExe->expired_time)) {

Line indented incorrectly; expected 8 spaces, found 12
Open

            if (!empty($limit)) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        if (!in_array($sord, ['asc', 'desc'])) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Line indented incorrectly; expected 4 spaces, found 8
Open

        while ($row = Database::fetch_assoc($result)) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        if ($count > 0) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        if (!api_is_allowed_to_edit(null, true)) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Line indented incorrectly; expected 8 spaces, found 12
Open

            foreach ($results as $row) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Line indented incorrectly; expected 8 spaces, found 12
Open

            }

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Line indented incorrectly; expected 4 spaces, found 8
Open

        if ($page > $total_pages) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        if ($start < 0) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        if (!empty($results)) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        if (!$sidx) {

Line indented incorrectly; expected 8 spaces, found 16
Open

                }

Line indented incorrectly; expected 8 spaces, found 12
Open

            switch ($option) {

Line indented incorrectly; expected 4 spaces, found 8
Open

        }

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            DATE_TIME_FORMAT_LONG

Line indented incorrectly; expected 12 spaces, found 16
Open

                case 'remove_all':

Line indented incorrectly; expected 8 spaces, found 12
Open

            }

Multi-line function call not indented correctly; expected 20 spaces but found 24
Open

                        ).' ['.($h > 0 ? $h.':' : '').sprintf('%02d', $m).':'.sprintf('%02d', $s).']';

Line indented incorrectly; expected 8 spaces, found 12
Open

            }

Line indented incorrectly; expected 8 spaces, found 16
Open

                } else {

Line indented incorrectly; expected 12 spaces, found 16
Open

                default:

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            $row['start_date'],

Line indented incorrectly; expected 12 spaces, found 16
Open

                case 'add_all':

There are no issues that match your filters.

Category
Status