Browse Source

[svn r12872] Fix a bug

Julian Prud'homme 17 years ago
parent
commit
2dee7e8513
1 changed files with 15 additions and 4 deletions
  1. 15 4
      main/newscorm/lp_stats.php

+ 15 - 4
main/newscorm/lp_stats.php

@@ -139,11 +139,22 @@ foreach ($list as $my_item_id) {
 
 		if ($row['item_type'] != 'dokeos_chapter') {
 			if($row['item_type'] == 'quiz'){
-				if($_SESSION['status'][$_course["id"]] == 5){
-					$correct_test_link = '<a href="../exercice/exercise_show.php?origin=student_progress&id='.$row['path'].'&cidReq='.$_SESSION['_course']['id'].'" target="_parent"><img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif"></a>';
+				
+				if($origin != 'tracking'){
+					$sql_last_attempt='SELECT exe_id FROM '.$tbl_stats_exercices.' WHERE exe_exo_id="'.$row['path'].'" AND exe_user_id="'.api_get_user_id().'" AND exe_cours_id="'.$_SESSION['_course']['id'].'" ORDER BY exe_date DESC LIMIT 1';
 				}
 				else{
-					$correct_test_link = '<a href="../exercice/exercise_show.php?origin=tracking_course&id='.$row['path'].'&cidReq='.$_SESSION['_course']['id'].'&student='.$_GET['student_id'].'" target="_parent"><img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif"></a>';
+					$sql_last_attempt='SELECT exe_id FROM '.$tbl_stats_exercices.' WHERE exe_exo_id="'.$row['path'].'" AND exe_user_id="'.$_GET['student_id'].'" AND exe_cours_id="'.$_SESSION['_course']['id'].'" ORDER BY exe_date DESC LIMIT 1';
+				}
+				
+				$resultLastAttempt = api_sql_query($sql_last_attempt);
+				$id_last_attempt=mysql_result($resultLastAttempt,0,0);
+				
+				if($origin != 'tracking'){
+					$correct_test_link = '<a href="../exercice/exercise_show.php?origin=student_progress&id='.$id_last_attempt.'&cidReq='.$_SESSION['_course']['id'].'" target="_parent"><img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif"></a>';
+				}
+				else{
+					$correct_test_link = '<a href="../exercice/exercise_show.php?origin=tracking_course&id='.$id_last_attempt.'&cidReq='.$_SESSION['_course']['id'].'&student='.$_GET['student_id'].'" target="_parent"><img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif"></a>';
 				}
 			}
 			else{
@@ -296,7 +307,7 @@ foreach ($list as $my_item_id) {
 				$resultLastAttempt = api_sql_query($sql_last_attempt);
 				$id_last_attempt=mysql_result($resultLastAttempt,0,0);
 				
-				if($_SESSION['status'][$_course["id"]] == 5){
+				if($origin != 'tracking'){
 					$correct_test_link = '<a href="../exercice/exercise_show.php?origin=student_progress&id='.$id_last_attempt.'&cidReq='.$_SESSION['_course']['id'].'" target="_parent"><img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif"></a>';
 				}
 				else{