$counter = 0; $main_result = array(); //Getting course list foreach ($course_list as $current_course) { $course_info = api_get_course_info($current_course['code']); $_course = $course_info; $attempt_result = array(); //Getting LP list $list = new LearnpathList('', $current_course['code'], $session_id); $lp_list = $list->get_flat_list(); // Looping LPs foreach ($lp_list as $lp_id => $lp) { $exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']); // Looping Chamilo Exercises in LP foreach ($exercise_list as $exercise) { $exercise_stats = Event::get_all_exercise_event_from_lp($exercise['path'], $course_info['real_id'], $session_id); // Looping Exercise Attempts foreach ($exercise_stats as $stats) { $attempt_result[$stats['exe_user_id']]['result'] += $stats['exe_result'] / $stats['exe_weighting']; $attempt_result[$stats['exe_user_id']]['attempts']++; } } } $main_result[$current_course['code']] = $attempt_result; } $total_average_score = 0; $total_average_score_count = 0; $html_result = ''; if (!empty($users) && is_array($users)) { $html_result .= '<table class="data_table">'; $html_result .= '<tr><th>' . get_lang('User') . '</th>';