chamilo/chamilo-lms

View on GitHub
public/main/tracking/lp_results_by_user.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using undefined variables such as '$header' which will lead to PHP notices.
Open

    $header[] = [

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$header' which will lead to PHP notices.
Open

        $array = array_merge($header, $array);

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

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

        $course_item = api_get_course_info($temp_course_item['code']);

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

    $course_list = [$current_course];

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

foreach ($course_list as $data) {

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

    $selected_course = api_get_course_info($selected_course);

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

        echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">

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

        $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'my_space/index.php?view=teacher">'.get_lang('Trainer View').'</a>';

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

    $list = new LearnpathList('', $course_info, $session_id);

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

    foreach ($lp_list as $lp_id => $lp) {

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

            foreach ($exercises as $exercise_id => $exercise_data) {

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

    $temp_course_list = CourseManager :: get_courses_list();

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

                        $html_result .= Display::tag('td', $lp_list_name[$lp_id]);

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

    $new_course_select

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

                        $html_result .= Display::tag('td', api_get_local_time($attempt_data['exe_date']));

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

        $menu_items[] = get_lang('Exam tracking');

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

                            api_get_local_time($attempt_data['exe_date']),

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

        $lps[$lp_id] = ['lp_name' => $lp['lp_name'], 'exercises' => $attempt_result];

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

if (!$export_to_csv) {

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

    foreach ($user_list as $user_id) {

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

if (!empty($main_result)) {

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

            foreach ($exercises as $exercise_id => $exercise_data) {

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

$exercise_id = null;

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

            'code' => $course_item['code'],

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

    $html_result .= '</tr>';

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

                        $html_result .= '<tr colspan="">';

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

        echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">

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

            $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'my_space/index.php?view=coach">'.get_lang('Admin view').'</a>';

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

    foreach ($lp_list as $lp_id => $lp) {

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

        $lps[$lp_id] = ['lp_name' => $lp['lp_name'], 'exercises' => $attempt_result];

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

    $html_result .= '<th>'.get_lang('Attempt').'</th>';

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

        foreach ($lps as $lp_id => $lp_data) {

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

                $users = $exercise_data['users'];

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

                        $html_result .= Display::tag('td', $user_list_name[$user_id]);

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

                        $result = $attempt_data['score'].' / '.$attempt_data['max_score'];

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

                            $user_list_name[$user_id],

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

if ($export_to_csv) {

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

    $export_to_csv = true;

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

    $course_list = [$current_course];

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

$new_course_select = [];

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

    $new_course_select[$data['code']] = $data['title'];

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

    $course_list = [$selected_course];

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

        foreach ($lps as $lp_id => $lp_data) {

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

                    foreach ($attempts as $exe_id => $attempt_data) {

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

                        $html_result .= Display::tag('td', $course_code);

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

$is_allowedToTrack = Tracking::isAllowToTrack(api_get_session_id());

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

    $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);

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

                if ($key != $nb_menu_items - 1) {

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

        echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">

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

$user_list = [];

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

foreach ($course_list as $current_course) {

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

            foreach ($exercise_stats as $stats) {

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

        $lp_list_name[$lp_id] = $lp['lp_name'];

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

if (!empty($user_list)) {

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

    $html_result .= '<th>'.get_lang('Test').'</th>';

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

                foreach ($users as $user_id => $attempts) {

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

                        $html_result .= Display::tag('td', $user_list_name[$user_id]);

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

                            $lp_list_name[$lp_id],

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

                            $lp_list_name[$lp_id],

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

                            $user_list_name[$user_id],

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

    $course_id = api_get_course_int_id();

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

    $sqlExercices = "SELECT quiz.title,iid FROM ".$t_quiz." AS quiz

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

        $nb_menu_items = count($menu_items);

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

            $exercise_list_name[$exercise['id']] = $exercise['title'];

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

        $user_data = api_get_user_info($user_id);

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

                        $html_result .= Display::tag('td', $attempt);

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

    $html_result .= '</table>';

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

if (!$is_allowedToTrack) {

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

foreach ($course_list as $current_course) {

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

        $exercise_list = Event::get_all_exercises_from_lp($lp_id);

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

                $user_list[$stats['exe_user_id']] = $stats['exe_user_id'];

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

$this_section = SECTION_TRACKING;

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

    $current_course['code'] = $_course['id'];

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

    $exercise_list[0] = get_lang('All');

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

            foreach ($menu_items as $key => $item) {

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

        $user_data = api_get_user_info($user_id);

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

        $user_list_name[$user_id] = api_get_person_name(

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

    $html_result .= '<tr><th>'.get_lang('Course').'</th>';

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

    $html_result .= '<th>'.get_lang('Date').'</th>';

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

    foreach ($main_result as $course_code => $lps) {

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

                        $html_result .= Display::tag('td', $exercise_list_name[$exercise_id]);

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

                            $course_code,

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

                            $exercise_list_name[$exercise_id],

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

$_course = api_get_course_info();

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

$export_to_csv = false;

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

            'title' => $course_item['title'],

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

        $exercise_list[$a_exercices['iid']] = $a_exercices['title'];

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

    $selected_course = api_get_course_info($selected_course);

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

        echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">

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

    $_course = $course_info;

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

        $attempt_result = [];

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

$export_array = [];

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

    $html_result .= '<th>'.get_lang('Learning paths').'</th>';

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

                        $html_result .= Display::tag('td', $lp_list_name[$lp_id]);

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

    while ($a_exercices = Database::fetch_array($resultExercices)) {

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

    $selected_course = $_REQUEST['course_code'];

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

$main_result = [];

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

    $course_info = api_get_course_info($current_course['code']);

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

        $lp_list_name[$lp_id] = $lp['lp_name'];

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

        $user_list_name[$user_id] = api_get_person_name(

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

            $user_data['firstname'],

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

    $html_result .= '<th>'.get_lang('Results and feedback and feedback').'</th>';

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

    foreach ($main_result as $course_code => $lps) {

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

                        $html_result .= Display::tag('td', $exercise_list_name[$exercise_id]);

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

                        $html_result .= Display::tag('td', $user_list_name[$user_id]);

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

    foreach ($temp_course_list as $temp_course_item) {

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

        $course_list[] = [

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

            $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'my_space/index.php?view=admin">'.get_lang('Admin view').'</a>';

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

    $_course = $course_info;

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

                $session_id

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

    $main_result[$current_course['code']] = $lps;

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

            $exercises = $lp_data['exercises'];

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

                        $html_result .= Display::tag('td', $course_code);

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

                        $export_array[] = [

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

    export_complete_report_csv($filename, $export_array);

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

    foreach ($temp_course_list as $temp_course_item) {

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

    $form->addSelect('exercise_id', get_lang('Test'), $exercise_list);

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

        foreach ($exercise_list as $exercise) {

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

            $exercise_stats = Event::get_all_exercise_event_from_lp(

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

    $main_result[$current_course['code']] = $lps;

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

                    foreach ($attempts as $exe_id => $attempt_data) {

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

        $exercise_list[$a_exercices['iid']] = $a_exercices['title'];

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

        $exercise_list[$a_exercices['iid']] = $a_exercices['title'];

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

    $course_list = [$selected_course];

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

        $nb_menu_items = count($menu_items);

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

$session_id = 0;

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

    $lp_list = $list->get_flat_list();

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

                $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats;

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

    $html_result = '<table  class="data_table">';

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

                        $html_result .= Display::tag('td', $result);

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

                            $exercise_list_name[$exercise_id],

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

        $course_item = api_get_course_info($temp_course_item['code']);

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

    $current_course['code'] = $_course['id'];

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

if (!$export_to_csv) {

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

            $user_data['lastname']

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

                        $html_result .= Display::tag('td', $lp_list_name[$lp_id]);

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

                        $html_result .= Display::tag('td', $exercise_list_name[$exercise_id]);

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

                        $result = $attempt_data['score'].' / '.$attempt_data['max_score'];

Missing function doc comment
Open

function export_complete_report_csv($filename, $array)

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

$filter_score = null;

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

                     WHERE c_id = $course_id AND active='1'

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

if (!empty($selected_course)) {

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

        if ($nb_menu_items > 1) {

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

    $course_info = api_get_course_info($current_course['code']);

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

    $list = new LearnpathList('', $course_info, $session_id);

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

        $exercise_list = Event::get_all_exercises_from_lp($lp_id);

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

                $course_info['real_id'],

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

    foreach ($user_list as $user_id) {

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

    $html_result .= '<th>'.get_lang('User').'</th>';

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

                        $html_result .= Display::tag('td', api_get_local_time($attempt_data['exe_date']));

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

                        $html_result .= '</tr>';

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

    echo $html_result;

Consider putting global function "export_complete_report_csv" in a static class
Open

function export_complete_report_csv($filename, $array)

There are no issues that match your filters.

Category
Status