$table->set_header(6, get_lang('Student_publication'), false);
 $table->set_header(7, get_lang('Messages'), false);
 $table->set_header(8, get_lang('FirstLogin'), false, 'align="center"');
 $table->set_header(9, get_lang('LatestLogin'), false, 'align="center"');
 $table->set_header(10, get_lang('Details'), false);
 if ($export_csv) {
     $csv_content[] = array();
 }
 $all_datas = array();
 $course_code = $_course['id'];
 foreach ($a_students as $student_id => $student) {
     $student_datas = UserManager::get_user_info_by_id($student_id);
     $avg_time_spent = $avg_student_score = $avg_student_progress = $total_assignments = $total_messages = 0;
     $nb_courses_student = 0;
     $avg_time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_code);
     $avg_student_score = Tracking::get_average_test_scorm_and_lp($student_id, $course_code);
     $avg_student_progress = Tracking::get_avg_student_progress($student_id, $course_code);
     $total_assignments = Tracking::count_student_assignments($student_id, $course_code);
     $total_messages = Tracking::count_student_messages($student_id, $course_code);
     $row = array();
     $row[] = $student_datas['official_code'];
     $row[] = $student_datas['lastname'];
     $row[] = $student_datas['firstname'];
     $row[] = api_time_to_hms($avg_time_spent);
     if (is_null($avg_student_score)) {
         $avg_student_score = 0;
     }
     if (is_null($avg_student_progress)) {
         $avg_student_progress = 0;
     }
     $row[] = $avg_student_progress . ' %';
     $a_courses[$row['course_code']] = $row['course_code'];
 }
 // get the list of sessions where the user is subscribed as student
 $sql = 'SELECT DISTINCT course_code FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . ' WHERE id_user='******'user_id']);
 $rs = api_sql_query($sql, __FILE__, __LINE__);
 while ($row = Database::fetch_array($rs)) {
     $a_courses[$row['course_code']] = $row['course_code'];
 }
 $course_id = Security::remove_XSS($_GET['course']);
 if (!CourseManager::is_user_subscribed_in_course($a_infosUser['user_id'], $course_id, true)) {
     unset($a_courses[$key]);
 } else {
     $nb_courses++;
     $avg_student_progress = Tracking::get_avg_student_progress($a_infosUser['user_id'], $course_id);
     //the score inside the Reporting table
     $avg_student_score = Tracking::get_average_test_scorm_and_lp($a_infosUser['user_id'], $course_id);
 }
 $avg_student_progress = round($avg_student_progress, 2);
 $avg_student_score = round($avg_student_score, 2);
 $first_connection_date = Tracking::get_first_connection_date($a_infosUser['user_id']);
 if ($first_connection_date == '') {
     $first_connection_date = get_lang('NoConnexion');
 }
 $last_connection_date = Tracking::get_last_connection_date($a_infosUser['user_id'], true);
 if ($last_connection_date == '') {
     $last_connection_date = get_lang('NoConnexion');
 }
 $time_spent_on_the_course = api_time_to_hms(Tracking::get_time_spent_on_the_course($a_infosUser['user_id'], $course_id));
 // cvs informations
 $csv_content[] = array(get_lang('Informations'));
 $csv_content[] = array(get_lang('Name'), get_lang('Email'), get_lang('Tel'));