Browse Source

[svn r16769] Applied patch to broken breadcrumb when entering admin page through session admin (private task FS#3102) by iflores

Yannick Warnier 16 years ago
parent
commit
ed7b9b593a

+ 17 - 34
main/admin/resume_session.php

@@ -1,27 +1,5 @@
-<?php
-// $Id: course_list.php,v 1.15.2.1 2005/10/31 09:15:57 olivierb78 Exp $
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2004 Dokeos S.A.
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) Olivier Brouckaert
-
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
-
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
-
-	See the GNU General Public License for more details.
-
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
-==============================================================================
-*/
+<?php // $Id: resume_session.php 16769 2008-11-17 22:19:30Z yannoo $
+/* For licensing terms, see /dokeos_license.txt */
 /**
 ==============================================================================
 	@author Bart Mollet
@@ -37,15 +15,15 @@
 // name of the language file that needs to be included
 $language_file = 'admin';
 $cidReset = true;
-require ('../inc/global.inc.php');
+require '../inc/global.inc.php';
 
 // setting the section (for the tabs)
 $this_section=SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script(true);
 $tool_name = get_lang('SessionOverview');
-$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang('SessionList'));
+$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[]=array('url' => 'session_list.php','name' => get_lang('SessionList'));
 
 // Database Table Definitions
 $tbl_session						= Database::get_main_table(TABLE_MAIN_SESSION);
@@ -58,7 +36,7 @@ $tbl_session_rel_course_rel_user	= Database::get_main_table(TABLE_MAIN_SESSION_C
 $tbl_class							= Database::get_main_table(TABLE_MAIN_CLASS);
 $tbl_class_rel_user					= Database::get_main_table(TABLE_MAIN_CLASS_USER);
 
-$id_session = $_GET['id_session'];
+$id_session = (int)$_GET['id_session'];
 
 $sql = 'SELECT name, nbr_courses, nbr_users, nbr_classes, DATE_FORMAT(date_start,"%d-%m-%Y") as date_start, DATE_FORMAT(date_end,"%d-%m-%Y") as date_end, lastname, firstname, username, session_admin_id, nb_days_access_before_beginning, nb_days_access_after_end
 		FROM '.$tbl_session.'
@@ -211,18 +189,22 @@ else {
 		$sql = 'SELECT COUNT(id_user) as nb_users FROM '.$tbl_session_rel_course_rel_user.' WHERE course_code="'.Database::escape_string($course['code']).'" AND id_session='.intval($id_session);
 		$rs = api_sql_query($sql, __FILE__, __LINE__);
 		$course['nbr_users'] = mysql_result($rs,0,0);
-		if(empty($course['username']))
-			$coach = get_lang('None');
-		else
+		if (empty($course['username'])) {
+			$coach = get_lang('None');		
+		} else {
 			$coach = $course['lastname'].' '.$course['firstname'].' ('.$course['username'].')';
+		}
+
+		$orig_param = '&origin=resume_session';	
+		//hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
 		echo '
 		<tr>
 			<td>'.$course['title'].' ('.$course['visual_code'].')</td>
 			<td>'.$coach.'</td>
 			<td>'.$course['nbr_users'].'</td>
 			<td>
-				<a href="../tracking/courseLog.php?id_session='.$id_session.'&cidReq='.$course['code'].'"><img src="../img/statistics.gif" border="0" style="vertical-align: middle;" title="'.get_lang('Tracking').'" alt="'.get_lang('Tracking').'"/></a>&nbsp;
-				<a href="session_course_edit.php?id_session='.$id_session.'&page=resume_session.php&course_code='.$course['code'].'"><img src="../img/edit.gif" border="0" align="absmiddle" title="'.get_lang('Edit').'"></a>
+				<a href="../tracking/courseLog.php?id_session='.$id_session.'&cidReq='.$course['code'].$orig_param.'&hide_course_breadcrumb=1"><img src="../img/statistics.gif" border="0" style="vertical-align: middle;" title="'.get_lang('Tracking').'" alt="'.get_lang('Tracking').'"/></a>&nbsp;
+				<a href="session_course_edit.php?id_session='.$id_session.'&page=resume_session.php&course_code='.$course['code'].''.$orig_param.'"><img src="../img/edit.gif" border="0" align="absmiddle" title="'.get_lang('Edit').'"></a>
 				<a href="'.api_get_self().'?id_session='.$id_session.'&action=delete&idChecked[]='.$course['code'].'" onclick="javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;"><img src="../img/delete.gif" border="0" align="absmiddle" title="'.get_lang('Delete').'"></a>
 			</td>
 		</tr>';
@@ -261,13 +243,14 @@ else {
 
 	$result=api_sql_query($sql,__FILE__,__LINE__);
 	$users=api_store_result($result);
+	$orig_param = '&origin=resume_session&id_session='.$id_session; // change breadcrumb in destination page
 	foreach($users as $user){
 		echo '<tr>
 					<td width="90%">
 						<b>'.$user['lastname'].' '.$user['firstname'].' ('.$user['username'].')</b>
 					</td>
 					<td>
-						<a href="../mySpace/myStudents.php?student='.$user['user_id'].'"><img src="../img/statistics.gif" border="0" style="vertical-align: middle;" title="'.get_lang('Reporting').'" alt="'.get_lang('Reporting').'"/></a>&nbsp;<a href="'.api_get_self().'?id_session='.$id_session.'&action=delete&user='.$user['user_id'].'" onclick="javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;"><img src="../img/delete.gif" border="0" align="absmiddle" title="'.get_lang('Delete').'"></a>
+						<a href="../mySpace/myStudents.php?student='.$user['user_id'].''.$orig_param.'"><img src="../img/statistics.gif" border="0" style="vertical-align: middle;" title="'.get_lang('Reporting').'" alt="'.get_lang('Reporting').'"/></a>&nbsp;<a href="'.api_get_self().'?id_session='.$id_session.'&action=delete&user='.$user['user_id'].'" onclick="javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;"><img src="../img/delete.gif" border="0" align="absmiddle" title="'.get_lang('Delete').'"></a>
 					</td>
 				  </tr>';
 	}

+ 22 - 20
main/admin/session_course_edit.php

@@ -1,10 +1,15 @@
-<?php
+<?php //$id: $
+/* For licensing terms, see /dokeos_license.txt */
+/**
+ * Implements the edition of course-session settings
+ * @package dokeos.admin
+ */
 // name of the language file that needs to be included 
 $language_file='admin';
 
 $cidReset=true;
 
-include('../inc/global.inc.php');
+require '../inc/global.inc.php';
 
 // setting the section (for the tabs)
 $this_section=SECTION_PLATFORM_ADMIN;
@@ -23,22 +28,22 @@ $tbl_course			= Database::get_main_table(TABLE_MAIN_COURSE);
 $tbl_session		= Database::get_main_table(TABLE_MAIN_SESSION);
 $tbl_session_course	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
 
-$tool_name=get_lang('ModifySessionCourse');
+$course_info=api_get_course_info($_REQUEST['course_code']);
+$tool_name=$course_info['name'];
+
+$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang("SessionList"));
+$interbreadcrumb[]=array('url' => "../admin/resume_session.php?id_session=".Security::remove_XSS($_REQUEST['id_session']),"name" => get_lang('SessionOverview'));
+$interbreadcrumb[]=array('url' => "session_course_list.php?id_session=$id_session","name" =>htmlentities($session_name,ENT_QUOTES,$charset));
 
 $result=api_sql_query("SELECT name,title FROM $tbl_session_course,$tbl_session,$tbl_course WHERE id_session=id AND course_code=code AND id_session='$id_session' AND course_code='".addslashes($course_code)."'",__FILE__,__LINE__);
 
-if(!list($session_name,$course_title)=mysql_fetch_row($result))
-{
+if (!list($session_name,$course_title)=mysql_fetch_row($result)) {
 	header('Location: session_course_list.php?id_session='.$id_session);
 	exit();
 }
 
-$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang("SessionList"));
-$interbreadcrumb[]=array('url' => "session_course_list.php?id_session=$id_session","name" => get_lang("CourseSessionList")." &quot;".htmlentities($session_name,ENT_QUOTES,$charset)."&quot;");
-
-if($_POST['formSent'])
-{
+if ($_POST['formSent']) {
 	$formSent=1;
 
 	$id_coach=intval($_POST['id_coach']);
@@ -50,13 +55,10 @@ if($_POST['formSent'])
 	header('Location: '.$_GET['page'].'?id_session='.$id_session);
 	exit();
 
-}
-else
-{
+}else {
 	$result=api_sql_query("SELECT id_coach FROM $tbl_session_course WHERE id_session='$id_session' AND course_code='$course_code'",__FILE__,__LINE__);
 
-	if(!$infos=mysql_fetch_array($result))
-	{
+	if (!$infos=Database::fetch_array($result)) {
 		//header('Location: '.$_GET['page'].'?id_session='.$id_session);
 		exit();
 	}
@@ -66,13 +68,13 @@ $sql="SELECT user_id,lastname,firstname,username FROM $tbl_user WHERE status='1'
 
 $result=api_sql_query($sql,__FILE__,__LINE__);
 
-$Coaches=api_store_result($result);
+$coaches=api_store_result($result);
 
 Display::display_header($tool_name);
 
+$tool_name=get_lang('ModifySessionCourse');
 api_display_tool_title($tool_name);
 ?>
-
 <form method="post" action="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $_GET['page'] ?>" style="margin:0px;">
 <input type="hidden" name="formSent" value="1">
 
@@ -104,7 +106,7 @@ if(!empty($errorMsg))
 	<option value="0" <?php if((!$sent && $enreg['user_id'] == $infos['id_coach']) || ($sent && $enreg['user_id'] == $id_coach)) echo 'selected="selected"'; ?>><?php echo get_lang('None') ?></option>
 <?php
 
-foreach($Coaches as $enreg)
+foreach($coaches as $enreg)
 {
 ?>
 
@@ -113,7 +115,7 @@ foreach($Coaches as $enreg)
 <?php
 }
 
-unset($Coaches);
+unset($coaches);
 ?>
 
   </select></td>

+ 92 - 216
main/inc/banner.inc.php

@@ -1,31 +1,8 @@
-<?php // $Id: banner.inc.php 16728 2008-11-12 15:49:54Z pcool $
- 
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2004-2008 Dokeos SPRL
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) various contributors
-
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
-
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
-
-	See the GNU General Public License for more details.
-
-	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
-	Mail: info@dokeos.com
-==============================================================================
-*/
+<?php //$id: $
+/* For licensing terms, see /dokeos_license.txt */
 /**
 ==============================================================================
-*	This script contains the actual html code to display the Dokeos header
+*	This script contains the actual html code to display the "header"
 *	or "banner" on top of every Dokeos page.
 *
 *	@package dokeos.include
@@ -41,7 +18,7 @@
 			$iname = api_get_setting('Institution');
 			if (!empty($iname))
 			{
-	echo '-&nbsp;<a href="'.$iurl.'" target="_top">'.$iname.'</a>';
+	           echo '-&nbsp;<a href="'.$iurl.'" target="_top">'.$iname.'</a>';
 			}
 			?>
 
@@ -52,46 +29,34 @@
 	Course title section
 -----------------------------------------------------------------------------
 */
-if (!empty($_cid) and $_cid != -1 and isset($_course))
-{
+if (!empty($_cid) and $_cid != -1 and isset($_course)) {
 	//Put the name of the course in the header
 	echo '
 		<div id="header1right">
 			<a href="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/index.php" target="_top">'.$_course['name'].' ';
-	if (api_get_setting("display_coursecode_in_courselist") == "true")
-	{
+	if (api_get_setting("display_coursecode_in_courselist") == "true") {
 		echo $_course['official_code'];
 	}
 
-	if(api_get_setting("use_session_mode") == "true" && isset($_SESSION['session_name']))
-	{
+	if(api_get_setting("use_session_mode") == "true" && isset($_SESSION['session_name'])) { 
 		echo ' ('.$_SESSION['session_name'].')';
 	}
-	if (api_get_setting("display_coursecode_in_courselist") == "true" AND api_get_setting("display_teacher_in_courselist") == "true")
-	{
+	if (api_get_setting("display_coursecode_in_courselist") == "true" AND api_get_setting("display_teacher_in_courselist") == "true") {
 		echo " - ";
 	}
-	if (api_get_setting("display_teacher_in_courselist") == "true")
-	{
+	if (api_get_setting("display_teacher_in_courselist") == "true") {
 		echo stripslashes($_course['titular']);
 	}
 	echo '	</a>';
 	echo '
 		</div>';
-}
-elseif (isset ($nameTools) && $language_file != 'course_home')
-{
+} elseif (isset ($nameTools) && $language_file != 'course_home') {
 	//Put the name of the user-tools in the header
-	if (!isset ($_user['user_id']))
-	{
+	if (!isset ($_user['user_id'])) {
 		echo " ";
-	}
-	elseif(!$noPHP_SELF)
-	{
+	} elseif(!$noPHP_SELF) {
 		echo "<div id=\"my_courses\"><a href=\"".api_get_self()."?".api_get_cidreq(), "\" target=\"_top\">", $nameTools, "</a></div>", "\n";
-	}
-	else
-	{
+	} else {
 		echo "<div id=\"my_courses\">$nameTools</div>\n";
 	}
 }
@@ -112,17 +77,16 @@ $web_course_path = api_get_path(WEB_COURSE_PATH);
 	External link section
 -----------------------------------------------------------------------------
 */
-if (isset($_course['extLink']) && $_course['extLink']['name'] != "")
-{
+if (isset($_course['extLink']) && $_course['extLink']['name'] != "") {
 	echo " / ";
-	if ($_course['extLink']['url'] != "")
-	{
+	if ($_course['extLink']['url'] != "") {
 		echo "<a href=\"".$_course['extLink']['url']."\" target=\"_top\">";
 		echo $_course['extLink']['name'];
 		echo "</a>";
-	}
-	else
+	} else {
 		echo $_course['extLink']['name'];
+	}
+		
 }
 ?>
 
@@ -133,35 +97,28 @@ if (isset($_course['extLink']) && $_course['extLink']['name'] != "")
 		<div id="header2right">
 			<ul>
 <?php 
-if ((api_get_setting('showonline','world') == "true" AND !$_user['user_id']) OR (api_get_setting('showonline','users') == "true" AND $_user['user_id']) OR (api_get_setting('showonline','course') == "true" AND $_user['user_id'] AND $_cid))
-{
-	if(api_get_setting("use_session_mode") == "true" && isset($_user['user_id']) && api_is_coach())
-	{
+if ((api_get_setting('showonline','world') == "true" AND !$_user['user_id']) OR (api_get_setting('showonline','users') == "true" AND $_user['user_id']) OR (api_get_setting('showonline','course') == "true" AND $_user['user_id'] AND $_cid)) {
+	if (api_get_setting("use_session_mode") == "true" && isset($_user['user_id']) && api_is_coach()) {
 		echo '	<li><a href="'.api_get_path(WEB_PATH).'whoisonlinesession.php?id_coach='.$_user['user_id'].'&amp;referer='.urlencode($_SERVER['REQUEST_URI']).'" target="_top">'.get_lang('UsersConnectedToMySessions').'</a></li>';
 	}
 
 	$statistics_database = Database :: get_statistic_database();
 	$number = count(WhoIsOnline(api_get_user_id(), $statistics_database, api_get_setting('time_limit_whosonline')));
-	if(!empty($_course['id']))
-	{
+	if(!empty($_course['id'])) {
 		$online_in_course = who_is_online_in_this_course(api_get_user_id(), api_get_setting('time_limit_whosonline'), $_course['id']);
 		$number_online_in_course= count( $online_in_course );
-	}
-	else
-	{
+	} else {
 		$number_online_in_course = 0;
 	}
 	echo '				<li>'.get_lang('UsersOnline').': ';
 
 	// Display the who's online of the platform
-	if ((api_get_setting('showonline','world') == "true" AND !$_user['user_id']) OR (api_get_setting('showonline','users') == "true" AND $_user['user_id']))
-	{
+	if ((api_get_setting('showonline','world') == "true" AND !$_user['user_id']) OR (api_get_setting('showonline','users') == "true" AND $_user['user_id'])) {
 		echo '<a href="'.api_get_path(WEB_PATH).'whoisonline.php" target="_top">'.$number.'</a>';
 	}
 
 	// Display the who's online for the course
-	if (is_array($_course) AND api_get_setting('showonline','course') == "true" AND isset($_course['sysCode']))
-	{
+	if (is_array($_course) AND api_get_setting('showonline','course') == "true" AND isset($_course['sysCode'])) {
 		echo "(<a href='".api_get_path(WEB_PATH)."whoisonline.php?cidReq=".$_course['sysCode']."' target='_top'>$number_online_in_course ".get_lang('InThisCourse')."</a>)";
 	}
 
@@ -169,19 +126,15 @@ if ((api_get_setting('showonline','world') == "true" AND !$_user['user_id']) OR
 	echo '</li>';
 }
 
-if ($_user['user_id'] && isset($_cid))
-{
-	if ((api_is_course_admin() || api_is_platform_admin()) && api_get_setting('student_view_enabled') == 'true')
-	{
+if ($_user['user_id'] && isset($_cid)) {
+	if ((api_is_course_admin() || api_is_platform_admin()) && api_get_setting('student_view_enabled') == 'true') {
 		echo '<li>| ';
 		api_display_tool_view_option();
 		echo '</li>';
 	}
 }
-if ( api_is_allowed_to_edit() )
-{
-	if(!empty($help))
-	{
+if ( api_is_allowed_to_edit() ) {
+	if(!empty($help)) {
 	// Show help
 	?>
 	<li>|
@@ -204,15 +157,11 @@ if ( api_is_allowed_to_edit() )
 	User section
 -----------------------------------------------------------------------------
 */
-if ($_user['user_id'])
-{
+if ($_user['user_id']) {
 	$login = '';
-	if(api_is_anonymous())
-	{
+	if(api_is_anonymous()) {
 		$login = '('.get_lang('Anonymous').')';
-	}
-	else
-	{
+	} else {
 		$uinfo = api_get_user_info(api_get_user_id());
 		$login = '('.$uinfo['username'].')';	
 	}
@@ -232,107 +181,73 @@ $navigation = array();
 $possible_tabs = get_tabs();
 
 // Campus Homepage
-if (api_get_setting('show_tabs', 'campus_homepage') == 'true')
-{
+if (api_get_setting('show_tabs', 'campus_homepage') == 'true') {
 	$navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
-}
-else
-{
+} else {
 	$menu_navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
 }
 
-if ($_user['user_id'] && !api_is_anonymous())
-{
+if ($_user['user_id'] && !api_is_anonymous()) {
 	// My Courses
-	if (api_get_setting('show_tabs', 'my_courses') == 'true')
-	{
+	if (api_get_setting('show_tabs', 'my_courses') == 'true') {
 		$navigation['mycourses'] = $possible_tabs['mycourses'];
-	}
-	else
-	{
+	} else{
 		$menu_navigation['mycourses'] = $possible_tabs['mycourses'];
 	}
 
 	// My Profile
-	if (api_get_setting('show_tabs', 'my_profile') == 'true')
-	{
+	if (api_get_setting('show_tabs', 'my_profile') == 'true') {
 		$navigation['myprofile'] = $possible_tabs['myprofile'];
-	}
-	else
-	{
+	} else {
 		$menu_navigation['myprofile'] = $possible_tabs['myprofile'];
 	}
 
 	// My Agenda
-	if (api_get_setting('show_tabs', 'my_agenda') == 'true')
-	{
+	if (api_get_setting('show_tabs', 'my_agenda') == 'true') {
 		$navigation['myagenda'] = $possible_tabs['myagenda'];
-	}
-	else
-	{
+	} else {
 		$menu_navigation['myagenda'] = $possible_tabs['myagenda'];
 	}
 
 	// Gradebook
-	if (api_get_setting('gradebook_enable') == 'true')
-	{
-		if (api_get_setting('show_tabs', 'my_gradebook') == 'true')
-		{
+	if (api_get_setting('gradebook_enable') == 'true') {
+		if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
 			$navigation['mygradebook'] = $possible_tabs['mygradebook'];
-		}
-		else
-		{
+		} else{
 			$menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
 		}
 	}
 	
 	// Reporting
-	if (api_get_setting('show_tabs', 'reporting') == 'true')
-	{
-		if(api_is_allowed_to_create_course() || $_user['status'] == DRH)
-		{
+	if (api_get_setting('show_tabs', 'reporting') == 'true') {
+		if(api_is_allowed_to_create_course() || $_user['status'] == DRH) {
 			$navigation['session_my_space'] = $possible_tabs['session_my_space'];
-		}
-		else
-		{
+		} else {
 			$navigation['session_my_space'] = $possible_tabs['session_my_progress'];
 		}
-	}
-	else
-	{
-		if(api_is_allowed_to_create_course() || $_user['status'] == DRH)
-		{
+	} else {
+		if(api_is_allowed_to_create_course() || $_user['status'] == DRH) {
 			$menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
-		}
-		else
-		{
+		} else {
 			$menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
 		}
 	}
 	
 	
-	if(api_is_platform_admin(true))
-	{
-		if (api_get_setting('show_tabs', 'platform_administration') == 'true')
-		{
+	if(api_is_platform_admin(true)) {
+		if (api_get_setting('show_tabs', 'platform_administration') == 'true') {
 			$navigation['platform_admin'] = $possible_tabs['platform_admin'];
-		}
-		else
-		{
+		} else {
 			$menu_navigation['platform_admin'] = $possible_tabs['platform_admin'];
 		}
 	}
 }
 
 // Displaying the tabs
-foreach($navigation as $section => $navigation_info)
-{
-	if(isset($GLOBALS['this_section']))
-	{
+foreach($navigation as $section => $navigation_info) {
+	if(isset($GLOBALS['this_section'])) {
 		$current = ($section == $GLOBALS['this_section'] ? ' id="current"' : '');
-	}
-	else
-	{
+	} else {
 		$current = '';
 	}
 	echo '			<li'.$current.'><a href="'.$navigation_info['url'].'" target="_top"><span>'.$navigation_info['title'].'</span></a></li>'."\n";
@@ -350,11 +265,10 @@ foreach($navigation as $section => $navigation_info)
  */
 $navigation = array();
 // part 1: Course Homepage. If we are in a course then the first breadcrumb is a link to the course homepage
-if (isset ($_cid) and $_cid!=-1 and isset($_course))
-{
+		//hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
+if (isset ($_cid) and $_cid!=-1 and isset($_course) and !isset($_GET['hide_course_breadcrumb'])) {
 	$navigation_item['url'] = $web_course_path . $_course['path'].'/index.php';
-	switch(api_get_setting('breadcrumbs_course_homepage'))
-	{
+	switch(api_get_setting('breadcrumbs_course_homepage')) {
 		case 'get_lang':
 			$navigation_item['title'] =  get_lang('CourseHomepageLink');
 			break;
@@ -368,10 +282,8 @@ if (isset ($_cid) and $_cid!=-1 and isset($_course))
 	$navigation[] = $navigation_item;
 }
 // part 2: Interbreadcrumbs. If there is an array $interbreadcrumb defined then these have to appear before the last breadcrumb (which is the tool itself)
-if (isset($interbreadcrumb) && is_array($interbreadcrumb))
-{
-	foreach($interbreadcrumb as $breadcrumb_step)
-	{
+if (isset($interbreadcrumb) && is_array($interbreadcrumb)) {
+	foreach($interbreadcrumb as $breadcrumb_step) {
 		$sep = (strrchr($breadcrumb_step['url'], '?') ? '&amp;' : '?');
 		$navigation_item['url'] = $breadcrumb_step['url'].$sep.api_get_cidreq();
 		$navigation_item['title'] = $breadcrumb_step['name'];
@@ -380,18 +292,15 @@ if (isset($interbreadcrumb) && is_array($interbreadcrumb))
 }
 // part 3: The tool itself. If we are on the course homepage we do not want to display the title of the course because this
 // is the same as the first part of the breadcrumbs (see part 1)
-if (isset ($nameTools) AND $language_file<>"course_home")
-{
+if (isset ($nameTools) AND $language_file<>"course_home") {
 	$navigation_item['url'] = '#';
 	$navigation_item['title'] = $nameTools;
 	$navigation[] = $navigation_item;
 }
 
 $final_navigation = array();
-foreach($navigation as $index => $navigation_info)
-{
-	if(!empty($navigation_info['title']))
-	{
+foreach($navigation as $index => $navigation_info) {
+	if(!empty($navigation_info['title'])) {
 		$final_navigation[$index] = '<a href="'.$navigation_info['url'].'" class="breadcrumb breadcrumb'.$index.'" target="_top">'.$navigation_info['title'].'</a>';
 	}
 }
@@ -401,16 +310,14 @@ echo implode(' &gt; ',$final_navigation);
 	</div>
 
 <?php
-if(api_get_setting('show_toolshortcuts')=='true')
-{
+if(api_get_setting('show_toolshortcuts')=='true') {
 	echo '<div id="toolshortcuts">';
 	require_once('tool_navigation_menu.inc.php');
  	show_navigation_tool_shortcuts();
   	echo '</div>';
 }
 
-if (isset ($dokeos_database_connection))
-{
+if (isset ($dokeos_database_connection)) {
 	// connect to the main database.
 	// if single database, don't pefix table names with the main database name in SQL queries
 	// (ex. SELECT * FROM `table`)
@@ -421,19 +328,16 @@ if (isset ($dokeos_database_connection))
 }
 ?>
 
-</div>
+</div> <!-- end of the whole #header section -->
 <div class="clear">&nbsp;</div>
 <?php
 //to mask the main div, set $header_hide_main_div to true in any script just before calling Display::display_header();
 global $header_hide_main_div;
-if(!empty($header_hide_main_div) && $header_hide_main_div===true)
-{
+if (!empty($header_hide_main_div) && $header_hide_main_div===true) {
 	//do nothing
-}
-else
-{
+} else {
 ?>
-<div id="main">
+<div id="main"> <!-- start of #main wrapper for #content and #menu divs -->
 <?php
 }
 /*
@@ -442,13 +346,11 @@ else
 -----------------------------------------------------------------------------
 */
 $chat = strpos(api_get_self(), 'chat_banner.php');
-if (!$chat)
-{
+if (!$chat) {
 	include_once (api_get_path(LIBRARY_PATH)."online.inc.php");
 	//echo $accept;
 	$chatcall = chatcall();
-	if ($chatcall)
-	{
+	if ($chatcall) {
 		Display :: display_normal_message($chatcall);
 	}
 }
@@ -458,31 +360,23 @@ if (!$chat)
 	Navigation menu section
 -----------------------------------------------------------------------------
 */
-if(api_get_setting('show_navigation_menu') != 'false' && api_get_setting('show_navigation_menu') != 'icons')
-{
+if(api_get_setting('show_navigation_menu') != 'false' && api_get_setting('show_navigation_menu') != 'icons') {
 	Display::show_course_navigation_menu($_GET['isHidden']);
-	if (isset($_cid) )
-	{
+	if (isset($_cid) ) {
 		echo '<div id="menuButton">';
  		echo $output_string_menu;
  		echo '</div>';
-		if(isset($_SESSION['hideMenu']))
-		{
-			if($_SESSION['hideMenu'] =="shown")
-			{
- 				if (isset($_cid) )
-               	{
-					echo '<div id="centerwrap">';
-					echo '<div id="center">';
+		if(isset($_SESSION['hideMenu'])) {
+			if($_SESSION['hideMenu'] =="shown") {
+ 				if (isset($_cid) ) {
+					echo '<div id="centerwrap"> <!-- start of #centerwrap -->';
+					echo '<div id="center"> <!-- start of #center -->';
 				}
 			}
- 		}
- 		else
- 		{
-			if (isset($_cid) )
-			{
-				echo '<div id="centerwrap">';
-				echo '<div id="center">';
+ 		} else {
+			if (isset($_cid) ) {
+				echo '<div id="centerwrap"> <!-- start of #centerwrap -->';
+				echo '<div id="center"> <!-- start of #center -->';
 			}
  		}
  	}
@@ -499,8 +393,7 @@ if(api_get_setting('show_navigation_menu') != 'false' && api_get_setting('show_n
  * @version Dokeos 1.8.4
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  */
-function get_tabs()
-{
+function get_tabs() {
 	global $_course, $rootAdminWeb, $_user;
 
 	// Campus Homepage
@@ -508,31 +401,18 @@ function get_tabs()
 	$navigation[SECTION_CAMPUS]['title'] = get_lang('CampusHomepage');
 
 	// My Courses
-	if(api_get_setting('use_session_mode')=='true')
-	{
-		if(api_is_allowed_to_create_course())
-		{
+	if(api_get_setting('use_session_mode')=='true') {
+		if(api_is_allowed_to_create_course()) {
 			// Link to my courses for teachers
 			$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php?nosession=true';
 			$navigation['mycourses']['title'] = get_lang('MyCourses');
-		}
-		else
-		{
+		} else {
 			// Link to my courses for students
 			$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
 			$navigation['mycourses']['title'] = get_lang('MyCourses');
 		}
 
-		// Link to active sessions
-		//$navigation[SECTION_ACTIVESESSIONS]['url'] = api_get_path(WEB_PATH).'user_portal.php';
-		//$navigation[SECTION_ACTIVESESSIONS]['title'] = get_lang('myActiveSessions');
-		// Link to inactive sessions
-		//$navigation[SECTION_INACTIVESESSIONS]['url'] = api_get_path(WEB_PATH).'user_portal.php?inactives';
-		//$navigation[SECTION_INACTIVESESSIONS]['title'] = get_lang('myInActiveSessions');
-
-	}
-	else
-	{
+	} else {
 		// Link to my courses
 		$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
 		$navigation['mycourses']['title'] = get_lang('MyCourses');
@@ -547,29 +427,24 @@ function get_tabs()
 	$navigation['myagenda']['title'] = get_lang('MyAgenda');
 
 	// Gradebook
-	if (api_get_setting('gradebook_enable') == 'true')
-	{
+	if (api_get_setting('gradebook_enable') == 'true') {
 		$navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );	
 		$navigation['mygradebook']['title'] = get_lang('MyGradebook');
 	}
 
 	// Reporting
-	if(api_is_allowed_to_create_course() || $_user['status']==DRH)
-	{
+	if(api_is_allowed_to_create_course() || $_user['status']==DRH) {
 		// Link to my space
 		$navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/';
 		$navigation['session_my_space']['title'] = get_lang('MySpace');
-	}
-	else
-	{
+	} else {
 		// Link to my progress
 		$navigation['session_my_progress']['url'] = api_get_path(WEB_CODE_PATH).'auth/my_progress.php';
 		$navigation['session_my_progress']['title'] = get_lang('MyProgress');
 	}
 
 	// Platform administration
-	if (api_is_platform_admin(true))
-	{
+	if (api_is_platform_admin(true)) {
 		//$navigation['platform_admin']['url'] = $rootAdminWeb;
 		$navigation['platform_admin']['url'] = api_get_path(WEB_CODE_PATH).'admin/';
 		$navigation['platform_admin']['title'] = get_lang('PlatformAdmin');
@@ -578,3 +453,4 @@ function get_tabs()
 	return $navigation;
 }
 ?>
+<!--   Begin Of script Output   -->

+ 54 - 76
main/mySpace/myStudents.php

@@ -1,101 +1,79 @@
-<?php // $Id: myStudents.php 16739 2008-11-13 15:36:40Z pcool $
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2004-2008 Dokeos SPRL
-	Copyright (c) 2003 Ghent University (UGent)
-
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
-
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
-
-	See the GNU General Public License for more details.
-
-	Contact: Dokeos, rue Notre Dame, 152, B-1140 Evere, Belgium, info@dokeos.com
-==============================================================================
-*/
+<?php //$Id: myStudents.php 16769 2008-11-17 22:19:30Z yannoo $
+/* For licensing terms, see /dokeos_license.txt */
+/**
+ * Implements the tracking of students in the Reporting pages
+ * @package dokeos.mySpace
+ */
  
  // name of the language file that needs to be included 
 $language_file = array ('registration', 'index', 'tracking', 'exercice','admin');
 $cidReset=true;
-include ('../inc/global.inc.php');
+require '../inc/global.inc.php';
+require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
+require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
+require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
+require_once api_get_path(LIBRARY_PATH).'course.lib.php';
+require_once '../newscorm/learnpath.class.php';
 
-include_once(api_get_path(LIBRARY_PATH).'tracking.lib.php');
-include_once(api_get_path(LIBRARY_PATH).'export.lib.inc.php');
-include_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
-include_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-include_once('../newscorm/learnpath.class.php');
- 
- 
 $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
-if($export_csv)
-{
+
+if ($export_csv) {
 	ob_start();
 }
 $csv_content = array();
- 
- $this_section = "session_my_space";
- 
- $nameTools=get_lang("StudentDetails");
- 
+
+$this_section = "session_my_space";
+
+$nameTools=get_lang("StudentDetails");
+//$nameTools=SECTION_PLATFORM_ADMIN;
  
  
- if(isset($_GET['details']))
- {
- 	if(!empty($_GET['origin']) && $_GET['origin'] == 'user_course')
- 	{
+if (isset($_GET['details'])) {
+ 	if (!empty($_GET['origin']) && $_GET['origin'] == 'user_course') {
  		$course_infos = CourseManager :: get_course_information($_GET['course']);
- 		if(empty($cidReq))
+ 		if (empty($cidReq)) {
  			$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_infos['directory'], 'name' => $course_infos['title']);
+ 		}
  		$interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$_GET['course'], "name" => get_lang("Users"));
- 	}
- 	else if(!empty($_GET['origin']) && $_GET['origin'] == 'tracking_course')
- 	{
+ 	} else if (!empty($_GET['origin']) && $_GET['origin'] == 'tracking_course') {
  		$course_infos = CourseManager :: get_course_information($_GET['course']);
- 		if(empty($cidReq))
+ 		if (empty($cidReq)) {
  			$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_infos['directory'], 'name' => $course_infos['title']);
+ 		}
  		$interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$_GET['course'].'&studentlist=true&id_session='.(empty($_SESSION['id_session'])?'':$_SESSION['id_session']), "name" => get_lang("Tracking"));
- 	}
- 	else
- 	{
+ 	} 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=".$_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_coach']) && intval($_GET['id_coach'])!=0) {
  			$interbreadcrumb[] = array ("url" => "student.php?id_coach=".$_GET['id_coach'], "name" => get_lang("CoachStudents"));
  			$interbreadcrumb[] = array ("url" => "myStudents.php?student=".$_GET['student'].'&id_coach='.$_GET['id_coach'], "name" => get_lang("StudentDetails"));
- 		}
- 		else{
+ 		} else {
  			$interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents"));
  			$interbreadcrumb[] = array ("url" => "myStudents.php?student=".$_GET['student'], "name" => get_lang("StudentDetails"));
  		}	 	
  	}
  	$nameTools=get_lang("DetailsStudentInCourse");
- }
- else
- {
- 	$interbreadcrumb[] = array ('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin'));
- 	
- 	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=".$_GET['id_coach']."&id_session=".$_GET['id_session'], "name" => get_lang("CoachStudents"));
- 		}
- 		else
- 		{
- 			$interbreadcrumb[] = array ("url" => "student.php?id_coach=".$_GET['id_coach'], "name" => get_lang("CoachStudents"));
- 		}
- 	}
- 	else
- 	{ 
- 		$interbreadcrumb[] = array ('url' => '../admin/user_list.php', 'name' => get_lang('UserList'));
- 		
+} 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"));
+	 	}
  	}
- }
+}
  
 api_block_anonymous_users();
 
@@ -718,9 +696,7 @@ if(!empty($_GET['student']))
 					
 					if(Database::num_rows($rs_lp_item_id_scorm)>0){
 						$lp_item_id = Database::result($rs_lp_item_id_scorm,0,'id');
-						
 						$lp_item__max_score = Database::result($rs_lp_item_id_scorm,0,'max_score');	
-						
 						$total_weighting+=$lp_item__max_score;
 						
 						//We get the last view id of this LP
@@ -841,6 +817,7 @@ if(!empty($_GET['student']))
 									FROM ".$t_quiz." AS quiz
 									WHERE active='1' ORDER BY quiz.title ASC
 									";
+		
 				$resultExercices = api_sql_query($sqlExercices,__FILE__,__LINE__);
 				$i = 0;
 				if(Database::num_rows($resultExercices)>0)
@@ -862,6 +839,7 @@ if(!empty($_GET['student']))
 									 AND exe_cours_id = '".$a_infosCours['code']."'
 									 AND exe_exo_id = ".$a_exercices['id']."
 									 ORDER BY exe_date DESC LIMIT 1";
+	
 						$resultScore = api_sql_query($sqlScore,__FILE__,__LINE__);
 						$score = 0; 
 						while($a_score = Database::fetch_array($resultScore))
@@ -1067,12 +1045,12 @@ if(!empty($_GET['student']))
 						</td>';
 						if(isset($_GET['id_coach']) && intval($_GET['id_coach'])!=0){
 							echo '<td align="center" width="10">
-								<a href="'.api_get_self().'?student='.$a_infosUser['user_id'].'&details=true&course='.$course_infos['code'].'&id_coach='.$_GET['id_coach'].'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>
+								<a href="'.api_get_self().'?student='.$a_infosUser['user_id'].'&details=true&course='.$course_infos['code'].'&id_coach='.Security::remove_XSS($_GET['id_coach']).'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.Security::remove_XSS($_GET['id_session']).'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>
 							</td>';
 						}
 						else{
 							echo '<td align="center" width="10">
-								<a href="'.api_get_self().'?student='.$a_infosUser['user_id'].'&details=true&course='.$course_infos['code'].'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>
+								<a href="'.api_get_self().'?student='.$a_infosUser['user_id'].'&details=true&course='.$course_infos['code'].'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.Security::remove_XSS($_GET['id_session']).'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>
 							</td>';
 						}
 					echo '</tr>';

+ 115 - 195
main/tracking/courseLog.php

@@ -1,25 +1,5 @@
-<?php // $Id: courseLog.php 16739 2008-11-13 15:36:40Z pcool $
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2004-2008 Dokeos SPRL
-	Copyright (c) 2003 Ghent University (UGent)
-
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
-
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
-
-	See the GNU General Public License for more details.
-
-	Contact: Dokeos, rue Notre Dame, 152, B-1140 Evere, Belgium, info@dokeos.com
-==============================================================================
-*/
-
+<?php //$id: $
+/* For licensing terms, see /dokeos_license.txt */
 /**
 ==============================================================================
 *	@author Thomas Depraetere
@@ -31,61 +11,50 @@
 *	@package dokeos.tracking
 ==============================================================================
 */
-
-/*
-==============================================================================
-		INIT SECTION
-==============================================================================
-*/
+/**
+ *	INIT SECTION
+ */
 $pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
-// name of the language file that needs to be included 
 
+// name of the language file that needs to be included 
+$language_file[] = 'admin';
 $language_file[] = 'tracking';
 $language_file[] = 'scorm';
 
-include('../inc/global.inc.php');
-
-
+require '../inc/global.inc.php';
 $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin;
 
-if(!$is_allowedToTrack)
-{
+if (!$is_allowedToTrack) {
 	Display :: display_header(null);
 	api_not_allowed();
 	Display :: display_footer();
 }
-
 //includes for SCORM and LP
-require_once('../newscorm/learnpath.class.php');
-require_once('../newscorm/learnpathItem.class.php');
-require_once('../newscorm/learnpathList.class.php');
-require_once('../newscorm/scorm.class.php');
-require_once('../newscorm/scormItem.class.php');
-require_once(api_get_path(LIBRARY_PATH).'tracking.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
-require_once (api_get_path(LIBRARY_PATH).'export.lib.inc.php');
-require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
-
-
+require_once '../newscorm/learnpath.class.php';
+require_once '../newscorm/learnpathItem.class.php';
+require_once '../newscorm/learnpathList.class.php';
+require_once '../newscorm/scorm.class.php';
+require_once '../newscorm/scormItem.class.php';
+require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
+require_once api_get_path(LIBRARY_PATH).'course.lib.php';
+require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
+require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
+require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
 
 $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
-if($export_csv)
-{
+if ($export_csv) {
 	ob_start();
 }
 $csv_content = array();
 
 // charset determination
-if (!empty($_GET['scormcontopen']))
-{
-	$tbl_lp = Database::get_course_table('lp');
-	$contopen = (int) $_GET['scormcontopen'];
-	$sql = "SELECT default_encoding FROM $tbl_lp WHERE id = ".$contopen;
-	$res = api_sql_query($sql,__FILE__,__LINE__);
-	$row = Database::fetch_array($res);
-	$lp_charset = $row['default_encoding'];
-	//header('Content-Type: text/html; charset='. $row['default_encoding']);
+if (!empty($_GET['scormcontopen'])) {
+    $tbl_lp = Database::get_course_table('lp');
+    $contopen = (int) $_GET['scormcontopen'];
+    $sql = "SELECT default_encoding FROM $tbl_lp WHERE id = ".$contopen;
+    $res = api_sql_query($sql,__FILE__,__LINE__);
+    $row = Database::fetch_array($res);
+    $lp_charset = $row['default_encoding'];
 }
 
 $htmlHeadXtra[] = "<style type='text/css'>
@@ -99,7 +68,6 @@ $htmlHeadXtra[] = "<style type='text/css'>
 
 </style>";
 
-
 /*
 -----------------------------------------------------------
 	Constants and variables
@@ -126,37 +94,42 @@ $tbl_learnpath_item = Database::get_course_table(TABLE_LP_ITEM);
 $tbl_learnpath_view = Database::get_course_table(TABLE_LP_VIEW);
 $tbl_learnpath_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
 
+if (isset($_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='.$_SESSION['id_session'],'name' => get_lang('SessionOverview'));
+}
+
 $view = (isset($_REQUEST['view'])?$_REQUEST['view']:'');
 
 $nameTools = get_lang('Tracking');
 
-Display::display_header($nameTools, "Tracking");
-include(api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php");
-include("../resourcelinker/resourcelinker.inc.php");
+Display::display_header($nameTools, 'Tracking');
 
+require api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
+require '../resourcelinker/resourcelinker.inc.php';
 
- 
 $a_students = CourseManager :: get_student_list_from_course_code($_course['id'], true, (empty($_SESSION['id_session'])?null:$_SESSION['id_session']));
 $nbStudents = count($a_students);
 
 /**
  * count the number of students in this course (used for SortableTable)
  */
-function count_student_in_course()
-{
+function count_student_in_course() {
 	global $nbStudents;
 	return $nbStudents;
 }
 
 
 
-function sort_users($a,$b){
+function sort_users($a,$b) {
 	$a = trim(strtolower($a[$_SESSION['tracking_column']]));
 	$b = trim(strtolower($b[$_SESSION['tracking_column']]));
-	if($_SESSION['tracking_direction'] == 'DESC')
+	if ($_SESSION['tracking_direction'] == 'DESC') {
 		return strcmp($b, $a);
-	else
+    } else {
 		return strcmp($a, $b);
+    }
 }
 
 /*
@@ -166,28 +139,21 @@ function sort_users($a,$b){
 */
 
 echo '<div class="actions">';
-if($_GET['studentlist'] == 'false')
-{
+if ($_GET['studentlist'] == 'false') {
 	echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a>&nbsp;|&nbsp;'.get_lang('CourseTracking');
-}
-else
-{
+} else {
 	echo get_lang('StudentsTracking').' | <a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a>';
 }
 echo '&nbsp;<a href="#" onclick="window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>';
-if($_GET['studentlist'] == 'false')
-{	
+if($_GET['studentlist'] == 'false') {	
 	echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&studentlist=false"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
-}
-else
-{
+} else {
 	echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
 }
 echo '</div>';
 
 
-if($_GET['studentlist'] == 'false')
-{
+if($_GET['studentlist'] == 'false') {
 	echo'<br /><br />';
 	
 	
@@ -195,84 +161,70 @@ if($_GET['studentlist'] == 'false')
 	 * LEARNING PATHS
 	 ***************************/
 	 
-	 echo "<div class='admin_section'>
+	 echo '<div class="admin_section">
 				<h4>
-					<img src='../img/scormbuilder.gif' align='absbottom'>&nbsp;".get_lang('AverageProgressInLearnpath')."
+					<img src="../img/scormbuilder.gif" align="absbottom">&nbsp;'.get_lang('AverageProgressInLearnpath').'
 				</h4>
-			<table class='data_table'>";
+			<table class="data_table">';
 			
 	$list = new LearnpathList($student);
 	$flat_list = $list->get_flat_list();
 	
-	if($export_csv){
+	if ($export_csv) {
     	$temp=array(get_lang('AverageProgressInLearnpath'),'');
     	$csv_content[] = array('','');
     	$csv_content[] = $temp;
     }
 	
-	if(count($flat_list)>0)
-	{
-		foreach($flat_list as $lp_id => $lp)
-		{
+	if (count($flat_list)>0)	{
+		foreach ($flat_list as $lp_id => $lp) {
 			$lp_avg_progress = 0;
-			foreach($a_students as $student_id => $student)
-			{
+			foreach ($a_students as $student_id => $student) {
 				
 				// get the progress in learning pathes	
 				$lp_avg_progress += learnpath::get_db_progress($lp_id,$student_id);
 				
 				
 			}
-			if($nbStudents > 0)
-			{
+			if($nbStudents > 0) {
 				$lp_avg_progress = $lp_avg_progress / $nbStudents;
 			}
 			echo '<tr><td>'.$lp['lp_name'].'</td><td align="right">'.round($lp_avg_progress,1).' %</td></tr>';
-			if($export_csv){
+			if($export_csv) {
 				$temp=array($lp['lp_name'],$lp_avg_progress);
 				$csv_content[] = $temp;
 			}
 		}
-	}
-	else
-	{
+	} else {
 		echo '<tr><td>'.get_lang('NoLearningPath').'</td></tr>';
-		if($export_csv){
+		if ($export_csv) {
     		$temp=array(get_lang('NoLearningPath'),'');
 			$csv_content[] = $temp;
     	}
 	}
-	
 	echo '</table></div>';
-	
-	
 	echo '<div class="clear"></div>';
-	
-	
 	/***************************
 	 * EXERCICES
 	 ***************************/
-	 
-	 echo "<div class='admin_section'>
+	 echo '<div class="admin_section">
 				<h4>
-					<img src='../img/quiz.gif' align='absbottom'>&nbsp;".get_lang('AverageResultsToTheExercices')." <a href='../exercice/exercice.php?".api_get_cidreq()."&show=result'>".get_lang('SeeDetail')."</a>
+					<img src="../img/quiz.gif" align="absbottom">&nbsp;'.get_lang('AverageResultsToTheExercices').' <a href="../exercice/exercice.php?'.api_get_cidreq().'&show=result">'.get_lang('SeeDetail').'</a>
 				</h4>
-			<table class='data_table'>";
+			<table class="data_table">';
 			
 	$sql = "SELECT id, title
 			FROM ".Database :: get_course_table(TABLE_QUIZ_TEST);
 	$rs = api_sql_query($sql, __FILE__, __LINE__);
 	
-	if($export_csv){
+	if ($export_csv) {
     	$temp=array(get_lang('AverageProgressInLearnpath'),'');
     	$csv_content[] = array('','');
     	$csv_content[] = $temp;
     }
 	
-	if(Database::num_rows($rs)>0)
-	{
-		while($quiz = Database::fetch_array($rs))
-		{
+	if (Database::num_rows($rs)>0) {
+		while($quiz = Database::fetch_array($rs)) {
 			$quiz_avg_score = 0;
 			
 			// get the progress in learning pathes	
@@ -283,29 +235,25 @@ if($_GET['studentlist'] == 'false')
 					LIMIT 0, 1';
 			$rsAttempt = api_sql_query($sql, __FILE__, __LINE__);
 			$nb_attempts = 0;
-			while($attempt = Database::fetch_array($rsAttempt))
-			{
+			while ($attempt = Database::fetch_array($rsAttempt)) {
 				$nb_attempts++;
 				$exe_weight=$attempt['exe_weighting'];
-				if ($exe_weight>0)
-				{
+				if ($exe_weight>0) {
 					$quiz_avg_score += $attempt['exe_result']/$exe_weight*100;
 				}
 			}
-			if($nb_attempts>0)
+			if($nb_attempts>0) {
 				$quiz_avg_score = $quiz_avg_score / $nb_attempts;
-			
+            }
 			echo '<tr><td>'.$quiz['title'].'</td><td align="right">'.round($quiz_avg_score,1).' %</td></tr>';
-			if($export_csv){
+			if ($export_csv) {
 				$temp=array($quiz['title'],$quiz_avg_score);
 				$csv_content[] = $temp;
 			}
 		}
-	}
-	else
-	{
+	} else {
 		echo '<tr><td>'.get_lang('NoExercises').'</td></tr>';
-		if($export_csv){
+		if($export_csv) {
     		$temp=array(get_lang('NoExercises'),'');
 			$csv_content[] = $temp;
     	}
@@ -313,39 +261,35 @@ if($_GET['studentlist'] == 'false')
 	
 	echo '</table></div>';
 	echo '<div class="clear"></div>';
-	
-	
 	/**********************
 	 * TOOLS
 	 **********************/
-	
-	echo "<div class='admin_section'>
+	echo '<div class="admin_section">
 				<h4>
-					<img src='../img/acces_tool.gif' align='absbottom'>&nbsp;".get_lang('ToolsMostUsed')."
+					<img src="../img/acces_tool.gif" align="absbottom">&nbsp;'.get_lang('ToolsMostUsed').'
 				</h4>
-			<table class='data_table'>";
+			<table class="data_table">';
 			 
-	$sql = "SELECT `access_tool`, COUNT(DISTINCT `access_user_id`),count( `access_tool` ) as count_access_tool
+	$sql = "SELECT access_tool, COUNT(DISTINCT access_user_id),count( access_tool ) as count_access_tool
             FROM $TABLETRACK_ACCESS
-            WHERE `access_tool` IS NOT NULL
-                AND `access_cours_code` = '$_cid'
-            GROUP BY `access_tool`
+            WHERE access_tool IS NOT NULL
+                AND access_cours_code = '$_cid'
+            GROUP BY access_tool
 			ORDER BY count_access_tool DESC
 			LIMIT 0, 3";
 	$rs = api_sql_query($sql, __FILE__, __LINE__);
 	
-	 if($export_csv){
+	if ($export_csv) {
     	$temp=array(get_lang('ToolsMostUsed'),'');
     	$csv_content[] = $temp;
     }
 	
-	while ($row = Database::fetch_array($rs))
-	{
+	while ($row = Database::fetch_array($rs)) {
 		echo '	<tr>
 					<td>'.get_lang(ucfirst($row['access_tool'])).'</td>
 					<td align="right">'.$row['count_access_tool'].' '.get_lang('Clicks').'</td>
 				</tr>';
-		if($export_csv){
+		if ($export_csv) {
 			$temp=array(get_lang(ucfirst($row['access_tool'])),$row['count_access_tool'].' '.get_lang('Clicks'));
 			$csv_content[] = $temp;
 		}
@@ -360,45 +304,41 @@ if($_GET['studentlist'] == 'false')
 	 * DOCUMENTS
 	 ***************************/
 	 
-	 echo "<div class='admin_section'>
+	 echo '<div class="admin_section">
 				<h4>
-					<img src='../img/documents.gif' align='absbottom'>&nbsp;".get_lang('DocumentsMostDownloaded')."
+					<img src="../img/documents.gif" align="absbottom">&nbsp;'.get_lang('DocumentsMostDownloaded').'
 				</h4>
-			<table class='data_table'>";
+			<table class="data_table">';
 			
-	$sql = "SELECT `down_doc_path`, COUNT(DISTINCT `down_user_id`), COUNT(`down_doc_path`) as count_down
+	$sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down
             FROM $TABLETRACK_DOWNLOADS
-            WHERE `down_cours_id` = '$_cid'
-            GROUP BY `down_doc_path`
+            WHERE down_cours_id = '$_cid'
+            GROUP BY down_doc_path
 			ORDER BY count_down DESC
 			LIMIT 0, 3";
     $rs = api_sql_query($sql, __FILE__, __LINE__);
     
-    if($export_csv){
+    if ($export_csv) {
     	$temp=array(get_lang('DocumentsMostDownloaded'),'');
     	$csv_content[] = array('','');
     	$csv_content[] = $temp;
     }
     
-    if(Database::num_rows($rs)>0)
-    {
-	    while($row = Database::fetch_array($rs))
-	    {
+    if (Database::num_rows($rs)>0) {
+	    while($row = Database::fetch_array($rs)) {
 	    	echo '	<tr>
 						<td>'.$row['down_doc_path'].'</td>
 						<td align="right">'.$row['count_down'].' '.get_lang('Clicks').'</td>
 					</tr>';
 					
-			if($export_csv){
+			if ($export_csv) {
 				$temp=array($row['down_doc_path'],$row['count_down'].' '.get_lang('Clicks'));
 				$csv_content[] = $temp;
 			}
 	    }
-    }
-    else
-    {
+    } else {
     	echo '<tr><td>'.get_lang('NoDocumentDownloaded').'</td></tr>';
-    	if($export_csv){
+    	if ($export_csv) {
     		$temp=array(get_lang('NoDocumentDownloaded'),'');
 			$csv_content[] = $temp;
     	}
@@ -412,31 +352,29 @@ if($_GET['studentlist'] == 'false')
 	 * LINKS
 	 ***************************/
 	 
-	 echo "<div class='admin_section'>
+	 echo '<div class="admin_section">
 				<h4>
-					<img src='../img/link.gif' align='absbottom'>&nbsp;".get_lang('LinksMostClicked')."
+					<img src="../img/link.gif" align="absbottom">&nbsp;'.get_lang('LinksMostClicked').'
 				</h4>
-			<table class='data_table'>";
+			<table class="data_table">';
 			
-	$sql = "SELECT `cl`.`title`, `cl`.`url`,count(DISTINCT `sl`.`links_user_id`), count(`cl`.`title`) as count_visits
+	$sql = "SELECT cl.title, cl.url,count(DISTINCT sl.links_user_id), count(cl.title) as count_visits
             FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
-            WHERE `sl`.`links_link_id` = `cl`.`id`
-                AND `sl`.`links_cours_id` = '$_cid'
-            GROUP BY `cl`.`title`, `cl`.`url`
+            WHERE sl.links_link_id = cl.id
+                AND sl.links_cours_id = '$_cid'
+            GROUP BY cl.title, cl.url
 			ORDER BY count_visits DESC
 			LIMIT 0, 3";
     $rs = api_sql_query($sql, __FILE__, __LINE__);
     
-    if($export_csv){
+    if ($export_csv) {
     	$temp=array(get_lang('LinksMostClicked'),'');
     	$csv_content[] = array('','');
     	$csv_content[] = $temp;
     }
     
-    if(Database::num_rows($rs)>0)
-    {
-	    while($row = Database::fetch_array($rs))
-	    {
+    if (Database::num_rows($rs)>0) {
+	    while ($row = Database::fetch_array($rs)) {
 	    	echo '	<tr>
 						<td>'.$row['title'].'</td>
 						<td align="right">'.$row['count_visits'].' '.get_lang('Clicks').'</td>
@@ -446,30 +384,23 @@ if($_GET['studentlist'] == 'false')
 				$csv_content[] = $temp;
 			}
 	    }
-    }
-    else
-    {
+    } else {
     	echo '<tr><td>'.get_lang('NoLinkVisited').'</td></tr>';
-    	if($export_csv){
+    	if ($export_csv) {
     		$temp=array(get_lang('NoLinkVisited'),'');
 			$csv_content[] = $temp;
     	}
     }
 	echo '</table></div>';
-	
-	
 	echo '<div class="clear"></div>';	
 	
 	// send the csv file if asked
-	if($export_csv)
-	{
+	if ($export_csv) {
 		ob_end_clean();
 		Export :: export_table_csv($csv_content, 'reporting_course_tracking');
 	}
-	
-}
+} else {
 // else display student list with all the informations
-else {
 	
 	// BEGIN : form to remind inactives susers
 	$form = new FormValidator('reminder_form','get',api_get_path(REL_CODE_PATH).'announcements/announcements.php');
@@ -501,8 +432,7 @@ else {
 	$tracking_column = isset($_GET['tracking_column']) ? $_GET['tracking_column'] : 0;
 	$tracking_direction = isset($_GET['tracking_direction']) ? $_GET['tracking_direction'] : 'DESC';
 	
-	if(count($a_students)>0)
-	{
+	if (count($a_students)>0) {
 		$table = new SortableTable('tracking', 'count_student_in_course');
 		$table -> set_header(0, get_lang('OfficialCode'), false, 'align="center"');
 		$table -> set_header(1, get_lang('LastName'), true, 'align="center"');
@@ -516,8 +446,7 @@ else {
 		$table -> set_header(9, get_lang('LatestLogin'), false, 'align="center"');
 		$table -> set_header(10, get_lang('Details'),false);
 	     
-	    if($export_csv)
-		{
+	    if ($export_csv) {
 			$csv_content[] = array ( 
 									get_lang('OfficialCode'),
 									get_lang('LastName'),
@@ -534,8 +463,7 @@ else {
 	    
 	    $all_datas = array();
 	    $course_code = $_course['id'];
-		foreach($a_students as $student_id => $student)
-		{
+		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 ;
@@ -558,8 +486,7 @@ else {
 			$row[] = Tracking :: get_first_connection_date_on_the_course($student_id, $course_code);
 			$row[] = Tracking :: get_last_connection_date_on_the_course($student_id, $course_code);
 			
-			if($export_csv)
-			{
+			if ($export_csv) {
 				$row[8] = strip_tags($row[8]);
 				$csv_content[] = $row;
 			}
@@ -574,13 +501,11 @@ else {
 		$page = $table->get_pager()->getCurrentPageID();
 		$all_datas = array_slice($all_datas, ($page-1)*$table -> per_page, $table -> per_page);
 		
-		if($export_csv)
-		{
+		if ($export_csv) {
 			usort($csv_content, 'sort_users');
 		}
 		
-		foreach($all_datas as $row)
-		{
+		foreach ($all_datas as $row) {
 			$table -> addRow($row,'align="right"');	
 		}
 		$table -> setColAttributes(0,array('align'=>'left'));
@@ -591,15 +516,12 @@ else {
 		$table -> setColAttributes(9,array('align'=>'center'));
 		$table -> display();
 		
-	}
-	else
-	{
+	} else {
 		echo get_lang('NoUsersInCourseTracking');
 	}
 	
 	// send the csv file if asked
-	if($export_csv)
-	{
+	if ($export_csv) {
 		ob_end_clean();
 		Export :: export_table_csv($csv_content, 'reporting_student_list');
 	}
@@ -607,7 +529,5 @@ else {
 }
 ?>
 </table>
-
 <?php
-Display::display_footer();
-?>
+Display::display_footer();