function show_image(image,width,height) {
	width = parseInt(width) + 20;
	height = parseInt(height) + 20;
	window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
}
';
$export_csv = isset ($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
if ($export_csv) {
	ob_start();
}
$csv_content = array();
$from_myspace = false;
if (isset ($_GET['from']) && $_GET['from'] == 'myspace') {
	$from_myspace = true;
	$this_section = SECTION_TRACKING;
} else {
	$this_section = SECTION_COURSES;
}
$nameTools = get_lang('StudentDetails');
$get_course_code = Security :: remove_XSS($_GET['course']);
if (isset($_GET['details'])) {
	if (!empty ($_GET['origin']) && $_GET['origin'] == 'user_course') {
		$course_info = CourseManager :: get_course_information($get_course_code);
		if (empty ($cidReq)) {
			$interbreadcrumb[] = array (
				"url" => api_get_path(WEB_COURSE_PATH) . $course_info['directory'],
				'name' => $course_info['title']
			);
		}
		$interbreadcrumb[] = array (
			"url" => "../user/user.php?cidReq=" . $get_course_code,
			"name" => get_lang("Users")
		);
	} else
		if (!empty ($_GET['origin']) && $_GET['origin'] == 'tracking_course') {
			$course_info = CourseManager :: get_course_information($get_course_code);
			if (empty ($cidReq)) {
				//$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['title']);
			}
			$interbreadcrumb[] = array (
				"url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session=' . (empty ($_SESSION['id_session']) ? '' : $_SESSION['id_session']),
				"name" => get_lang("Tracking")
			);
		} else
			if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') {
				$interbreadcrumb[] = array (
					'url' => '../admin/index.php',
					"name" => get_lang('PlatformAdmin')
				);
				$interbreadcrumb[] = array (
					'url' => "../admin/session_list.php",
					"name" => get_lang('SessionList')
				);
				$interbreadcrumb[] = array (
					'url' => "../admin/resume_session.php?id_session=" . Security :: remove_XSS($_GET['id_session']),
					"name" => get_lang('SessionOverview')
				);
			} else {
				$interbreadcrumb[] = array (
					"url" => "index.php",
					"name" => get_lang('MySpace')
				);
				if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
					$interbreadcrumb[] = array (
						"url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
						"name" => get_lang("CoachStudents")
					);
					$interbreadcrumb[] = array (
						"url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']) . '&id_coach=' . Security :: remove_XSS($_GET['id_coach']),
						"name" => get_lang("StudentDetails")
					);
				} else {
					$interbreadcrumb[] = array (
						"url" => "student.php",
						"name" => get_lang("MyStudents")
					);
					$interbreadcrumb[] = array (
						"url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']),
						"name" => get_lang("StudentDetails")
					);
				}
			}
	$nameTools = get_lang("DetailsStudentInCourse");
} else {
	if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') {
		$interbreadcrumb[] = array (
			'url' => '../admin/index.php',
			"name" => get_lang('PlatformAdmin')
		);
		$interbreadcrumb[] = array (
			'url' => "../admin/session_list.php",
			"name" => get_lang('SessionList')
		);
		$interbreadcrumb[] = array (
			'url' => "../admin/resume_session.php?id_session=" . Security :: remove_XSS($_GET['id_session']),
			"name" => get_lang('SessionOverview')
		);
	} else {
		$interbreadcrumb[] = array (
			"url" => "index.php",
			"name" => get_lang('MySpace')
		);
		if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
			if (isset ($_GET['id_session']) && intval($_GET['id_session']) != 0) {
				$interbreadcrumb[] = array (
					"url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']) . "&id_session=" . $_GET['id_session'],
					"name" => get_lang("CoachStudents")
				);
			} else {
				$interbreadcrumb[] = array (
					"url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
					"name" => get_lang("CoachStudents")
				);
			}
		} else {
			$interbreadcrumb[] = array (
				"url" => "student.php",
				"name" => get_lang("MyStudents")
			);
		}
	}
}
// Database Table Definitions
$tbl_course_user 			= Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_stats_exercices 		= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
if (isset($_GET['user_id']) && $_GET['user_id'] != "") {
	$user_id = intval($_GET['user_id']);
} else {
	$user_id = api_get_user_id();
}
$session_id = intval($_GET['id_session']);
if (empty($session_id)) {
    $session_id = api_get_session_id();
}
$student_id = intval($_GET['student']);
// Action behaviour
$check = Security::check_token('get');
if ($check) {
	switch ($_GET['action']) {
		case 'reset_lp' :
                       $course		= isset($_GET['course']) ? $_GET['course']:"";
			$lp_id		= isset($_GET['lp_id'])	 ? intval($_GET['lp_id']):"";
			if (api_is_allowed_to_edit() && !empty($course) && !empty($lp_id) && !empty($student_id)) {
			    $course_info 	= api_get_course_info($course);
                delete_student_lp_events($student_id, $lp_id, $course_info, $session_id);
				//@todo delete the stats.track_e_exercices records. First implement this http://support.chamilo.org/issues/1334
				$message = Display::return_message(get_lang('LPWasReset'),'success');
			}
            break;
		default:
			break;
	}
	Security::clear_token();
}
// user info
$user_info = api_get_user_info($student_id);
$courses_in_session = array();
//See #4676
$drh_can_access_all_courses = false;
if (api_is_drh() || api_is_platform_admin()) {
    $drh_can_access_all_courses = true;
}
$courses = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
$courses_in_session_by_coach = array();
$sessions_coached_by_user = Tracking::get_sessions_coached_by_user(api_get_user_id());
// RRHH or session admin
if (api_is_session_admin() || api_is_drh()) {
    $courses = CourseManager::get_courses_followed_by_drh(api_get_user_id());
	$session_by_session_admin = SessionManager::get_sessions_followed_by_drh(api_get_user_id());
	if (!empty($session_by_session_admin)) {
		foreach ($session_by_session_admin as $session_coached_by_user) {
			$courses_followed_by_coach = Tracking :: get_courses_list_from_session($session_coached_by_user['id']);
			$courses_in_session_by_coach[$session_coached_by_user['id']] = $courses_followed_by_coach;
		}
	}
}
// Teacher or admin
if (!empty($sessions_coached_by_user)) {
	foreach ($sessions_coached_by_user as $session_coached_by_user) {
		$sid = intval($session_coached_by_user['id']);
		$courses_followed_by_coach = Tracking :: get_courses_followed_by_coach(api_get_user_id(), $sid);
		$courses_in_session_by_coach[$sid] = $courses_followed_by_coach;
	}
}
$sql = "SELECT course_code FROM $tbl_course_user
        WHERE relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND user_id = ".intval($user_info['user_id']);
$rs = Database::query($sql);
while ($row = Database :: fetch_array($rs)) {
    if ($drh_can_access_all_courses) {
        $courses_in_session[0][] = $row['course_code'];
    } else {
        if (isset($courses[$row['course_code']])) {
            $courses_in_session[0][] = $row['course_code'];
        }
    }
}
// Get the list of sessions where the user is subscribed as student
$sql = 'SELECT id_session, course_code FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).'
        WHERE id_user=' . intval($user_info['user_id']);
$rs = Database::query($sql);
$tmp_sessions = array();
while ($row = Database :: fetch_array($rs)) {
	$tmp_sessions[] = $row['id_session'];
    if ($drh_can_access_all_courses) {
        if (in_array($row['id_session'], $tmp_sessions)) {
            $courses_in_session[$row['id_session']][] = $row['course_code'];
        }
    } else {
        if (isset($courses_in_session_by_coach[$row['id_session']])) {
            if (in_array($row['id_session'], $tmp_sessions)) {
                $courses_in_session[$row['id_session']][] = $row['course_code'];
            }
        }
    }
}
if (api_is_drh() && !api_is_platform_admin()) {
    if (!empty($student_id)) {
        if (api_drh_can_access_all_session_content()) {
            //@todo securize drh with student id
            /*$users = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('drh_all', api_get_user_id());
            $userList = array();
            foreach ($users as $user) {
                $userList[] = $user['user_id'];
            }
            if (!in_array($student_id, $userList)) {
                api_not_allowed(true);
            }*/
        } else {
            if (api_is_drh() && !UserManager::is_user_followed_by_drh($student_id, api_get_user_id())) {
                api_not_allowed(true);
            }
        }
    }
}
Display :: display_header($nameTools);
if (isset($message)) {
    echo $message;
}
$token = Security::get_token();
if (!empty($student_id)) {
	// Actions bar
	echo '
';
    echo '
'.Display::return_icon('back.png', get_lang('Back'),'',ICON_SIZE_MEDIUM).'';
	echo '
'.Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'';
	echo '
'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).' ';
	if (!empty ($user_info['email'])) {
		$send_mail = '
'.Display :: return_icon('mail_send.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM).'';
	} else {
		$send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM);
	}
	echo $send_mail;
	if (!empty($student_id) && !empty($_GET['course'])) {
	    //only show link to connection details if course and student were defined in the URL
		echo '
'.
            Display :: return_icon('statistics.png', get_lang('AccessDetails'),'',ICON_SIZE_MEDIUM).'';
	}
    if (api_can_login_as($student_id)) {
        echo '
'.
            Display::return_icon('login_as.png', get_lang('LoginAs'), null, ICON_SIZE_MEDIUM).'  ';
    }
	echo '
 ';
	// is the user online ?
    if (user_is_online($_GET['student'])) {
        $online = get_lang('Yes');
    } else {
        $online = get_lang('No');
    }
	// get average of score and average of progress by student
	$avg_student_progress = $avg_student_score = 0;
	$course_code = Security :: remove_XSS($_GET['course']);
	if (!CourseManager :: is_user_subscribed_in_course($user_info['user_id'], $course_code, true)) {
		unset($courses[$key]);
	} else {
		$avg_student_progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, array(), $session_id);
		//the score inside the Reporting table
		$avg_student_score 	  = Tracking::get_avg_student_score($user_info['user_id'], $course_code, array(), $session_id);
		//var_dump($avg_student_score);
	}
	$avg_student_progress = round($avg_student_progress, 2);
	// time spent on the course
	$time_spent_on_the_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($user_info['user_id'], $course_code, $session_id));
	// get information about connections on the platform by student
	$first_connection_date = Tracking :: get_first_connection_date($user_info['user_id']);
	if ($first_connection_date == '') {
		$first_connection_date = get_lang('NoConnexion');
	}
	$last_connection_date = Tracking :: get_last_connection_date($user_info['user_id'], true);
	if ($last_connection_date == '') {
		$last_connection_date = get_lang('NoConnexion');
	}
	// cvs informations
	$csv_content[] = array (
		get_lang('Informations', '')
	);
	$csv_content[] = array (
		get_lang('Name', ''),
		get_lang('Email', ''),
		get_lang('Tel', '')
	);
	$csv_content[] = array (
		$user_info['complete_name'],
		$user_info['email'],
		$user_info['phone']
	);
	$csv_content[] = array ();
	// csv tracking
	$csv_content[] = array (
		get_lang('Tracking', '')
	);
	$csv_content[] = array (
		get_lang('FirstLogin', ''),
		get_lang('LatestLogin', ''),
		get_lang('TimeSpentInTheCourse', ''),
		get_lang('Progress', ''),
		get_lang('Score', '')
	);
	$csv_content[] = array (
		strip_tags($first_connection_date),
		strip_tags($last_connection_date),
		$time_spent_on_the_course,
		$avg_student_progress . '%',
		$avg_student_score
	);
    //Show title
    $info_course = CourseManager :: get_course_information($course_code);
    $coachs_name  = '';
    $session_name = '';
    $nb_login = Tracking :: count_login_per_student($user_info['user_id'], $_GET['course']);
    //get coach and session_name if there is one and if session_mode is activated
    if ($session_id > 0) {
        $session_info  = api_get_session_info($session_id);
        $course_coachs = api_get_coachs_from_course($session_id, $course_code);
        $nb_login = '';
        if (!empty($course_coachs)) {
            $info_tutor_name = array();
            foreach ($course_coachs as $course_coach) {
                $info_tutor_name[] = api_get_person_name($course_coach['firstname'], $course_coach['lastname']);
            }
            $info_course['tutor_name'] = implode(",",$info_tutor_name);
        } elseif ($session_coach_id != 0) {
            $session_coach_id = intval($session_info['id_coach']);
            $coach_info = UserManager::get_user_info_by_id($session_coach_id);
            $info_course['tutor_name'] = api_get_person_name($coach_info['firstname'], $coach_info['lastname']);
        }
        $coachs_name  = $info_course['tutor_name'];
        $session_name = $session_info['name'];
    } // end
    $info_course  = CourseManager :: get_course_information($get_course_code);
    $table_title = Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).$user_info['complete_name'];
    echo Display::page_subheader($table_title);
    echo '
 $courses) {
		$session_id   = $key;
		$session_info = api_get_session_info($session_id);
		$session_name = $session_info['name'];
		$date_start = '';
		if (!empty($session_info['date_start']) && $session_info['date_start'] != '0000-00-00') {
			$date_start = api_format_date($session_info['date_start'], DATE_FORMAT_SHORT);
		}
		$date_end = '';
		if (!empty($session_info['date_end']) && $session_info['date_end'] != '0000-00-00') {
			$date_end = api_format_date($session_info['date_end'], DATE_FORMAT_SHORT);
		}
		if (!empty($date_start) && !empty($date_end)) {
			$date_session = get_lang('From') . ' ' . $date_start . ' ' . get_lang('Until') . ' ' . $date_end;
		}
		$title = '';
		if (empty($session_id)) {
			$title = Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_SMALL).' '.get_lang('Courses');
		} else {
			$title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session?' ('.$date_session.')':'');
		}
		// Courses
		echo ''.$title.'
';
		echo '';
		echo '
				| '.get_lang('Course').' | 
				'.get_lang('Time').' | 
				'.get_lang('Progress').' | 
				'.get_lang('Score').' | 
				'.get_lang('AttendancesFaults').' | 
				'.get_lang('Evaluations').' | 
				'.get_lang('Details').' | 
			
';
		if (!empty($courses)) {
            foreach ($courses as $course_code) {
                if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
                    $course_info = CourseManager :: get_course_information($course_code);
    				$time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($user_info['user_id'], $course_code, $session_id));
    				// get average of faults in attendances by student
    				$results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $session_id);
    				if (!empty($results_faults_avg['total'])) {
    					if (api_is_drh()) {
    						$attendances_faults_avg = ''.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
    					} else {
    						$attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
    					}
    				} else {
    					$attendances_faults_avg = '0/0 (0%)';
    				}
    				// get evaluatios by student
    				$cats = Category::load(null, null, $course_code, null, null, $session_id);
    				$scoretotal = array();
    				if (isset($cats) && isset($cats[0])) {
    					if (!empty($session_id)) {
                            $scoretotal= $cats[0]->calc_score($student_id, $course_code, $session_id);
    					} else {
                            $scoretotal= $cats[0]->calc_score($student_id, $course_code);
    					}
    				}
    				$scoretotal_display = '0/0 (0%)';
    				if (!empty($scoretotal)) {
    					$scoretotal_display =  round($scoretotal[0],1).'/'.round($scoretotal[1],1).' ('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)';
    				}
    				$progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, null, $session_id);
    				$score = Tracking :: get_avg_student_score($user_info['user_id'], $course_code, null, $session_id);
    				$progress = empty($progress) ? '0%' : $progress.'%';
    				$score = empty($score) ? '0%' : $score.'%';
    				$csv_content[] = array (
        				$session_name,
        				$course_info['title'],
        				$time_spent_on_course,
        				$progress,
        				$score,
        				$attendances_faults_avg,
        				$scoretotal_display
    				);
    				echo '
    				| '.$course_info['title'].' | 
    				'.$time_spent_on_course .' | 
    				'.$progress.' | 
    				'.$score.' | 
    				'.$attendances_faults_avg.' | 
                    '.$scoretotal_display.' | ';
    				if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
    					echo '.'2rightarrow.gif)  | ';
    				} else {
    					echo '.'2rightarrow.gif)  | ';
    				}
				echo '
';
				}
			}
		} else {
        	echo "| ".get_lang('NoCourse')." | 
";
		}
		echo '
';
	}
} else {
	$csv_content[] = array ();
    $csv_content[] = array (str_replace(' ', '', $table_title));
    $t_lp = Database :: get_course_table(TABLE_LP_MAIN);
    // csv export headers
    $csv_content[] = array ();
    $csv_content[] = array (
    	get_lang('Learnpath', ''),
    	get_lang('Time', ''),
    	get_lang('AverageScore', ''),
    	get_lang('LatestScore', ''),
    	get_lang('Progress', ''),
    	get_lang('LastConnexion', '')
    );
    if (empty($session_id)) {
        $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp WHERE session_id = 0 AND c_id = {$info_course['real_id']} ORDER BY lp.display_order";
    } else {
    	$sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp WHERE c_id = {$info_course['real_id']}  ORDER BY lp.display_order";
    }
    $rs_lp = Database::query($sql_lp);
    if (Database :: num_rows($rs_lp) > 0) {
    ?>
        
        
            
                 | 
                 'absmiddle', 'hspace' => '3px')); ?> | 
                 'absmiddle', 'hspace' => '3px')); ?> | 
                 'absmiddle', 'hspace' => '3px')); ?> | 
                 'absmiddle','hspace' => '3px')); ?> | 
                 'absmiddle','hspace' => '3px')); ?> | 
                '.get_lang('Details').'';
                    if (api_is_allowed_to_edit()) {
                        echo ''.get_lang('ResetLP').' | ';
                    }
                ?>
              
        ';
    		echo Display::tag('td', stripslashes($lp_name));
    		echo Display::tag('td', api_time_to_hms($total_time));
    		if (!is_null($score)) {
    			if (is_numeric($score)) {
                    $score = $score.'%';
                }
    		}
    		echo Display::tag('td', $score);
    	    if (!is_null($score_latest)) {
                if (is_numeric($score_latest)) {
                    $score_latest = $score_latest.'%';
                }
            }
    		echo Display::tag('td', $score_latest);
    		if (is_numeric($progress)) {
    			$progress = $progress.'%';
    		} else {
    			$progress = '-';
    		}
    		echo Display::tag('td', $progress);
    	    //Do not change with api_convert_and_format_date, because this value came from the lp_item_view table
            //which implies several other changes not a priority right now
    		echo Display::tag('td', $start_time);
    		if ($any_result === true) {
    			$from = '';
    			if ($from_myspace) {
    				$from ='&from=myspace';
    			}
    			$link = Display::url('
','lp_tracking.php?course='.Security::remove_XSS($_GET['course']).$from.'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student_id='.$user_info['user_id'].'&id_session='.$session_id);
                echo Display::tag('td', $link);
    		}
    		if (api_is_allowed_to_edit()) {
    			echo '';
    				if ($any_result === true) {
    					echo '';
    					echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'';
    					echo '';
    				}
    				echo ' | ';
    			echo '';
    		}
    		$data_learnpath[$i][] = $lp_name;
    		$data_learnpath[$i][] = $progress . '%';
    	}
    } else {
    	//echo '| '.get_lang('NoLearnpath').' | 
';
    }
    ?>
    
	
		
			
				 | 
				 'absmiddle', 'hspace' => '3px')) ?> | 
				 | 
				 | 
				 | 
			
		 0) {
			while ($exercices = Database :: fetch_array($result_exercices)) {
				$exercise_id = intval($exercices['id']);
				$count_attempts   = Tracking::count_student_exercise_attempts($student_id, $course_code, $exercise_id, 0, 0, $session_id);
				$score_percentage = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $session_id);
				$csv_content[] = array (
					$exercices['title'],
					$score_percentage . '%',
					$count_attempts
				);
				if ($i % 2) $css_class = 'row_odd';
				else $css_class = 'row_even';
				echo '| '.$exercices['title'].' | ';
				echo '';
				if ($count_attempts > 0) {
					echo $score_percentage . '%';
				} else {
					echo '-';
					$score_percentage = 0;
				}
				echo ' | ';
				echo ''.$count_attempts.' | ';
				echo '';
				$sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
				                     WHERE  exe_exo_id      ="'.$exercise_id.'" AND
				                            exe_user_id     ="'.$student_id.'" AND
				                            exe_cours_id    ="'.$course_code.'" AND
                                            session_id      ="'.$session_id.'" AND
				                            status          = "" AND
				                            orig_lp_id      = 0 AND
				                            orig_lp_item_id = 0
				                            ORDER BY exe_date DESC LIMIT 1';
				$result_last_attempt = Database::query($sql_last_attempt);
				if (Database :: num_rows($result_last_attempt) > 0) {
					$id_last_attempt = Database :: result($result_last_attempt, 0, 0);
					if ($count_attempts > 0)
						echo '   ';
				}
				echo ' | ';
				echo '';
				$all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$session_id";
				echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url );
				echo ' | 
';
				$data_exercices[$i][] = $exercices['title'];
				$data_exercices[$i][] = $score_percentage . '%';
				$data_exercices[$i][] = $count_attempts;
				$i++;
			}
		} else {
			echo '| '.get_lang('NoExercise').' | 
';
		}
		echo '
';
        //@when using sessions we do not show the survey list
        if (empty($session_id)) {
            $survey_list = survey_manager::get_surveys($course_code, $session_id);
            $survey_data = array();
            foreach($survey_list as $survey) {
                $user_list = survey_manager::get_people_who_filled_survey($survey['survey_id'], false, $info_course['real_id']);
                $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL);
                if (in_array($student_id, $user_list)) {
                     $survey_done = Display::return_icon("accept.png", get_lang('Answered'), array(), ICON_SIZE_SMALL);
                }
                $data = array('title' => $survey['title'], 'done' => $survey_done);
                $survey_data[] = $data;
            }
            if (!empty($survey_list)) {
                $table = new HTML_Table(array('class' => 'data_table'));
                $header_names = array(get_lang('Survey'), get_lang('Answered'));
                $row = 0;
                $column = 0;
                foreach ($header_names as $item) {
                    $table->setHeaderContents($row, $column, $item);
                    $column++;
                }
                $row = 1;
                if (!empty($survey_data)) {
                    foreach ($survey_data as $data) {
                        $column = 0;
                        $table->setCellContents($row, $column, $data);
                        //$table->setRowAttributes($row, 'style="text-align:center"');
                        $class = 'class="row_odd"';
                        if($row % 2) {
                            $class = 'class="row_even"';
                        }
                        $table->setRowAttributes($row, $class, true);
                        $column++;
                        $row++;
                    }
                }
                echo $table->toHtml();
            }
         }
	    // line about other tools
		echo '';
		$csv_content[] = array ();
		$nb_assignments 		= Tracking::count_student_assignments($student_id, $course_code, $session_id);
		$messages 				= Tracking::count_student_messages($student_id, $course_code, $session_id);
		$links 					= Tracking::count_student_visited_links($student_id, $course_code, $session_id);
		$chat_last_connection 	= Tracking::chat_last_connection($student_id, $course_code, $session_id);
		$documents				= Tracking::count_student_downloaded_documents($student_id, $course_code, $session_id);
		$uploaded_documents		= Tracking::count_student_uploaded_documents($student_id, $course_code, $session_id);
		$csv_content[] = array (
			get_lang('Student_publication'),
			$nb_assignments
		);
		$csv_content[] = array (
			get_lang('Messages'),
			$messages
		);
		$csv_content[] = array (
			get_lang('LinksDetails'),
			$links
		);
		$csv_content[] = array (
			get_lang('DocumentsDetails'),
			$documents
		);
		$csv_content[] = array (
			get_lang('UploadedDocuments'),
			$uploaded_documents
		);
		$csv_content[] = array (
			get_lang('ChatLastConnection'),
			$chat_last_connection
		);
?>
		
			 | 
		
		
			 | 
			 | 
		
		
			 | 
			 | 
		
		
			 | 
			 | 
		
		
			 | 
			 | 
		
        
			 | 
			 | 
		
		
			 | 
			 |