[svn r13770] Implement possibility of correction on all exercises attempts in a learnpath - FS#1793

skala
Yannick Warnier 17 years ago
parent b67fc35d44
commit 819341fcd5
  1. 47
      main/newscorm/lp_stats.php

@ -371,22 +371,51 @@ foreach ($list as $my_item_id) {
if ($row['item_type'] != 'dokeos_chapter') {
if($row['item_type'] == 'quiz'){
$correct_test_link = '';
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';
if($origin != 'tracking' && $origin != 'tracking_course'){
$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 ASC';
}
else{
$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';
$sql_last_attempt='SELECT exe_id FROM '.$tbl_stats_exercices.' WHERE exe_exo_id="'.$row['path'].'" AND exe_user_id="'.Database::escape_string($_GET['student_id']).'" AND exe_cours_id="'.Database::escape_string($_GET['course']).'" ORDER BY exe_date';
}
$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>';
$num = Database::num_rows($resultLastAttempt);
if($num>0)
{
if($num>1)
{
$i = 1;
while($rowLA = Database::fetch_array($resultLastAttempt))
{
$laid = $rowLA['exe_id'];
if($origin != 'tracking'){
$correct_test_link .= '<a href="../exercice/exercise_show.php?origin=student_progress&id='.$laid.'&cidReq='.$_SESSION['_course']['id'].'" target="_parent" title="'.get_lang('Attempt').' '.$i.'"><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='.$laid.'&cidReq='.Security::remove_XSS(Database::escape_string($_GET['course'])).'&student='.$_GET['student_id'].'" target="_parent" title="'.get_lang('Attempt').' '.$i.'"><img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif"></a> ';
}
$i++;
}
$correct_test_link = substr($correct_test_link,0,-1);
}
else
{
$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='.Security::remove_XSS(Database::escape_string($_GET['course'])).'&student='.$_GET['student_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
{
$correct_test_link='-';
}
}
else{

Loading…
Cancel
Save