瀏覽代碼

Task #1765 - Reverting previous changes, a new attempt for modification of encoding management will be done.

Ivan Tcholakov 14 年之前
父節點
當前提交
f4adb7c366

+ 18 - 10
main/newscorm/audiorecorder.inc.php

@@ -1,6 +1,5 @@
-<?php
-/* For licensing terms, see /license.txt */
-
+<?php //$id: $
+// This file is part of the Dokeos software - See license and credits in the documentation/ directory
 /**
  * Created on 27.09.2006
  * Include the lazlo file necessary to use the audiorecorder
@@ -8,11 +7,11 @@
  * @author Eric Marguin <e.marguin@elixir-interactive.com>
  * @author Arnaud Ligot <arnaud@cblue.be>
  */
-
 global $_configuration;
 $web_path = api_get_path(WEB_CODE_PATH);
 $getid3_path = api_get_path(LIBRARY_PATH);
 
+
 require_once $getid3_path.'getid3/getid3.php';
 
 function getFLVDuration($flv_path) {
@@ -26,7 +25,9 @@ function getFLVDuration($flv_path) {
 	}
 }
 
-if ($audio_recorder_studentview == 'false') {
+
+if($audio_recorder_studentview=='false')
+{
 	$width = 295;
 	$height= 90;
 	$player = 'recorder2.swf';
@@ -34,7 +35,9 @@ if ($audio_recorder_studentview == 'false') {
 	$post_uri = urlencode($web_path.'conference/audiopost.php?course_code='.api_get_course_id().'&user_id='.api_get_user_id().'&checker='.md5(api_get_course_id().api_get_user_id().gmdate('Ymd').$_configuration['security_key']));
 	$filename = 'lpi'.$audio_recorder_item_id.'-'.gmdate('YmdHis').api_get_user_id().'.flv';//using -z- as fields splitter
 	$path_to_lzx = $web_path.'conference/'.$player.'?server='.urlencode($server).'&postURI='.$post_uri.'&filename='.$filename;
-} else {
+}
+else
+{
 	$width = 295;
 	$height = 24;
 	$player = 'player2.swf';
@@ -44,7 +47,8 @@ if ($audio_recorder_studentview == 'false') {
 			" WHERE path like BINARY '/audio/lpi".Database::escape_string($audio_recorder_item_id)."-%' AND filetype='file' " .
 			" ORDER BY path DESC";
 	$res = Database::query($select);
-	if (Database::num_rows($res) > 0) {
+	if(Database::num_rows($res)>0)
+	{
 		$row = Database::fetch_array($res);
 		//$filepath = api_get_path(WEB_COURSE_PATH).$cp.'/document'.$row['path'];
 		$duration = getFLVDuration(api_get_path(SYS_COURSE_PATH).$cp.'/document'.$row['path']);
@@ -53,7 +57,7 @@ if ($audio_recorder_studentview == 'false') {
 	}
 }
 
-if (!empty($path_to_lzx)) {
+if(!empty($path_to_lzx)){
 	$recorder_content = sprintf("<object type=\"application/x-shockwave-flash\" data=\"%s\" ".
 			"width='$width' height='$height'>".
 	         "<param name=\"movie\" value=\"%s\">".
@@ -61,7 +65,8 @@ if (!empty($path_to_lzx)) {
 		 "<param name=\"scale\" value=\"noscale\">".
 		 "<param name=\"salign\" value=\"LT\">".
 		 "<param name=\"menu\" value=\"false\"></object>",$path_to_lzx,$path_to_lzx);
-	if ($audio_recorder_studentview == 'false') {
+	if($audio_recorder_studentview=='false')
+	{
 		echo '<script type="text/javascript">
 
 		function show_audiorecorder()
@@ -75,7 +80,10 @@ if (!empty($path_to_lzx)) {
 		//Commented the audio for the version stable
 		//echo '<div id="show_audiorecorder_div"><a style="cursor:pointer" onclick="show_audiorecorder()">'.get_lang('ShowAudioRecorder').'</a></div>';
 		//echo '<div id="audiorecorder_frame"></div>';
-	} else {
+	}
+	else
+	{
 		echo $recorder_content;
 	}
 }
+?>

+ 13 - 12
main/newscorm/display_audiorecorder.php

@@ -1,42 +1,43 @@
 <?php
 /* For licensing terms, see /license.txt */
-
 /**
  * Script opened in an iframe and containing the learning path's table of contents
  * @package chamilo.learnpath
  * @author Yannick Warnier <ywarnier@beeznest.org>
  * @license	GNU/GPL
  */
-
-// Flag to allow for anonymous user - needs to be set before global.inc.php
+//flag to allow for anonymous user - needs to be set before global.inc.php
 $use_anonymous = true;
 require_once 'back_compat.inc.php';
 require_once 'learnpath.class.php';
 require_once 'scorm.class.php';
 require_once 'aicc.class.php';
 
-if (isset($_SESSION['lpobject'])) {
+if(isset($_SESSION['lpobject']))
+{
 	$oLP = unserialize($_SESSION['lpobject']);
-	if (is_object($oLP)) {
+	if(is_object($oLP)){
 		$_SESSION['oLP'] = $oLP;
-	} else {
-		die('Could not instanciate lp object.');
+	}else{
+		die('Could not instanciate lp object');
 	}
 }
+$charset = $_SESSION['oLP']->encoding;
 
-$lp_theme_css = $_SESSION['oLP']->get_theme();
-$scorm_css_header = true;
+$lp_theme_css=$_SESSION['oLP']->get_theme();
+$scorm_css_header=true;
 include_once '../inc/reduced_header.inc.php';
-
-echo '<body dir="'.api_get_text_direction().'">';
+echo '<html>
+		<body>';
 
 		echo '<div id="audiorecorder">	';
 		$audio_recorder_studentview = 'true';
 		$audio_recorder_item_id = $_SESSION['oLP']->current;
-		if (api_get_setting('service_visio', 'active') == 'true') {
+		if(api_get_setting('service_visio','active')=='true'){
 			include 'audiorecorder.inc.php';
 		}
 		echo '</div>';
 		// end of audiorecorder include
 
 echo '</body></html>';
+?>

+ 1 - 2
main/newscorm/learnpath.class.php

@@ -80,7 +80,6 @@ class learnpath {
 	 * @return	boolean		True on success, false on error
 	 */
     public function __construct($course, $lp_id, $user_id) {
-    	$this->encoding = api_get_system_encoding(); // Chamilo 1.8.8: We intend always to use the system encoding.
     	//check params
     	//check course code
     	if ($this->debug>0){error_log('New LP - In learnpath::__construct('.$course.','.$lp_id.','.$user_id.')',0);}
@@ -124,7 +123,7 @@ class learnpath {
     			$row = Database::fetch_array($res);
     			$this->type = $row['lp_type'];
     			$this->name = stripslashes($row['name']);
-    			//$this->encoding = $row['default_encoding']; // Chamilo 1.8.8: We intend not to use 'default_encoding' field anymore.
+    			$this->encoding = $row['default_encoding'];
     			$this->proximity = $row['content_local'];
     			$this->theme = $row['theme'];
     			$this->maker = $row['content_maker'];

+ 75 - 76
main/newscorm/learnpathList.class.php

@@ -1,12 +1,10 @@
 <?php
 /* For licensing terms, see /license.txt */
-
 /**
  * File containing the declaration of the learnpathList class.
  * @package	chamilo.learnpath
  * @author	Yannick Warnier <ywarnier@beeznest.org>
  */
-
 /**
  * This class is only a learning path list container with several practical methods for sorting the list and
  * provide links to specific paths
@@ -14,7 +12,6 @@
  * @uses	learnpath.class.php to generate learnpath objects to get in the list
  */
 class learnpathList {
-
 	public $list = array(); //holds a flat list of learnpaths data from the database
 	public $ref_list = array(); //holds a list of references to the learnpaths objects (only filled by get_refs())
 	public $alpha_list = array(); //holds a flat list of learnpaths sorted by alphabetical name order
@@ -31,91 +28,93 @@ class learnpathList {
 	 * @param	int			Optional session id (otherwise we use api_get_session_id())
 	 * @return	void
 	 */
-	function __construct($user_id, $course_code = '', $session_id = null) {
-
-		if (!empty($course_code)) {
-			$course_info = api_get_course_info($course_code);
-			$lp_table = Database::get_course_table(TABLE_LP_MAIN, $course_info['dbName']);
-		} else {
+    function __construct($user_id, $course_code='', $session_id = null) {
+    	
+    	if (!empty($course_code)){
+    		$course_info = api_get_course_info($course_code);
+    		$lp_table = Database::get_course_table(TABLE_LP_MAIN, $course_info['dbName']);    		
+    	} else{
 			$course_code = api_get_course_id();
 			$lp_table = Database::get_course_table(TABLE_LP_MAIN);
-		}
-		$this->course_code = $course_code;
-		$this->user_id = $user_id;
+    	}
+    	$this->course_code = $course_code;
+    	$this->user_id = $user_id;
 
-		//condition for the session
-		if (isset($session_id)) {
-			$session_id = intval($session_id);
-		} else {
-			$session_id = api_get_session_id();
-		}
-		$condition_session = api_get_session_condition($session_id, false, true);
+    	//condition for the session
+    	if (isset($session_id)) {
+    		$session_id = intval($session_id);
+    	} else {
+    		$session_id = api_get_session_id();	
+    	}		
+	$condition_session = api_get_session_condition($session_id, false, true);
 
-		$sql = "SELECT * FROM $lp_table $condition_session ORDER BY display_order ASC, name ASC";
-		$res = Database::query($sql);
-		$names = array();
-		while ($row = Database::fetch_array($res)) {
-			//check if published
-			$pub = '';
-			$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
-			//use domesticate here instead of Database::escape_string because
-			//it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
-			//is done using domesticate()
-			$myname = domesticate($row['name']);
+    	$sql = "SELECT * FROM $lp_table $condition_session ORDER BY display_order ASC, name ASC";
+    	$res = Database::query($sql);
+    	$names = array();
+    	while ($row = Database::fetch_array($res))
+    	{
+    		//check if published
+    		$pub = '';
+    		$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
+    		//use domesticate here instead of Database::escape_string because
+    		//it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
+    		//is done using domesticate()
+    		$myname = domesticate($row['name']);
 			$mylink = 'newscorm/lp_controller.php?action=view&lp_id='.$row['id'].'&id_session='.$session_id;
-			$sql2 = "SELECT * FROM $tbl_tool where (name='$myname' and image='scormbuilder.gif' and link LIKE '$mylink%')";
+			$sql2="SELECT * FROM $tbl_tool where (name='$myname' and image='scormbuilder.gif' and link LIKE '$mylink%')";
 			//error_log('New LP - learnpathList::__construct - getting visibility - '.$sql2,0);
 			$res2 = Database::query($sql2);
-			if (Database::num_rows($res2) > 0) {
+			if(Database::num_rows($res2)>0){
 				$row2 = Database::fetch_array($res2);
 				$pub = $row2['visibility'];
-			} else {
+			}else{
 				$pub = 'i';
 			}
 			//check if visible
-			$vis = api_get_item_visibility(api_get_course_info($course_code), 'learnpath', $row['id'], $session_id);
-
-			$this->list[$row['id']] = array(
-				'lp_type' => $row['lp_type'],
-				'lp_session' => $row['session_id'],
-				'lp_name' => stripslashes($row['name']),
-				'lp_desc' => stripslashes($row['description']),
-				'lp_path' => $row['path'],
-				'lp_view_mode' => $row['default_view_mod'],
-				'lp_force_commit' => $row['force_commit'],
-				'lp_maker'	=> stripslashes($row['content_maker']),
-				'lp_proximity' => $row['content_local'],
-				'lp_encoding' => api_get_system_encoding(),
-				'lp_visibility' => $vis,
-				'lp_published'	=> $pub,
-				'lp_prevent_reinit' => $row['prevent_reinit'],
-				'lp_scorm_debug' => $row['debug'],
-				'lp_display_order' => $row['display_order'],
-				'lp_preview_image' => stripslashes($row['preview_image'])
-				);
-			$names[$row['name']] = $row['id'];
-	   	}
-	   	$this->alpha_list = asort($names);
-	}
+			$vis = api_get_item_visibility(api_get_course_info($course_code),'learnpath',$row['id'],$session_id);
 
-	/**
-	 * Gets references to learnpaths for all learnpaths IDs kept in the local list.
-	 * This applies a transformation internally on list and ref_list and returns a copy of the refs list
-	 * @return	array	List of references to learnpath objects
-	 */
-	function get_refs() {
-		foreach ($this->list as $id => $dummy) {
-			$this->ref_list[$id] = new learnpath($this->course_code, $id, $this->user_id);
-		}
-		$this->refs_active = true;
-		return $this->ref_list;
-	}
-
-	/**
-	 * Gets a table of the different learnpaths we have at the moment
-	 * @return	array	Learnpath info as [lp_id] => ([lp_type]=> ..., [lp_name]=>...,[lp_desc]=>...,[lp_path]=>...)
-	 */
-	function get_flat_list() {
+    		$this->list[$row['id']] = array(
+    			'lp_type' => $row['lp_type'],
+    			'lp_session' => $row['session_id'],
+    			'lp_name' => stripslashes($row['name']),
+    			'lp_desc' => stripslashes($row['description']),
+    			'lp_path' => $row['path'],
+    			'lp_view_mode' => $row['default_view_mod'],
+    			'lp_force_commit' => $row['force_commit'],
+    			'lp_maker'	=> stripslashes($row['content_maker']),
+    			'lp_proximity' => $row['content_local'],
+    			'lp_encoding' => $row['default_encoding'],
+    			'lp_visibility' => $vis,
+    			'lp_published'	=> $pub,
+    			'lp_prevent_reinit' => $row['prevent_reinit'],
+    			'lp_scorm_debug' => $row['debug'],
+    			'lp_display_order' => $row['display_order'],
+    			'lp_preview_image' => stripslashes($row['preview_image'])
+    			);
+    		$names[$row['name']]=$row['id'];
+       	}
+       	$this->alpha_list = asort($names);
+    }
+    /**
+     * Gets references to learnpaths for all learnpaths IDs kept in the local list.
+     * This applies a transformation internally on list and ref_list and returns a copy of the refs list
+     * @return	array	List of references to learnpath objects
+     */
+    function get_refs(){
+    	foreach($this->list as $id => $dummy)
+    	{
+    		$this->ref_list[$id] = new learnpath($this->course_code,$id,$this->user_id);
+    	}
+    	$this->refs_active = true;
+    	return $this->ref_list;
+    }
+    /**
+     * Gets a table of the different learnpaths we have at the moment
+     * @return	array	Learnpath info as [lp_id] => ([lp_type]=> ..., [lp_name]=>...,[lp_desc]=>...,[lp_path]=>...)
+     */
+    function get_flat_list()
+    {
 		return $this->list;
-	}
+    }
 }
+?>

+ 9 - 3
main/newscorm/learnpath_functions.inc.php

@@ -2394,9 +2394,15 @@ function createimsmanifest($circle1_files, $learnpath_id)
 
 	include_once '../metadata/md_funcs.php'; // RH: export metadata
 
-	// Header
-	// Charset should be dependent on content
-	$header = '<?xml version="1.0" encoding="'.api_get_system_encoding().'"?>'."\n<manifest identifier='".$LPnamesafe."' version='1.1'\n xmlns='http://www.imsproject.org/xsd/imscp_rootv1p1p2'\n xmlns:adlcp='http://www.adlnet.org/xsd/adlcp_rootv1p2'\n xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n xsi:schemaLocation='http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd\n http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd\n http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd'>\n";
+	//1.1 header
+	/*
+		$header='<?xml version="1.0" encoding="UTF-8"?><manifest identifier="'.$LPnamesafe.'" xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1 imscp_v1p1.xsd http://www.imsglobal.org/xsd/imsmd_v1p2 imsmd_v1p2.xsd" version="IMS CP 1.1.3">'."\n";
+	*/
+
+	//1.2
+	//charset should be dependent on content
+	$mycharset = api_get_system_encoding();
+	$header = '<?xml version="1.0" encoding="'.$mycharset.'"?>'."\n<manifest identifier='".$LPnamesafe."' version='1.1'\n xmlns='http://www.imsproject.org/xsd/imscp_rootv1p1p2'\n xmlns:adlcp='http://www.adlnet.org/xsd/adlcp_rootv1p2'\n xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n xsi:schemaLocation='http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd\n http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd\n http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd'>\n";
 
 	$org .= xmltagwrite('metadata', 'open');
 	$org .= "  ".xmltagwrite('schema', 'full', 'ADL SCORM');

+ 14 - 15
main/newscorm/lp_author_image.php

@@ -1,6 +1,5 @@
 <?php
 /* For licensing terms, see /license.txt */
-
 /**
  * Script that displays the author name and image of a LP
  * @package chamilo.learnpath
@@ -12,33 +11,33 @@ require_once 'back_compat.inc.php';
 require_once 'learnpath.class.php';
 require_once 'scorm.class.php';
 require_once 'aicc.class.php';
-
-// Getting the LP
-if (isset($_SESSION['lpobject'])) {
+//Getting the LP
+if(isset($_SESSION['lpobject']))
+{
 	$oLP = unserialize($_SESSION['lpobject']);
-	if (is_object($oLP)) {
+	if(is_object($oLP)){
 		$_SESSION['oLP'] = $oLP;
-	} else {
-		die('Could not instanciate lp object.');
+	}else{
+		die('Could not instanciate lp object');
 	}
-}
-
-/*
-$lp_theme_css = $_SESSION['oLP']->get_theme();
+} /*
+$charset = $_SESSION['oLP']->encoding;
+$lp_theme_css=$_SESSION['oLP']->get_theme();
 */
-$scorm_css_header = true;
+$scorm_css_header=true;
 // scorm.css loaded
 include_once '../inc/reduced_header.inc.php';
 
-echo '<body dir="'.api_get_text_direction().'">';
+echo '<html>
+		<body>';
 		$image = '../img/lp_author_background.gif';
 		echo '<div id="image_preview">';
 		echo '<table STYLE="width:250px;height:110px;background-image: url('.$image.');">';
 			echo '<tr><td align="center">';
-			if ($_SESSION['oLP']->get_preview_image() != '')
+			if ($_SESSION['oLP']->get_preview_image()!='')
 				echo '<img alt="" src="'.api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image().'">';
 			else
-				echo Display::display_icon('unknown_250_100.jpg', ' ');
+				echo Display::display_icon('unknown_250_100.jpg',' ');
 			echo '</td></tr>';
 			echo '</table>';
 			echo '<div id="author_name">';

+ 3 - 0
main/newscorm/lp_controller.php

@@ -773,6 +773,7 @@ switch($action)
 			$lp_id = $_SESSION['oLP']->get_id();
 			$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
 			$user_id = api_get_user_id();
+			$stats_charset = $_SESSION['oLP']->encoding;
 			require 'lp_stats.php';
 		}
 		break;
@@ -844,6 +845,7 @@ switch($action)
         	    $lp_id = $_SESSION['oLP']->get_id();
 	            $list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
         	    $user_id = api_get_user_id();
+	            $stats_charset = $_SESSION['oLP']->encoding;
         	    //header('location: ../course_home/course_home.php?'.api_get_cidreq()); // This is not the preferable way to go to the homepage.
 	            header('location: '.api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php');
         	}
@@ -864,3 +866,4 @@ if(!empty($_SESSION['oLP'])){
 	$_SESSION['lpobject'] = serialize($_SESSION['oLP']);
 	if($debug>0) error_log('New LP - lpobject is serialized in session',0);
 }
+?>

+ 66 - 40
main/newscorm/lp_stats.php

@@ -1,6 +1,5 @@
 <?php
 /* For licensing terms, see /license.txt */
-
 /**
  * This script displays statistics on the current learning path (scorm)
  *
@@ -15,7 +14,7 @@ require_once 'resourcelinker.inc.php';
 require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
 require_once api_get_path(LIBRARY_PATH).'course.lib.php';
 
-if (empty($_SESSION['_course']['id']) && isset($_GET['course'])) {
+if(empty($_SESSION['_course']['id']) && isset($_GET['course'])) {
 	$course_code = Security::remove_XSS($_GET['course']);
 } else {
 	$course_code = $_SESSION['_course']['id'];
@@ -30,20 +29,38 @@ $session_condition = api_get_session_condition($session_id);
 //$lp_id = $_SESSION['oLP']->get_id();
 //$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
 //$user_id = $_user['user_id'];
-
-if (!isset($origin))
+//$stats_charset = $_SESSION['oLP']->encoding
+if(!isset($origin))
 	$origin = '';
-if ($origin != 'tracking') {
+if($origin != 'tracking') {
+	if (!empty ($stats_charset)) {
+		$lp_charset = $stats_charset;
+	} else {
+		$lp_charset = api_get_setting('platform_charset');
+	}
+	$charset = $lp_charset;
 	//$w = $tablewidth -20;
-	$htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
+	$htmlHeadXtra[] = ''.'<style type="text/css" media="screen, projection">
 		/*<![CDATA[*/
 		@import "../css/public_admin/scorm.css";
 		/*]]>*/
 	</style>';
 	include_once api_get_path(INCLUDE_PATH).'reduced_header.inc.php';
-	echo '<body dir="'.api_get_text_direction().'">';
+	echo '<body>';
+} else {
+    //Get learning path's encoding
+    $TBL_LP = Database :: get_course_table(TABLE_LP_MAIN);
+    $sql = "SELECT default_encoding FROM $TBL_LP " .
+                "WHERE id = '".(int)$_GET['lp_id']."'";
+    $res = Database::query($sql);
+    if (Database :: num_rows($res) > 0) {
+        $row = Database::fetch_array($res);
+        $lp_charset = $row['default_encoding'];
+    }
 }
 
+// The dokeos interface's encoding
+$dokeos_charset = api_get_setting('platform_charset');
 $output = '';
 //if display in fullscreen required
 if (!empty($_GET['fs']) && strcmp($_GET['fs'], 'true') == 0) {
@@ -62,16 +79,16 @@ if ($origin == 'tracking') {
 }
 
 if (!empty ($_GET['extend_all'])) {
-	$extend_all_link = '<a href="' . api_get_self() . '?action=stats' . $url_suffix . '"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="'.get_lang('HideAllAttempts').'"></a>';
+	$extend_all_link = '<a href="' . api_get_self() . '?action=stats' . $url_suffix . '"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="'.api_convert_encoding(get_lang('HideAllAttempts'), $lp_charset, $dokeos_charset).'"></a>';
 	$extend_all = 1;
 } else {
-	$extend_all_link = '<a href="' . api_get_self() . '?action=stats&extend_all=1' . $url_suffix . '"><img src="../img/view_more_stats.gif" alt="extend_view" border="0" title="'.get_lang('ShowAllAttempts').'"></a>';
+	$extend_all_link = '<a href="' . api_get_self() . '?action=stats&extend_all=1' . $url_suffix . '"><img src="../img/view_more_stats.gif" alt="extend_view" border="0" title="'.api_convert_encoding(get_lang('ShowAllAttempts'), $lp_charset, $dokeos_charset).'"></a>';
 }
 
 if ($origin != 'tracking') {
-	$output .= "<tr><td><div class='title'>" . get_lang('ScormMystatus') . "</div></td></tr>";
+	$output .= "<tr><td><div class='title'>" . api_convert_encoding(get_lang('ScormMystatus'), $lp_charset, $dokeos_charset) . "</div></td></tr>";
 }
-$output .= "<tr><td>&nbsp;</td></tr>" . "<tr><td>" . "<table border='0' class='data_table'><tr>\n" . '<td width="16">' . $extend_all_link . '</td>' . '<td colspan="4" class="title"><div class="mystatusfirstrow">' . get_lang('ScormLessonTitle') . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . get_lang('ScormStatus') . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . get_lang('ScormScore') . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . get_lang('ScormTime') . "</div></td><td class='title'><div class='mystatusfirstrow'>" .get_lang('Actions') . "</div></td></tr>\n";
+$output .= "<tr><td>&nbsp;</td></tr>" . "<tr><td>" . "<table border='0' class='data_table'><tr>\n" . '<td width="16">' . $extend_all_link . '</td>' . '<td colspan="4" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormLessonTitle'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormStatus'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormScore'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormTime'), $lp_charset, $dokeos_charset) . "</div></td><td class='title'><div class='mystatusfirstrow'>" . api_convert_encoding(get_lang('Actions'), $lp_charset, $dokeos_charset) . "</div></td></tr>\n";
 //going through the items using the $items[] array instead of the database order ensures
 // we get them in the same order as in the imsmanifest file, which is rather random when using
 // the database table
@@ -96,14 +113,14 @@ $counter = 0;
 $total_score = 0;
 $total_max_score = 0;
 $total_time = 0;
-$h = get_lang('h');
+$h = api_convert_encoding(get_lang('h'), $lp_charset, $dokeos_charset);
 
 if (!empty($export_csv)) {
 	$csv_content[] = array (
-		get_lang('ScormLessonTitle'),
-		get_lang('ScormStatus'),
-		get_lang('ScormScore'),
-		get_lang('ScormTime')
+		api_convert_encoding(get_lang('ScormLessonTitle'), $lp_charset, $dokeos_charset),
+		api_convert_encoding(get_lang('ScormStatus'), $lp_charset, $dokeos_charset),
+		api_convert_encoding(get_lang('ScormScore'), $lp_charset, $dokeos_charset),
+		api_convert_encoding(get_lang('ScormTime'), $lp_charset, $dokeos_charset)
 	);
 }
 
@@ -176,7 +193,7 @@ if (is_array($list) && count($list) > 0) {
 		$num = Database :: num_rows($result);
 		$time_for_total = 'NaN';
 
-		$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
+		$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
 
 		if (($extend_this || $extend_all) && $num > 0) {
 			$row = Database :: fetch_array($result);
@@ -189,7 +206,7 @@ if (is_array($list) && count($list) > 0) {
 				$res_result_disabled = Database::query($sql);
 				$row_result_disabled = Database::fetch_row($res_result_disabled);
 
-				if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0] === 1) {
+				if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0]===1) {
 					$result_disabled_ext_all = true;
 				}
 			}
@@ -201,9 +218,9 @@ if (is_array($list) && count($list) > 0) {
 			} else {
 				$oddclass = "row_even";
 			}
-	        $extend_link = '';
+	        $extend_link='';
 			if (!empty($inter_num)) {
-				$extend_link = '<a href="' . api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix . '"><img src="../img/visible.gif" alt="'.get_lang('HideAttemptView').'" title="'.get_lang('HideAttemptView').'"  border="0"></a>' . "\n";
+				$extend_link = '<a href="' . api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'"  border="0"></a>' . "\n";
 			}
 			$title = $row['mytitle'];
 
@@ -213,6 +230,7 @@ if (is_array($list) && count($list) > 0) {
 
 			if ($row['item_type'] != 'dokeos_chapter') {
 				$correct_test_link = '-';
+				//api_convert_encoding($title, $lp_charset, $lp_charset)
 				$title = Security::remove_XSS($title);
 				$output .= "<tr class='$oddclass'>\n" . "<td>$extend_link</td>\n" . '<td colspan="4" class="content"><div class="mystatus">' . $title . "</div></td>\n" . '<td colspan="2" class="content"></td>' . "\n" . '<td colspan="2" class="content"></td>' . "\n" . '<td colspan="2" class="content"></td><td class="content"></td>' . "\n" . "</tr>\n";
 			}
@@ -228,10 +246,10 @@ if (is_array($list) && count($list) > 0) {
 					if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) {
 						//the extend button for this attempt has been clicked
 						$extend_this_attempt = 1;
-						$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/visible.gif" alt="'.get_lang('HideAttemptView').'" title="'.get_lang('HideAttemptView').'" border="0"></a>' . "\n";
+						$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" border="0"></a>' . "\n";
 					} else { //same case if fold_attempt_id is set, so not implemented explicitly
 						//the extend button for this attempt has not been clicked
-						$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.get_lang('ExtendAttemptView').'" title="'.get_lang('ExtendAttemptView').'"  border="0"></a>' . "\n";
+						$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'), $lp_charset, $dokeos_charset).'"  border="0"></a>' . "\n";
 					}
 				}
 
@@ -282,7 +300,9 @@ if (is_array($list) && count($list) > 0) {
 
 				);
 
-				$my_lesson_status = get_lang($mylanglist[$lesson_status]);
+				$my_lesson_status = api_convert_encoding(get_lang($mylanglist[$lesson_status]), $lp_charset, $dokeos_charset);
+
+
 
 				if ($row['item_type'] != 'dokeos_chapter') {
 					if (!$is_allowed_to_edit && $result_disabled_ext_all) {
@@ -290,7 +310,8 @@ if (is_array($list) && count($list) > 0) {
 					} else {
 						$view_score = ($score == 0 ? '/' : ($maxscore === 0 ? $score : $score . '/' . float_format($maxscore, 1)));
 					}
-					$output .= "<tr class='$oddclass'>\n" . "<td></td>\n" . "<td>$extend_attempt_link</td>\n" . '<td colspan="3">' . get_lang('Attempt') . ' ' . $row['iv_view_count'] . "</td>\n"
+					$output .= "<tr class='$oddclass'>\n" . "<td></td>\n" . "<td>$extend_attempt_link</td>\n" . '<td colspan="3">' . api_convert_encoding(get_lang('Attempt'), $lp_charset, $dokeos_charset) . ' ' . $row['iv_view_count'] . "</td>\n"
+					//."<td><font color='$color'><div class='mystatus'>".api_htmlentities($array_status[$lesson_status],ENT_QUOTES,$lp_charset)."</div></font></td>\n"
 					 . '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . "</div></font></td>\n" . '<td colspan="2"><div class="mystatus" align="center">' . $view_score . "</div></td>\n" . '<td colspan="2"><div class="mystatus">'.$time.'</div></td><td></td></tr>';
 
 					if (!empty($export_csv)) {
@@ -336,7 +357,9 @@ if (is_array($list) && count($list) > 0) {
 							$student_response=implode(',',$content_student_response);
 						}
 						$output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td>' . $interaction['id'] . '</td>' . "\n"
+						//."<td><font color='$color'><div class='mystatus'>".api_convert_encoding($array_status[$lesson_status],$lp_charset,$lp_charset)."</div></font></td>\n"
 						 . '<td colspan="2">' . $interaction['type'] . "</td>\n"
+						//.'<td>'.$interaction['correct_responses']."</td>\n"
 						 . '<td>' . $student_response . "</td>\n" . '<td>' . $interaction['result'] . "</td>\n" . '<td>' . $interaction['latency'] . "</td>\n" . '<td>' . $interaction['time'] . "</td>\n<td></td>\n</tr>\n";
 						$counter++;
 					}
@@ -386,10 +409,10 @@ if (is_array($list) && count($list) > 0) {
 				if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) {
 					//the extend button for this attempt has been clicked
 					$extend_this_attempt = 1;
-					$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/visible.gif" alt="'.get_lang('HideAttemptView').'" title="'.get_lang('HideAttemptView').'" border="0"></a>' . "\n";
+					$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'),$lp_charset,$charset).'" border="0"></a>' . "\n";
 				} else { //same case if fold_attempt_id is set, so not implemented explicitly
 					//the extend button for this attempt has not been clicked
-					$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.get_lang('ExtendAttemptView').'" title="'.get_lang('ExtendAttemptView').'" border="0"></a>' . "\n";
+					$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" border="0"></a>' . "\n";
 				}
 			}
 
@@ -401,7 +424,7 @@ if (is_array($list) && count($list) > 0) {
 			//$extend_link = '<img src="../img/invisible.gif" alt="extend_disabled">';
 			$extend_link = '';
 			if ($inter_num > 1) {
-				$extend_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.get_lang('ExtendAttemptView').'" title="'.get_lang('ExtendAttemptView').'"  border="0"></a>';
+				$extend_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'"  border="0"></a>';
 			}
 			if (($counter % 2) == 0) {
 				$oddclass = "row_odd";
@@ -506,7 +529,7 @@ if (is_array($list) && count($list) > 0) {
 				'not attempted' => 'ScormNotAttempted',
 
 			);
-			$my_lesson_status = get_lang($mylanglist[$lesson_status]);
+			$my_lesson_status = api_convert_encoding(get_lang($mylanglist[$lesson_status]), $lp_charset, $dokeos_charset);
 
 			if ($row['item_type'] != 'dokeos_chapter') {
 				if ($row['item_type'] == 'quiz') {
@@ -524,10 +547,10 @@ if (is_array($list) && count($list) > 0) {
 					$num = Database :: num_rows($resultLastAttempt);
 					if ($num > 0) {
 						if (isset($_GET['extend_attempt']) && $_GET['extend_attempt'] == 1 && (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id) && (isset($_GET['my_lp_id']) && $_GET['my_lp_id'] == $my_id)  ) {
-							$correct_test_link = '<a href="' . api_get_self() . '?action=stats' . $my_url_suffix . '&my_ext_lp_id='.$my_id.'"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="'.get_lang('HideAllAttempts').'"></a>';
+							$correct_test_link = '<a href="' . api_get_self() . '?action=stats' . $my_url_suffix . '&my_ext_lp_id='.$my_id.'"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="'.api_convert_encoding(get_lang('HideAllAttempts'),$lp_charset,$charset).'"></a>';
 							$extend_attempt = 1;
 						} else {
-							$correct_test_link = '<a href="' . api_get_self() . '?action=stats&extend_attempt=1'.$my_url_suffix.'&my_lp_id='.$my_id.'"><img src="../img/view_more_stats.gif" alt="extend_view" border="0" title="'.get_lang('ShowAllAttemptsByExercise').'"></a>';
+							$correct_test_link = '<a href="' . api_get_self() . '?action=stats&extend_attempt=1'.$my_url_suffix.'&my_lp_id='.$my_id.'"><img src="../img/view_more_stats.gif" alt="extend_view" border="0" title="'.api_convert_encoding(get_lang('ShowAllAttemptsByExercise'),$lp_charset,$charset).'"></a>';
 						}
 					} else {
 						$correct_test_link = '-';
@@ -536,6 +559,7 @@ if (is_array($list) && count($list) > 0) {
 					$correct_test_link = '-';
 				}
 
+				//."<td><font color='$color'><div class='mystatus'>".api_htmlentities($array_status[$lesson_status],ENT_QUOTES,$lp_charset)."</div></font></td>\n"
 				$title = Security::remove_XSS($title);
 				if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id ) && (isset($_GET['my_lp_id']) && $_GET['my_lp_id'] == $my_id)) {
 					$output .= "<tr class='$oddclass' >\n" . "<td>$extend_link</td>\n" . '<td colspan="4"><div class="mystatus">' .$title. '</div></td>' . "\n";
@@ -566,8 +590,8 @@ if (is_array($list) && count($list) > 0) {
 
 				if (!empty($export_csv)) {
 					$temp = array ();
-					$temp[] = api_html_entity_decode($title, ENT_QUOTES);
-					$temp[] = api_html_entity_decode($my_lesson_status, ENT_QUOTES);
+					$temp[] = api_html_entity_decode($title, ENT_QUOTES, $lp_charset);
+					$temp[] = api_html_entity_decode($my_lesson_status, ENT_QUOTES, $lp_charset);
 
 					if ($row['item_type'] == 'quiz') {
 
@@ -594,7 +618,9 @@ if (is_array($list) && count($list) > 0) {
 						$oddclass = "row_even";
 					}
 					$output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td>' . $interaction['id'] . '</td>' . "\n"
+					//."<td><font color='$color'><div class='mystatus'>"api_convert_encoding($array_status[$lesson_status],$lp_charset,$lp_charset)."</div></font></td>\n"
 					 . '<td colspan="2">' . $interaction['type'] . "</td>\n"
+					//.'<td>'.$interaction['correct_responses']."</td>\n"
 					 . '<td>' . urldecode($interaction['student_response']) . "</td>\n" . '<td>' . $interaction['result'] . "</td>\n" . '<td>' . $interaction['latency'] . "</td>\n" . '<td>' . $interaction['time'] . "</td>\n<td></td>\n</tr>\n";
 					$counter++;
 				}
@@ -650,19 +676,19 @@ if (is_array($list) && count($list) > 0) {
 									//$view_score = ($my_score == 0 ? '0.00/'.$my_maxscore : ($my_maxscore == 0 ? $my_score : $my_score . '/' . $my_maxscore));
 								}
 								$time_attemp;
-								$output .= '<tr class="'.$oddclass.'" ><td>&nbsp;</td><td>'.$extend_attempt_link.'</td><td colspan="3">' . get_lang('Attempt') . ' ' . $n . '</td>'
+								$output .= '<tr class="'.$oddclass.'" ><td>&nbsp;</td><td>'.$extend_attempt_link.'</td><td colspan="3">' . api_convert_encoding(get_lang('Attempt'), $lp_charset, $dokeos_charset) . ' ' . $n . '</td>'
 							 			. '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . '</div></font></td><td colspan="2"><div class="mystatus" align="center">' . $view_score  . '</div></td><td colspan="2"><div class="mystatus">' . $time_attemp . '</div></td>';
 							 	if ($origin != 'tracking') {
 							 		if (!$is_allowed_to_edit && $result_disabled_ext_all) {
-										$output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"></td>';
+										$output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'"></td>';
 									} else {
-										$output .= '<td><a href="../exercice/exercise_show.php?origin=student_progress&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $student_id .$from_link. '" target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"></a></td>';
+										$output .= '<td><a href="../exercice/exercise_show.php?origin=student_progress&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $student_id .$from_link. '" target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'"></a></td>';
 									}
 								} else {
 									if (!$is_allowed_to_edit && $result_disabled_ext_all ) {
-										$output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>';
+										$output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'"></td>';
 									} else {
-										$output .= '<td><a href="../exercice/exercise_show.php?origin=tracking_course&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $student_id . '&total_time='.$mytime.'&my_exe_exo_id='.$my_exo_exe_id.$from_link.' " target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>';
+										$output .= '<td><a href="../exercice/exercise_show.php?origin=tracking_course&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $student_id . '&total_time='.$mytime.'&my_exe_exo_id='.$my_exo_exe_id.$from_link.' " target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'"></a></td>';
 									}
 								}
 							 	$output .= '</tr>';
@@ -715,7 +741,7 @@ $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time);
 $lp_type = learnpath :: get_type_static($lp_id);
 $total_percent = 0;
 
-if (!$is_allowed_to_edit && $result_disabled_ext_all) {
+if(!$is_allowed_to_edit && $result_disabled_ext_all) {
 	$final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
 } else {
 	if (is_numeric($total_score))
@@ -731,7 +757,7 @@ if (($counter % 2) == 0) {
 }
 
 if (empty($extend_all)) {
-	$output .= "<tr class='$oddclass'>\n" . "<td></td>\n" . '<td colspan="4"><div class="mystatus"><i>' . get_lang('AccomplishedStepsTotal') . "</i></div></td>\n"
+	$output .= "<tr class='$oddclass'>\n" . "<td></td>\n" . '<td colspan="4"><div class="mystatus"><i>' . api_convert_encoding(get_lang('AccomplishedStepsTotal') , $lp_charset, $dokeos_charset) . "</i></div></td>\n"
  			. '<td colspan="2"></td>' . "\n" . '<td colspan="2"><div class="mystatus" align="center">' . $final_score . "</div></td>\n" . '<td colspan="2"><div class="mystatus">' . $total_time . '</div></td><td></td>' . "\n" . "</tr>\n";
 }
 
@@ -746,7 +772,7 @@ if (!empty($export_csv)) {
 	);
 	$csv_content[] = $temp;
 	$temp = array (
-		get_lang('AccomplishedStepsTotal'),
+		api_convert_encoding(get_lang('AccomplishedStepsTotal') , $lp_charset, $dokeos_charset),
 		'',
 		$final_score,
 		$total_time

+ 14 - 15
main/newscorm/lp_toc.php

@@ -1,17 +1,15 @@
 <?php
 /* For licensing terms, see /license.txt */
-
 /**
  * Script opened in an iframe and containing the learning path's table of contents
  * @package chamilo.learnpath
  * @author Yannick Warnier <ywarnier@beeznest.org>
  */
-
-// Flag to allow for anonymous user - needs to be set before global.inc.php
+//flag to allow for anonymous user - needs to be set before global.inc.php
 $use_anonymous = true;
-$language_file[] = 'scormdocument';
-$language_file[] = 'scorm';
-$language_file[] = 'learnpath';
+$language_file[] = "scormdocument";
+$language_file[] = "scorm";
+$language_file[] = "learnpath";
 require_once 'back_compat.inc.php';
 require_once 'learnpath.class.php';
 require_once 'scorm.class.php';
@@ -20,27 +18,28 @@ require_once 'aicc.class.php';
 if (isset($_SESSION['lpobject'])) {
 	//if($debug>0) error_log('New LP - in lp_toc.php - SESSION[lpobject] is defined',0);
 	$oLP = unserialize($_SESSION['lpobject']);
-	if (is_object($oLP)){
+	if(is_object($oLP)){
 		$_SESSION['oLP'] = $oLP;
-	} else {
+	}else{
 		//error_log('New LP - in lp_toc.php - SESSION[lpobject] is not object - dying',0);
-		die('Could not instanciate lp object.');
+		die('Could not instanciate lp object');
 	}
 }
-
+$charset = $_SESSION['oLP']->encoding;
 $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
   var dokeos_xajax_handler = window.parent.oxajax;
 </script>';
-$scorm_css_header = true;
-$display_mode = '';
-$lp_theme_css = $_SESSION['oLP']->get_theme();
+$scorm_css_header=true;
+$display_mode='';
+$lp_theme_css=$_SESSION['oLP']->get_theme();
 include_once '../inc/reduced_header.inc.php';
 ?>
-<body dir="<?php echo api_get_text_direction(); ?>">
-  <?php  echo $_SESSION['oLP']->get_html_toc();?><br />
+<body>
+  <?php  echo $_SESSION['oLP']->get_html_toc();?><br/>
 </body>
 </html>
 <?php
 if (!empty($_SESSION['oLP'])) {
 	$_SESSION['lpobject'] = serialize($_SESSION['oLP']);
 }
+?>

+ 64 - 58
main/newscorm/lp_view.php

@@ -1,31 +1,33 @@
 <?php
 /* For licensing terms, see /license.txt */
-
 /**
- * This file was originally the copy of document.php, but many modifications happened since then ;
- * the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory
- * will be automatically created for it, and the files will be uncompressed there for example ;
- *
- * @package chamilo.learnpath
- * @author Yannick Warnier <ywarnier@beeznest.org> - redesign
- * @author Denes Nagy, principal author
- * @author Isthvan Mandak, several new features
- * @author Roan Embrechts, code improvements and refactoring
- * @license	GNU/GPL - See Dokeos license directory for details
+* This file was originally the copy of document.php, but many modifications happened since then ;
+* the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory
+* will be automatically created for it, and the files will be uncompressed there for example ;
+*
+* @package chamilo.learnpath
+* @author Yannick Warnier <ywarnier@beeznest.org> - redesign
+* @author Denes Nagy, principal author
+* @author Isthvan Mandak, several new features
+* @author Roan Embrechts, code improvements and refactoring
+* @license	GNU/GPL - See Dokeos license directory for details
+*/
+/**
+ * Script
  */
-
 /*	INIT SECTION */
 
 $_SESSION['whereami'] = 'lp/view';
-$this_section = SECTION_COURSES;
+$this_section=SECTION_COURSES;
 
-if ($lp_controller_touched != 1) {
+if ($lp_controller_touched != 1){
 	header('location: lp_controller.php?action=view&item_id='.$_REQUEST['item_id']);
 	exit;
 }
 
-/*	Libraries */
-
+/*
+	Libraries
+*/
 require_once 'back_compat.inc.php';
 //require_once '../learnpath/learnpath_functions.inc.php';
 require_once 'scorm.lib.php';
@@ -35,6 +37,13 @@ require_once 'learnpathItem.class.php';
 
 if (!$is_allowed_in_course) api_not_allowed();
 
+// we set the encoding of the lp
+if (!empty($_SESSION['oLP']->encoding)) {
+	$charset = $_SESSION['oLP']->encoding;
+} else {
+	$charset = api_get_system_encoding();
+}
+
 $oLearnpath		= false;
 $course_code 	= api_get_course_id();
 $user_id 		= api_get_user_id();
@@ -43,7 +52,6 @@ $my_style		= $platform_theme;
 //escape external variables
 
 /* 	Header  */
-
 $htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
 
 if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) {
@@ -51,6 +59,7 @@ if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setti
 	$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
 }
 
+
 $htmlHeadXtra[] = '<script language="javascript" type="text/javascript">
 $(document).ready(function (){
     $("div#log_content_cleaner").bind("click", function(){
@@ -74,13 +83,12 @@ $lp_item_id = $_SESSION['oLP']->get_current_item_id();
 $_SESSION['scorm_view_id'] = $_SESSION['oLP']->get_view_id();
 $_SESSION['scorm_item_id'] = $lp_item_id;
 $_SESSION['lp_mode'] = $_SESSION['oLP']->mode;
-// Reinit exercises variables to avoid spacename clashes (see exercise tool).
-if (isset($exerciseResult) or isset($_SESSION['exerciseResult'])) {
+//reinit exercises variables to avoid spacename clashes (see exercise tool)
+if(isset($exerciseResult) or isset($_SESSION['exerciseResult'])) {
     api_session_unregister($exerciseResult);
 }
 unset($_SESSION['objExercise']);
 unset($_SESSION['questionList']);
-
 /**
  * Get a link to the corresponding document
  */
@@ -91,8 +99,8 @@ if (!isset($src)) {
 			$_SESSION['oLP']->stop_previous_item();
 			$htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
 			$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
-			if ($prereq_check === true) {
-				$src = $_SESSION['oLP']->get_link('http', $lp_item_id);
+			if($prereq_check === true){
+				$src = $_SESSION['oLP']->get_link('http',$lp_item_id);
 				//Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP
 				$file_info = pathinfo($src);
 				if (api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')) {
@@ -108,11 +116,11 @@ if (!isset($src)) {
 			$_SESSION['oLP']->stop_previous_item(); //save status manually if asset
 			$htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
 			$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
-			if ($prereq_check === true) {
-				$src = $_SESSION['oLP']->get_link('http', $lp_item_id);
+			if($prereq_check === true){
+				$src = $_SESSION['oLP']->get_link('http',$lp_item_id);
 				$_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
-			} else {
-				$src = 'blank.php?error=prerequisites';
+			}else{
+			$src = 'blank.php?error=prerequisites';
 			}
 			break;
 		case 3:
@@ -120,10 +128,10 @@ if (!isset($src)) {
 			$_SESSION['oLP']->stop_previous_item(); //save status manually if asset
 			$htmlHeadXtra[] = '<script src="'.$_SESSION['oLP']->get_js_lib().'" type="text/javascript" language="javascript"></script>';
 			$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
-			if ($prereq_check === true) {
+			if($prereq_check === true){
 				$src = $_SESSION['oLP']->get_link('http',$lp_item_id);
 				$_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
-			} else {
+			}else{
 				$src = 'blank.php';
 			}
 			break;
@@ -136,13 +144,13 @@ $list = $_SESSION['oLP']->get_toc();
 $type_quiz = false;
 
 foreach($list as $toc) {
-	if ($toc['id'] == $lp_item_id && ($toc['type'] == 'quiz')) {
+	if ($toc['id'] == $lp_item_id && ($toc['type']=='quiz') ) {
 		$type_quiz = true;
 	}
 }
 
 $autostart = 'true';
-// Update status,total_time from lp_item_view table when you finish the exercises in learning path.
+// update status,total_time from lp_item_view table when you finish the exercises in learning path
 if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($_GET['lp_item_id'])) {
 	global $src;
 	$_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db();
@@ -177,13 +185,13 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($
 		$res_last_attempt = Database::query($sql_last_attempt);
 		$row_last_attempt = Database::fetch_row($res_last_attempt);
 
-		if (Database::num_rows($res_last_attempt) > 0) {
+		if (Database::num_rows($res_last_attempt)>0) {
 			$sql_upd_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = $score,total_time = $mytime WHERE id='".$row_last_attempt[0]."'";
 			Database::query($sql_upd_score);
 		}
 	}
 
-	if (intval($_GET['fb_type']) > 0) {
+	if(intval($_GET['fb_type']) > 0) {
 		$src = 'blank.php?msg=exerciseFinished';
 	} else {
 		$src = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?id='.Security::remove_XSS($_REQUEST['exeId']).'&origin=learnpath&learnpath_id='.Security::remove_XSS($_GET['lp_id']).'&learnpath_item_id='.Security::remove_XSS($_GET['lp_id']).'&fb_type='.Security::remove_XSS($_GET['fb_type']);
@@ -192,33 +200,31 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($
 }
 
 $_SESSION['oLP']->set_previous_item($lp_item_id);
-$nameTools = Security :: remove_XSS($_SESSION['oLP']->get_name());
+$nameTools = Security :: remove_XSS(api_convert_encoding($_SESSION['oLP']->get_name(), $charset, api_get_system_encoding()));
 
-$save_setting = api_get_setting('show_navigation_menu');
+$save_setting = api_get_setting("show_navigation_menu");
 global $_setting;
 $_setting['show_navigation_menu'] = 'false';
-$scorm_css_header = true;
-$lp_theme_css = $_SESSION['oLP']->get_theme(); // Sets the css theme of the LP this call is also use at the frames (toc, nav, message).
+$scorm_css_header=true;
+$lp_theme_css=$_SESSION['oLP']->get_theme(); //sets the css theme of the LP this call is also use at the frames (toc, nav, message)
 
-if ($_SESSION['oLP']->mode == 'fullscreen') {
+if($_SESSION['oLP']->mode == 'fullscreen') {
 	$htmlHeadXtra[] = "<script>window.open('$src','content_id','toolbar=0,location=0,status=0,scrollbars=1,resizable=1');</script>";
 }
-
-//not fullscreen mode
-require_once '../inc/reduced_header.inc.php';
-//$displayAudioRecorder = (api_get_setting('service_visio','active')=='true') ? true : false;
-//check if audio recorder needs to be in studentview
-$course_id = $_SESSION["_course"]["id"];
-if ($_SESSION['status'][$course_id] == 5) {
-	$audio_recorder_studentview = true;
-} else {
-	$audio_recorder_studentview = false;
-}
-//set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php)
-$_SESSION['loaded_lp_view'] = true;
-
+	//not fullscreen mode
+	require_once '../inc/reduced_header.inc.php';
+	//$displayAudioRecorder = (api_get_setting('service_visio','active')=='true') ? true : false;
+	//check if audio recorder needs to be in studentview
+	$course_id=$_SESSION["_course"]["id"];
+	if ($_SESSION["status"][$course_id]==5) {
+		$audio_recorder_studentview = true;
+	} else {
+		$audio_recorder_studentview = false;
+	}
+	//set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php)
+	$_SESSION['loaded_lp_view'] = true;
 ?>
-<body dir="<?php echo api_get_text_direction(); ?>">
+<body>
 <div id="learning_path_main"  style="width:100%;height:100%;" >
     <div id="learning_path_left_zone" style="float:left;width:280px;height:100%">
 
@@ -232,7 +238,7 @@ $_SESSION['loaded_lp_view'] = true;
 	                    </td>
 	                    <td>
 	                        <a class="link" href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="window.parent.API.save_asset();">
-	                        <?php echo get_lang('CourseHomepageLink'); ?></a>
+	                        <?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a>
 	                    </td>
 	                </tr>
 	            </table>
@@ -251,9 +257,9 @@ $_SESSION['loaded_lp_view'] = true;
 		       		<span style="width:104px; height:96px; float:left; vertical-align:bottom;">
 			        <center>
 			        <?php
-			        if ($_SESSION['oLP']->get_preview_image() != '') {
+			        if ($_SESSION['oLP']->get_preview_image()!='') {
 			        	$picture = getimagesize(api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image());
-			        	if ($picture['1'] < 96) { $style = ' style="padding-top:'.((94 -$picture['1'])/2).'px;" '; }
+			        	if($picture['1'] < 96) { $style = ' style="padding-top:'.((94 -$picture['1'])/2).'px;" '; }
 			        	$size = ($picture['0'] > 104 && $picture['1'] > 96 )? ' width="104" height="96" ': $style;
 			        	$my_path = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image();
 			        	echo '<img '.$size.' src="'.$my_path.'">';
@@ -290,7 +296,7 @@ $_SESSION['loaded_lp_view'] = true;
 
 						if (Database::num_rows($res_media) > 0) {
 							while ($row_media= Database::fetch_array($res_media)) {
-							     if (!empty($row_media['audio'])) { $show_audioplayer = true; break; }
+							     if (!empty($row_media['audio'])) {$show_audioplayer = true; break;}
 							}
 						}
 					?>
@@ -340,7 +346,7 @@ $_SESSION['loaded_lp_view'] = true;
 	<div id="learning_path_right_zone" style="margin-left:282px;height:100%">
 	<?php
 		// hub 26-05-2010 Fullscreen or not fullscreen
-		if ($_SESSION['oLP']->mode == 'fullscreen') {
+		if($_SESSION['oLP']->mode == 'fullscreen') {
 			echo '<iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0" style="width:100%;height:600px" ></iframe>';
 		} else {
 			echo '<iframe id="content_id" name="content_name" src="'.$src.'" border="0" frameborder="0"  style="width:100%;height:600px" ></iframe>';
@@ -413,5 +419,5 @@ $_SESSION['loaded_lp_view'] = true;
 </script>
 </body>
 <?php
-// Restore global setting.
+//restore global setting
 $_setting['show_navigation_menu'] = $save_setting;

+ 21 - 12
main/tracking/courseLog.php

@@ -1,15 +1,14 @@
-<?php
+<?php //$id: $
 /* For licensing terms, see /license.txt */
-
 /**
- *	@author Thomas Depraetere
- *	@author Hugues Peeters
- *	@author Christophe Gesche
- *	@author Sebastien Piraux
- *	@author Toon Keppens (Vi-Host.net)
- *
- *	@package chamilo.tracking
- */
+*	@author Thomas Depraetere
+*	@author Hugues Peeters
+*	@author Christophe Gesche
+*	@author Sebastien Piraux
+*	@author Toon Keppens (Vi-Host.net)
+*
+*	@package chamilo.tracking
+*/
 
 /*
  *	INIT SECTION
@@ -71,6 +70,16 @@ if ($export_csv) {
 }
 $csv_content = array();
 
+// charset determination
+if (!empty($_GET['scormcontopen'])) {
+    $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
+	$contopen = (int) $_GET['scormcontopen'];
+	$sql = "SELECT default_encoding FROM $tbl_lp WHERE id = $contopen AND session_id = $session_id";
+	$res = Database::query($sql);
+	$row = Database::fetch_array($res);
+	$lp_charset = $row['default_encoding'];
+}
+
 $htmlHeadXtra[] = "<style type='text/css'>
 /*<![CDATA[*/
 .secLine {background-color : #E6E6E6;}
@@ -455,9 +464,9 @@ if ($_GET['studentlist'] == 'false') {
 
 	    $all_datas = array();
 	    $course_code = $_course['id'];
-
+	    
 		$user_ids = array_keys($a_students);
-
+		
 		$table = new SortableTable('users_tracking', array('TrackingCourseLog','get_number_of_users'), array('TrackingCourseLog','get_user_data'), (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2);
 
 		$parameters['cidReq'] 		= Security::remove_XSS($_GET['cidReq']);

+ 85 - 32
main/tracking/courseLogCSV.php

@@ -12,21 +12,39 @@
 
 // TODO: Is this file deprecated?
 
-/* INIT SECTION */
-
+/*
+==============================================================================
+		INIT SECTION
+==============================================================================
+*/
 $pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
 // name of the language file that needs to be included
 $language_file = "tracking";
 
-require_once '../inc/global.inc.php';
+include('../inc/global.inc.php');
 //includes for SCORM and LP
-require_once '../newscorm/learnpath.class.php';
-require_once '../newscorm/learnpathItem.class.php';
-require_once '../newscorm/scorm.class.php';
-require_once '../newscorm/scormItem.class.php';
+require_once('../newscorm/learnpath.class.php');
+require_once('../newscorm/learnpathItem.class.php');
+require_once('../newscorm/scorm.class.php');
+require_once('../newscorm/scormItem.class.php');
 
-/*	Constants and variables */
+// charset determination
+if ($_GET['scormcontopen'])
+{
+	$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
+	$contopen = (int) $_GET['scormcontopen'];
+	$sql = "SELECT default_encoding FROM $tbl_lp WHERE id = ".$contopen;
+	$res = Database::query($sql);
+	$row = Database::fetch_array($res);
+	$lp_charset = $row['default_encoding'];
+	//header('Content-Type: text/html; charset='. $row['default_encoding']);
+}
 
+/*
+-----------------------------------------------------------
+	Constants and variables
+-----------------------------------------------------------
+*/
 // regroup table names for maintenance purpose
 $TABLETRACK_ACCESS      = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
 $TABLETRACK_LINKS       = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS);
@@ -65,7 +83,11 @@ include("../resourcelinker/resourcelinker.inc.php");
 
 $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || api_is_drh();
 
-/*	MAIN CODE */
+/*
+==============================================================================
+		MAIN CODE
+==============================================================================
+*/
 
 $title[0]=get_lang('StatsOfCourse')." : ".$_course['official_code'];
 
@@ -84,14 +106,18 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
     if(!isset($view)) $view ="0000000";
 
 
-/*	Reporting */
+/***************************************************************************
+ *
+ *		Reporting
+ *
+ ***************************************************************************/
 
 	$tempView = $view;
     if($view[6] == '1'){
 
     	$tempView[6] = '0';
 
-        // BEGIN users in this course
+        //--------------------------------BEGIN users in this course
         $sql = "SELECT $TABLECOURSUSER.user_i, $table_user.lastname, $table_user.firstname
                     FROM $TABLECOURSUSER, $table_user
                     WHERE $TABLECOURSUSER.course_code = '".$_cid."' AND $TABLECOURSUSER.user_id = $table_user.user_id AND $TABLECOURSUSER.relation_type<>".COURSE_RELATION_TYPE_RRHH."
@@ -112,7 +138,7 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
             {
 
 
-            	// BEGIN % visited
+            	//--------------------------------BEGIN % visited
             	// sum of all items (= multiple learningpaths + SCORM imported paths)
             	$sql = "SELECT COUNT(DISTINCT(iv.lp_item_id)) " .
             			"FROM $tbl_learnpath_item_view iv " .
@@ -131,11 +157,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
             	// calculation & bgcolor setting
             	$lpath_pct_completed = empty($total_lpath_items) ? "-" : round(($total_lpath_items_completed / $total_lpath_items) * 100);
 
-            	// END % visited
+            	//--------------------------------END % visited
 
 
 
-            	// BEGIN first/last access
+            	//--------------------------------BEGIN first/last access
             	// first access
             	$sql = "SELECT access_date FROM $TABLETRACK_ACCESS_2 WHERE access_user_id = '".$results[$j][0]."' AND access_cours_code = '".$_course['official_code']."' AND access_tool = 'learnpath' AND access_session_id = '".api_get_session_id()."' ORDER BY access_id ASC LIMIT 1";
             	$first_access = getOneResult($sql);
@@ -145,14 +171,14 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
             	$sql = "SELECT access_date FROM $TABLETRACK_ACCESS WHERE access_user_id = '".$results[$j][0]."' AND access_cours_code = '".$_course['official_code']."' AND access_tool = 'learnpath'";
             	$last_access = getOneResult($sql);
             	$last_access = empty($last_access) ? "-" : date('d.m.y',strtotime($last_access));
-            	// END first/last access
+            	//--------------------------------END first/last access
 
 
 
-            	// BEGIN presentation of data
+            	//--------------------------------BEGIN presentation of data
 				$line .= $results[$j][1]." ".$results[$j][2].";".$first_access.";".$last_access.";".$lpath_pct_completed."\n";
 
-				// END presentation of data
+				//--------------------------------END presentation of data
 
 
 
@@ -168,7 +194,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 
 
 
-/*	Main */
+/***************************************************************************
+ *
+ *		Main
+ *
+ ***************************************************************************/
 
     $tempView = $view;
     if($view[0] == '1')
@@ -187,7 +217,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
     }
 
 
-/*	Access to this course */
+/***************************************************************************
+*
+*		Access to this course
+*
+***************************************************************************/
     $tempView = $view;
     if($view[1] == '1'){
 
@@ -240,7 +274,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 
 
 
-/*	Tools */
+/***************************************************************************
+ *
+ *		Tools
+ *
+ ***************************************************************************/
 	$tempView = $view;
 	if($view[2] == '1'){
 
@@ -275,7 +313,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 	}
 
 
-/*	Links */
+/***************************************************************************
+*
+*		Links
+*
+***************************************************************************/
 
     $tempView = $view;
     if($view[3] == '1'){
@@ -310,7 +352,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
     }
 
 
-/*	Documents */
+/***************************************************************************
+*
+*		Documents
+*
+***************************************************************************/
 
     $tempView = $view;
     if($view[4] == '1'){
@@ -344,7 +390,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
     }
 
 
-/*	Scorm contents and Learning Path */
+/***************************************************************************
+*
+*		Scorm contents and Learning Path
+*
+***************************************************************************/
     $tempView = $view;
     if($view[5] == '1'){
 
@@ -405,8 +455,9 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 							    $ar3=Database::fetch_array($result3);
 						        $title_line .= get_lang('ScormTitleColumn').";".get_lang('ScormStatusColumn').";".get_lang('ScormScoreColumn').";".get_lang('ScormTimeColumn');
 								while ($ar3['status'] != '') {
-									require_once '../newscorm/learnpathItem.class.php';
+									require_once('../newscorm/learnpathItem.class.php');
 									$time = learnpathItem::get_scorm_time('php',$ar3['total_time']);
+									$title = api_htmlentities($ar3['title'],ENT_QUOTES,$lp_charset);
 									$line .= $title.";".$ar3['status'].";".$ar3['score'].";".$time;
 									$ar3=Database::fetch_array($result3);
 								}
@@ -431,17 +482,17 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 
 
     }
+	 /***************************************************************************
+     *
+     *		Export to a CSV file
+     *		force the browser to save the file instead of opening it
+     ***************************************************************************/
 
-	/*
-	 * Export to a CSV file
-     * Force the browser to save the file instead of opening it.
-     */
 	$len = strlen($title_line.$line);
 	header('Content-type: application/octet-stream');
 	//header('Content-Type: application/force-download');
 	header('Content-length: '.$len);
-	$filename = api_html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv')));
-	$filename = replace_dangerous_char($filename);
+	$filename = html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv')));
 	if(preg_match("/MSIE 5.5/",$_SERVER['HTTP_USER_AGENT']))
 	{
 		header('Content-Disposition: filename= '.$filename);
@@ -459,11 +510,12 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 	header('Content-Description: '.$filename);
 	header('Content-transfer-encoding: binary');
 
-	echo api_html_entity_decode($title_line, ENT_COMPAT);
-	echo api_html_entity_decode($line, ENT_COMPAT);
+	echo api_html_entity_decode($title_line, ENT_COMPAT, $charset);
+	echo api_html_entity_decode($line, ENT_COMPAT, $charset);
 	exit;
 
 
+
 }
 // not allowed
 else
@@ -477,3 +529,4 @@ else
         api_not_allowed();
     }
 }
+?>

+ 58 - 24
main/tracking/userLog.php

@@ -1,4 +1,4 @@
-<?php
+<?php // $Id: userLog.php 21626 2009-06-26 12:19:41Z pcool $
 /* For licensing terms, see /license.txt */
 
 // TODO: Is this file deprecated?
@@ -17,8 +17,8 @@ $view  = $_REQUEST['view'];
 // name of the language file that needs to be included
 $language_file = 'tracking';
 
-// Including the global initialization file
-require_once '../inc/global.inc.php';
+// including the global Dokeos file
+//include('../inc/global.inc.php');
 
 // the section (for the tabs)
 $this_section = "session_my_space";
@@ -29,15 +29,34 @@ $course_id = api_get_course_id();
 
 //YW Hack security to quick fix RolesRights bug
 $is_allowed = true;
+/*
+-----------------------------------------------------------
+	Libraries
+-----------------------------------------------------------
+*/
+include(api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php');
+include(api_get_path(LIBRARY_PATH).'course.lib.php');
+include(api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php');
+require_once(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php');
 
-/*	Libraries */
-
-require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
-require_once api_get_path(LIBRARY_PATH).'course.lib.php';
-require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
-require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php';
-
-/*	Header */
+/*
+-----------------------------------------------------------
+	Header
+-----------------------------------------------------------
+*/
+// charset determination
+if (isset($_GET['scormcontopen'])) {
+	$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
+	$contopen = Database::escape_string($_GET['scormcontopen']);
+	if (is_numeric($contopen)) {
+		$contopen = intval($contopen);
+		$sql = "SELECT default_encoding FROM $tbl_lp WHERE id = ".$contopen;
+		$res = Database::query($sql);
+		$row = Database::fetch_array($res);
+		$lp_charset = $row['default_encoding'];
+	}
+	//header('Content-Type: text/html; charset='. $row['default_encoding']);
+}
 
 /*
 $interbreadcrumb[]= array ("url"=>"../group/group.php", "name"=> get_lang('BredCrumpGroups'));
@@ -65,8 +84,11 @@ td {border-bottom: thin dashed gray;}
 
 Display::display_header($nameTools,"Tracking");
 
-/*	Constants and variables */
-
+/*
+-----------------------------------------------------------
+	Constants and variables
+-----------------------------------------------------------
+*/
 $is_allowedToTrack = $is_courseAdmin;
 $is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_id);
 
@@ -124,7 +146,11 @@ $MonthsShort = api_get_months_short();
 $is_allowedToTrack = true; // allowed to track only user of one group
 $is_allowedToTrackEverybodyInCourse = $is_allowedToTrack; // allowed to track all students in course
 
-/*	MAIN SECTION */
+/*
+==============================================================================
+		MAIN SECTION
+==============================================================================
+*/
 ?>
 <h3>
 	<?php echo $nameTools ?>
@@ -137,9 +163,11 @@ $is_allowedToTrackEverybodyInCourse = $is_allowedToTrack; // allowed to track al
 // check if uid is tutor of this group
 if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configuration['tracking_enabled'] ) {
 	if(!$uInfo && !isset($uInfo) ) {
-		/*
-		 *		Display list of user of this group
-		 */
+		/***************************************************************************
+		*
+		*		Display list of user of this group
+		*
+		***************************************************************************/
 
 		echo "<h4>".get_lang('ListStudents')."</h4>";
 		if( $is_allowedToTrackEverybodyInCourse ) {
@@ -229,9 +257,11 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 	} else {
 		// if uInfo is set
 
-		/*
-		 *		Informations about student uInfo
-		 */
+		/***************************************************************************
+		*
+		*		Informations about student uInfo
+		*
+		***************************************************************************/
 		// these checks exists for security reasons, neither a prof nor a tutor can see statistics of a user from
 		// another course, or group
 		if( $is_allowedToTrackEverybodyInCourse ) {
@@ -296,9 +326,11 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 		}
 
 
-		/*
+		/***************************************************************************
+         *
          *		Scorm contents and Learning Path
-         */
+         *
+         ***************************************************************************/
         if(substr($view,5,1) == '1') {
             $new_view = substr_replace($view,'0',5,1);
             echo "<tr>
@@ -348,10 +380,11 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
        				                </td>
        					            </tr>";
        							while ($ar3['status'] != '') {
-									require_once '../newscorm/learnpathItem.class.php';
+									require_once('../newscorm/learnpathItem.class.php');
 									$time = learnpathItem::get_scorm_time('php',$ar3['total_time']);
+									$title = api_htmlentities($ar3['title'],ENT_QUOTES,$lp_charset);
        								echo "<tr><td>&nbsp;&nbsp;&nbsp;</td><td>";
-       								echo "$title</td><td align=right>{$ar3['status']}</td><td align=right>{$ar3['score']}</td><td align=right>$time</td>";
+       								echo "$title</td><td align=right>{$ar3['status']}</td><td     align=right>{$ar3['score']}</td><td align=right>$time</td>";
        								echo "</tr>";
        								$ar3=Database::fetch_array($result3);
        							}
@@ -399,3 +432,4 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 </table>
 <?php
 Display::display_footer();
+?>

+ 66 - 29
main/tracking/userlogCSV.php

@@ -3,18 +3,23 @@
 // TODO: Is this file deprecated?
 
 /**
- * @package chamilo.tracking
- * @todo clean code - structure is unclear and difficult to modify
- */
-
-/*	INIT SECTION */
+==============================================================================
+* @package dokeos.tracking
+* @todo clean code - structure is unclear and difficult to modify
+==============================================================================
+*/
 
+/*
+==============================================================================
+		INIT SECTION
+==============================================================================
+*/
 $uInfo = $_REQUEST['uInfo'];
 $view = $_REQUEST['view'];
 // name of the language file that needs to be included
 $language_file = 'tracking';
 
-require_once '../inc/global.inc.php';
+include('../inc/global.inc.php');
 
 // Roles and rights system
 $user_id = api_get_user_id();
@@ -30,15 +35,33 @@ RolesRights::protect_location($role_id, $location_id);
 */
 //YW Hack security to quick fix RolesRights bug
 $is_allowed = true;
+/*
+-----------------------------------------------------------
+	Libraries
+-----------------------------------------------------------
+*/
+include(api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php');
+include(api_get_path(LIBRARY_PATH).'course.lib.php');
+include(api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php');
+require_once(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php');
 
-/*	Libraries */
-
-require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
-require_once api_get_path(LIBRARY_PATH).'course.lib.php';
-require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
-require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php';
+/*
+-----------------------------------------------------------
+	Header
+-----------------------------------------------------------
+*/
+// charset determination
+if ($_GET['scormcontopen'])
+{
+	$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
+	$contopen = (int) $_GET['scormcontopen'];
+	$sql = "SELECT default_encoding FROM $tbl_lp WHERE id = ".$contopen;
+	$res = Database::query($sql);
+	$row = Database::fetch_array($res);
+	$lp_charset = $row['default_encoding'];
+	//header('Content-Type: text/html; charset='. $row['default_encoding']);
+}
 
-/*	Header */
 
 /*
 $interbreadcrumb[]= array ("url"=>"../group/group.php", "name"=> get_lang('BredCrumpGroups'));
@@ -52,8 +75,12 @@ if($uInfo)
 
 $nameTools = get_lang('ToolName');
 
-/*	Constants and variables */
 
+/*
+-----------------------------------------------------------
+	Constants and variables
+-----------------------------------------------------------
+*/
 $is_allowedToTrack = $is_courseAdmin;
 $is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_id);
 
@@ -113,8 +140,11 @@ $MonthsShort = api_get_months_short();
 $is_allowedToTrack = true; // allowed to track only user of one group
 $is_allowedToTrackEverybodyInCourse = $is_allowedToTrack; // allowed to track all students in course
 
-/*	MAIN SECTION */
-
+/*
+==============================================================================
+		MAIN SECTION
+==============================================================================
+*/
 $title[0]='';
 $title[1]='';
 $line='';
@@ -125,9 +155,11 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 {
 	if(!$uInfo && !isset($uInfo) )
 	{
-		/*
-		 *		Display list of user of this group
-		 */
+		/***************************************************************************
+		*
+		*		Display list of user of this group
+		*
+		***************************************************************************/
 
 		if( $is_allowedToTrackEverybodyInCourse )
 		{
@@ -208,9 +240,11 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 	}
 	else // if uInfo is set
 	{
-		/*
-		 *		Informations about student uInfo
-		 */
+		/***************************************************************************
+		*
+		*		Informations about student uInfo
+		*
+		***************************************************************************/
 		// these checks exists for security reasons, neither a prof nor a tutor can see statistics of a user from
 		// another course, or group
 		if( $is_allowedToTrackEverybodyInCourse )
@@ -267,9 +301,11 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 		}
 
 
-		/*
+		/***************************************************************************
+         *
          *		Scorm contents and Learning Path
-         */
+         *
+         ***************************************************************************/
          //TODO: scorm tools is in work and the logs will change in few days...
         /*if(substr($view,5,1) == '1')
         {
@@ -302,6 +338,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
        							while ($ar3['status'] != '') {
 									require_once('../newscorm/learnpathItem.class.php');
 									$time = learnpathItem::get_scorm_time('php',$ar3['total_time']);
+									$title = api_htmlentities($ar3['title'],ENT_QUOTES,$lp_charset);
        								$line .= $title.';'.$ar3['status'].';'.$ar3['score'].';'.$time."\n";
        								$ar3=Database::fetch_array($result3);
        							}
@@ -328,17 +365,17 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
         }*/
 
     }
-	 /*
-      *		Export to a CSV file
-      *		force the browser to save the file instead of opening it
-      */
+	 /***************************************************************************
+     *
+     *		Export to a CSV file
+     *		force the browser to save the file instead of opening it
+     ***************************************************************************/
 
 	$len = strlen($title_line.$line);
 	header('Content-type: application/octet-stream');
 	//header('Content-Type: application/force-download');
 	header('Content-length: '.$len);
 	$filename = html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv')));
-	$filename = replace_dangerous_char($filename);
 	if(preg_match("/MSIE 5.5/",$_SERVER['HTTP_USER_AGENT']))
 	{
 		header('Content-Disposition: filename= '.$filename);