@ -1,5 +1,6 @@ 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					<?php  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					/* For licensing terms, see /license.txt */  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					/**  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					 * This script displays statistics on the current learning path (scorm)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					 *  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -14,7 +15,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,9 +31,9 @@ $session_condition = api_get_session_condition($session_id); 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//$user_id = $_user['user_id'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//$stats_charset = $_SESSION['oLP']->encoding  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if(!isset($origin))  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  (!isset($origin))  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$origin = '';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if($origin != 'tracking') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  ($origin != 'tracking') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						if (!empty ($stats_charset)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							$lp_charset = $stats_charset;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						} else {  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -48,28 +49,28 @@ if($origin != 'tracking') { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						include_once api_get_path(INCLUDE_PATH).'reduced_header.inc.php';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						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']; 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     } 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						// 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  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					// The Chamilo  interface's encoding  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$dokeos_charset = api_get_setting('platform_charset');  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$output = '';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//if display in fullscreen required  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//  if display in fullscreen required.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if (!empty($_GET['fs']) & &  strcmp($_GET['fs'], 'true') == 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$output .= '< table  width = "100%"  align = "center" > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$output .= '< table  width = "100%" > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//c heck if the user asked for the "extend all" option  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					// C heck if the user asked for the "extend all" option.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$extend_all_link = '';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$extend_all = 0;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if ($origin == 'tracking') {  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -89,9 +90,10 @@ if ($origin != 'tracking') { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$output .= "< tr > < td > < div  class = 'title' > " . api_convert_encoding(get_lang('ScormMystatus'), $lp_charset, $dokeos_charset) . "< / div > < / td > < / tr > ";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$output .= "< tr > < td >   < / 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  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					// 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  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					// the database table.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$TBL_LP_ITEM = Database :: get_course_table(TABLE_LP_ITEM);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$TBL_LP_VIEW = Database :: get_course_table(TABLE_LP_VIEW);  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -99,7 +101,7 @@ $tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_E 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$tbl_stats_attempts= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$tbl_quiz_questions= Database :: get_course_table(TABLE_QUIZ_QUESTION);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$sql = "SELECT max(view_count) FROM $TBL_LP_VIEW " .  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					"WHERE lp_id = $lp_id AND user_id = '" . $user_id . "' $session_condition";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 "WHERE lp_id = $lp_id AND user_id = '" . $user_id . "' $session_condition"; 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$res = Database::query($sql);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$view = '';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$num = 0;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -109,7 +111,7 @@ if (Database :: num_rows($res) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$counter = 0;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//error_log('New LP - Querying views for latest attempt: '.$sql,0);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//error_log('New LP - Querying views for latest attempt: '.$sql,  0);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$total_score = 0;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$total_max_score = 0;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$total_time = 0;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -124,7 +126,7 @@ if (!empty($export_csv)) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					// get attempts of a exercise   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					// Get attempts of a exercise.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if (isset($_GET['lp_id']) & &  isset($_GET['my_lp_id'])) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$clean_lp_item_id = Database::escape_string($_GET['my_lp_id']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$clean_lp_id = Database::escape_string($_GET['lp_id']);  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -133,7 +135,7 @@ if (isset($_GET['lp_id']) && isset($_GET['my_lp_id'])) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$res_path = Database::query($sql_path);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$row_path = Database::fetch_array($res_path);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						if (Database::num_rows($res_path) > 0  ){  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						if (Database::num_rows($res_path) > 0)  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ($origin != 'tracking') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . (int)$row_path['path'] . '" AND exe_user_id="' . (int)api_get_user_id() . '" AND orig_lp_id = "'.(int)$clean_lp_id.'" AND orig_lp_item_id = "'.(int)$clean_lp_item_id.'" AND exe_cours_id="' . $clean_course_code. '" AND status < > "incomplete" AND session_id = '.$session_id.' ORDER BY exe_date';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							} else {  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -141,7 +143,6 @@ if (isset($_GET['lp_id']) && isset($_GET['my_lp_id'])) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$sql_attempts;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$TBL_QUIZ = Database :: get_course_table(TABLE_QUIZ_TEST);  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -150,12 +151,12 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						foreach ($list as $my_item_id) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							$extend_this = 0;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							$qry_order = 'DESC';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ((!empty ($_GET['extend_id']) and $_GET['extend_id'] == $my_item_id) OR  $extend_all) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if ((!empty ($_GET['extend_id']) & &  $_GET['extend_id'] == $my_item_id) ||  $extend_all) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$extend_this = 1;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$qry_order = 'ASC';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							//prepare statement to go through each attempt  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							// Prepare statement to go through each attempt.  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if (!empty ($view)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$sql = "SELECT iv.status as mystatus, v.view_count as mycount, " .  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								" iv.score as myscore, iv.total_time as mytime, i.id as myid, i.lp_id as mylpid, iv.lp_view_id as mylpviewid, " .  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -188,37 +189,37 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								" AND v.session_id = $session_id " .  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								" ORDER BY iv.view_count $qry_order ";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							//$sql.'< br / > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							//echo  $sql.'< br   / > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							$result = Database::query($sql);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							$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);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$result_disabled_ext_all = false;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if($row['item_type'] == 'quiz') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									//check results_disabled in quiz table   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if  ($row['item_type'] == 'quiz') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									// Check results_disabled in quiz table.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$my_path = Database::escape_string($row['path']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE id ='".(int)$my_path."'";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$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;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//echo '< br > < pre > '; print_r($row); echo '< / pre > < br > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//i f there are several attempts, and the link to extend has been clicked, show each attempt...  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//echo '< br   / > < pre > '; print_r($row); echo '< / pre > < br   / > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// I f there are several attempts, and the link to extend has been clicked, show each attempt...  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if (($counter % 2) == 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$oddclass = "row_odd" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$oddclass = 'row_odd' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$oddclass = "row_even" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$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 = "'.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";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -239,24 +240,24 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								do {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$row['iv_view_count'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									//check if there are interactions below   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									// Check if there are interactions below.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$extend_attempt_link = '';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$extend_this_attempt = 0;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									if ((learnpath :: get_interactions_count_from_db($row['iv_id']) > 0 || learnpath :: get_objectives_count_from_db($row['iv_id']) > 0) & &  !$extend_all) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										if (!empty ($_GET['extend_attempt_id']) & &  $_GET['extend_attempt_id'] == $row['iv_id']) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											//t he extend button for this attempt has been clicked  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											// T he 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 = "'.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 { //s ame case if fold_attempt_id is set, so not implemented explicitly  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											//t he extend button for this attempt has not been clicked  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										} else { // S ame case if fold_attempt_id is set, so not implemented explicitly.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											// T he 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 = "'.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";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									if (($counter % 2) == 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$oddclass = "row_odd" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$oddclass = 'row_odd' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$oddclass = "row_even" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$oddclass = 'row_even' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$lesson_status = $row['mystatus'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$score = $row['myscore'];  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -277,15 +278,13 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$maxscore = $row['mymaxscore'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										else  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										{  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$maxscore = $row['mymaxscore'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									//Remove "NaN" if any (@todo: locate the source of these NaN)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									//  Remove "NaN" if any (@todo: locate the source of these NaN)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$time = str_replace('NaN', '00' . $h . '00\'00"', $time);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									if (($lesson_status == 'completed') or  ($lesson_status == 'passed')) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									if (($lesson_status == 'completed') ||  ($lesson_status == 'passed')) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$color = 'green';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$color = 'black';  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -296,14 +295,11 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										'failed' => 'ScormFailed',  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										'passed' => 'ScormPassed',  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										'browsed' => 'ScormBrowsed',  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										'not attempted' => 'ScormNotAttempted',  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										'not attempted' => 'ScormNotAttempted'  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$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) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -342,19 +338,19 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$list1 = learnpath :: get_iv_interactions_array($row['iv_id']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										foreach ($list1 as $id => $interaction) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											if (($counter % 2) == 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$oddclass = "row_odd" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$oddclass = 'row_odd' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$oddclass = "row_even" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$oddclass = 'row_even' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$student_response=urldecode($interaction['student_response']);//code added by isaac flores   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$content_student_response=array();  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$content_student_response=explode('__|',$student_response);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$student_response  =  urldecode($interaction['student_response']); // Code added by Isaac Flores.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$content_student_response  =  array();  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$content_student_response  =  explode('__|',$student_response);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											if (count($content_student_response)>0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												if (count($content_student_response)>=3) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$new_content_student_response=array_pop($content_student_response);//Pop the element off the end of array  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												if (count($content_student_response)  >=  3) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$new_content_student_response  =  array_pop($content_student_response);  //  Pop the element off the end of array.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$student_response=implode(',',$content_student_response);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$student_response  =  implode(',',$content_student_response);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$output .= "< tr  class = '$oddclass' > \n" . '< td > < / td > ' . "\n" . '< td > < / td > ' . "\n" . '< td >   < / 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"  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -366,9 +362,9 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$list2 = learnpath :: get_iv_objectives_array($row['iv_id']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										foreach ($list2 as $id => $interaction) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											if (($counter % 2) == 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$oddclass = "row_odd" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$oddclass = 'row_odd' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$oddclass = "row_even" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$oddclass = 'row_even' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$output .= "< tr  class = '$oddclass' > \n" . '< td > < / td > ' . "\n" . '< td > < / td > ' . "\n" . '< td >   < / td > ' . "\n" . '< td > ' . $interaction['order_id'] . '< / td > ' . "\n" . '< td  colspan = "2" > ' . $interaction['objective_id'] . '< / td > ' . "\n" .  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											'< td  colspan = "2" > ' . $interaction['status'] . "< / td > \n" .  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -387,39 +383,39 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$result_disabled_ext_all = false;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if($row['item_type'] == 'quiz') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									//check results_disabled in quiz table   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if  ($row['item_type'] == 'quiz') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									// Check results_disabled in quiz table.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$my_path = Database::escape_string($my_path);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE id ='".(int)$my_path."'";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$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;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//check if there are interactions below   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// Check if there are interactions below.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$extend_attempt_link = '';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$extend_this_attempt = 0;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$inter_num = learnpath :: get_interactions_count_from_db($row['iv_id']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$objec_num = learnpath :: get_objectives_count_from_db($row['iv_id']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if (($inter_num > 0 || $objec_num > 0) & &  !$extend_all) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									if (!empty ($_GET['extend_attempt_id']) & &  $_GET['extend_attempt_id'] == $row['iv_id']) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										//t he extend button for this attempt has been clicked  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										// T he 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 = "'.api_convert_encoding(get_lang('HideAttemptView'),$lp_charset,$charset).'"  title = "'.api_convert_encoding(get_lang('HideAttemptView'),$lp_charset,$charset).'"  border = "0" > < / a > ' . "\n";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									} else { //s ame case if fold_attempt_id is set, so not implemented explicitly  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										//t he extend button for this attempt has not been clicked  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									} else { // S ame case if fold_attempt_id is set, so not implemented explicitly.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										// T he 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 = "'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'"  title = "'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'"  border = "0" > < / a > ' . "\n";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if (($counter % 2) == 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$oddclass = "row_odd" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$oddclass = 'row_odd' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$oddclass = "row_even" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$oddclass = 'row_even' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//$extend_link = '< img  src = "../img/invisible.gif"  alt = "extend_disabled" > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$extend_link = '';  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -427,14 +423,14 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$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" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$oddclass = 'row_odd' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$oddclass = "row_even" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$oddclass = 'row_even' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$lesson_status = $row['mystatus'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$score = $row['myscore'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$subtotal_time = $row['mytime'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//if($row['mytime']==0){  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//if  ($row['mytime']  ==  0)  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								while ($tmp_row = Database :: fetch_array($result)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$subtotal_time += $tmp_row['mytime'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -444,7 +440,7 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$scoIdentifier = $row['myid'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$title = $row['mytitle'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// s electing the exe_id from stats attempts tables in order to look the max score value  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// S electing the exe_id from stats attempts tables in order to look the max score value.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if ($origin != 'tracking') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . api_get_user_id() . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status < > "incomplete" AND session_id = '.$session_id.' ORDER BY exe_date DESC limit 1';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								} else {  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -473,7 +469,7 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										if ($row['item_type'] == 'quiz') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											// g et score and total time from last attempt of a exercise en lp  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											// G et score and total time from last attempt of a exercise en lp.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$sql = "SELECT score FROM $TBL_LP_ITEM_VIEW WHERE lp_item_id = '".(int)$my_id."' and lp_view_id = '".(int)$my_lp_view_id."'  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													ORDER BY view_count DESC limit 1";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$res_score = Database::query($sql);  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -489,11 +485,10 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$score = 0;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$subtotal_time =  0;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											//echo $subtotal_time ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											//$time = learnpathItem :: get_scorm_time('js', $subtotal_time);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											// selecting the max score from an attempt   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											// Selecting the max score from an attempt.   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$sql = "SELECT SUM(t.ponderation) as maxscore from ( SELECT distinct question_id, marks,ponderation FROM $tbl_stats_attempts as at " .  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												  "INNER JOIN  $tbl_quiz_questions as q  on(q.id = at.question_id) where exe_id ='$id_last_attempt' ) as t";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -512,7 +507,7 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if (empty ($title)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//Remove "NaN" if any (@todo: locate the source of these NaN)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//  Remove "NaN" if any (@todo: locate the source of these NaN)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//$time = str_replace('NaN', '00'.$h.'00\'00"', $time);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if (($lesson_status == 'completed') or ($lesson_status == 'passed')) {  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -582,7 +577,7 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										 } else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										     $output .= ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore));  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											 $output .= ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore));  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										 }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										 $output .= "< / div > < / td > \n" . '< td  colspan = "2" > < div  class = "mystatus" > ' . $time . "< / div > < / td > < td > $correct_test_link< / td > \n";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										 $output .= "< / tr > \n";  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -608,14 +603,15 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$csv_content[] = $temp;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$counter++;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if ($extend_this_attempt OR $extend_all) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$list1 = learnpath :: get_iv_interactions_array($row['iv_id']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									foreach ($list1 as $id => $interaction) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										if (($counter % 2) == 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$oddclass = "row_odd" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$oddclass = 'row_odd' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$oddclass = "row_even" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$oddclass = 'row_even' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$output .= "< tr  class = '$oddclass' > \n" . '< td > < / td > ' . "\n" . '< td > < / td > ' . "\n" . '< td >   < / 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"  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -627,9 +623,9 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$list2 = learnpath :: get_iv_objectives_array($row['iv_id']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									foreach ($list2 as $id => $interaction) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										if (($counter % 2) == 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$oddclass = "row_odd" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$oddclass = 'row_odd' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$oddclass = "row_even" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$oddclass = 'row_even' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$output .= "< tr  class = '$oddclass' > \n" . '< td > < / td > ' . "\n" . '< td > < / td > ' . "\n" . '< td >   < / td > ' . "\n" . '< td > ' . $interaction['order_id'] . '< / td > ' . "\n" . '< td  colspan = "2" > ' . $interaction['objective_id'] . '< / td > ' . "\n" .  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										'< td  colspan = "2" > ' . $interaction['status'] . "< / td > \n" .  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -638,70 +634,70 @@ if (is_array($list) && count($list) > 0) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// attempts list by exercise  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if ( (isset($_GET['lp_id']) & &  $_GET['lp_id'] == $my_lp_id ) & &  (isset($_GET['my_lp_id']) & &  $_GET['my_lp_id'] == $my_id)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$res_attempts = Database::query($sql_attempts);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$num_attempts = Database :: num_rows($res_attempts);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										if ($row['item_type'] === 'quiz') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											if ($num_attempts > 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$n=1;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												while ($row_attempts = Database :: fetch_array($res_attempts)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$my_score = $row_attempts['exe_result'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$my_maxscore = $row_attempts['exe_weighting'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$my_exe_id	= $row_attempts['exe_id'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$my_orig_lp = $row_attempts['orig_lp_id'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$my_orig_lp_item = $row_attempts['orig_lp_item_id'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$my_exo_exe_id=$row_attempts['exe_exo_id'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$mktime_start_date = convert_mysql_date($row_attempts['start_date']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$mktime_exe_date = convert_mysql_date($row_attempts['exe_date']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$mytime = ((int)$mktime_exe_date-(int)$mktime_start_date);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$time_attemp = learnpathItem :: get_scorm_time('js', $mytime);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													if (!$is_allowed_to_edit & &  $result_disabled_ext_all) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														$view_score =  Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// Attempts listing by exercise.  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if ((isset($_GET['lp_id']) & &  $_GET['lp_id'] == $my_lp_id) & &  (isset($_GET['my_lp_id']) & &  $_GET['my_lp_id'] == $my_id)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$res_attempts = Database::query($sql_attempts);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									$num_attempts = Database :: num_rows($res_attempts);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									if ($row['item_type'] === 'quiz') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										if ($num_attempts > 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$n = 1;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											while ($row_attempts = Database :: fetch_array($res_attempts)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$my_score = $row_attempts['exe_result'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$my_maxscore = $row_attempts['exe_weighting'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$my_exe_id	= $row_attempts['exe_id'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$my_orig_lp = $row_attempts['orig_lp_id'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$my_orig_lp_item = $row_attempts['orig_lp_item_id'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$my_exo_exe_id=$row_attempts['exe_exo_id'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$mktime_start_date = convert_mysql_date($row_attempts['start_date']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$mktime_exe_date = convert_mysql_date($row_attempts['exe_date']);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$mytime = ((int)$mktime_exe_date-(int)$mktime_start_date);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$time_attemp = learnpathItem :: get_scorm_time('js', $mytime);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												if (!$is_allowed_to_edit & &  $result_disabled_ext_all) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$view_score =  Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													// Show only float when need it.  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$my_score  = float_format( $my_score, 1);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$my_maxscore =float_format($my_maxscore, 1);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													if ($my_score == 0 ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														$view_score = 	'0/'.$my_maxscore;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														//show only float when need it  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														$my_score  = float_format( $my_score, 1);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														$my_maxscore =float_format($my_maxscore, 1);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														if ($my_score == 0 ){  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
															$view_score = 	'0/'.$my_maxscore;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
															if ($my_maxscore==0)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
																$view_score = $my_score;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
															else  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
																$view_score = $my_score . '/' . $my_maxscore;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														//$view_score = ($my_score == 0 ? '0.00/'.$my_maxscore : ($my_maxscore == 0 ? $my_score : $my_score . '/' . $my_maxscore));  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														if ($my_maxscore == 0)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
															$view_score = $my_score;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														else  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
															$view_score = $my_score . '/' . $my_maxscore;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$time_attemp;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$output .= '< tr  class = "'.$oddclass.'"  > < td >   < / 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 = "'.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 = "'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'"  title = "'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'" > < / a > < / td > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
														}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													//$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 >   < / 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 = "'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'"  title = "'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'" > < / 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 = "'.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 = "'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'"  title = "'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'" > < / 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 = "'.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 = "'.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 > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
													$n++;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											 	$output .= '< / tr > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												$n++;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
											$output .= '< tr > < td  colspan = "12" >   < / td > < / tr > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										$output .= '< tr > < td  colspan = "12" >   < / td > < / tr > ';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							$total_time += $time_for_total;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							//QUIZZ IN LP  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							//  QUIZZ IN LP  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							$a_my_id = array();  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if (!empty($my_lp_id)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								$a_my_id[] = $my_lp_id;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -721,7 +717,6 @@ if (!empty($a_my_id)) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, $a_my_id);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						if ($origin == 'tracking') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							$my_studen_id = $student_id;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							$my_course_id = Database::escape_string($_GET['course']);  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -736,12 +731,12 @@ if (!empty($a_my_id)) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$total_time = learnpathItem :: get_scorm_time('js', $total_time);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//$total_time = str_replace('NaN','00:00:00',$total_time);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//$total_time = str_replace('NaN',  '00:00:00'  ,$total_time);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					$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))  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -751,9 +746,9 @@ if(!$is_allowed_to_edit && $result_disabled_ext_all) { 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if (($counter % 2) == 0) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$oddclass = "row_odd" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$oddclass = 'row_odd' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					} else {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$oddclass = "row_even" ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						$oddclass = 'row_even' ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if (empty($extend_all)) {