|
|
|
|
|
|
0)
{
$i = 0;
while($a_learnpath = mysql_fetch_array($resultLearnpath))
{
$progress = learnpath :: get_db_progress($a_learnpath['id'],$student_id, '%',$a_infosCours['db_name']);
// calculates time
$sql = 'SELECT SUM(total_time)
FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' AS item_view
INNER JOIN '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view.' AS view
ON item_view.lp_view_id = view.id
AND view.lp_id = '.$a_learnpath['id'].'
AND view.user_id = '.intval($_GET['student']);
$rs = api_sql_query($sql, __FILE__, __LINE__);
$total_time = mysql_result($rs, 0, 0);
// calculates last connection time
$sql = 'SELECT MAX(start_time)
FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' AS item_view
INNER JOIN '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view.' AS view
ON item_view.lp_view_id = view.id
AND view.lp_id = '.$a_learnpath['id'].'
AND view.user_id = '.intval($_GET['student']);
$rs = api_sql_query($sql, __FILE__, __LINE__);
$start_time = mysql_result($rs, 0, 0);
$sql = 'SELECT id as item_id, max_score
FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_item.' AS lp_item
WHERE lp_id='.$a_learnpath['id'].'
AND item_type="quiz"';
$rsItems = api_sql_query($sql, __FILE__, __LINE__);
$total_score = $total_weighting = 0;
while($item = Database :: fetch_array($rsItems, 'ASSOC'))
{
$sql = 'SELECT score as student_score
FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view.' as lp_view
LEFT JOIN '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' as lp_view_item
ON lp_view.id = lp_view_item.lp_view_id
AND lp_view_item.lp_item_id = '.$item['item_id'].'
WHERE lp_view.user_id = '.intval($_GET['student']).'
AND '.$a_learnpath['id'];
$rsScores = api_sql_query($sql, __FILE__, __LINE__);
$total_score += mysql_result($rsScores, 0, 0);
$total_weighting += $item['max_score'];
}
$score = round($total_score / $total_weighting * 100,2);
if($i%2==0){
$s_css_class="row_odd";
}
else{
$s_css_class="row_even";
}
$i++;
$csv_content[] = array(stripslashes($a_learnpath['name']),api_time_to_hms($total_time),$progress.' %',date('Y-m-d',$start_time));
?>
|
|
|
|
|
0 || $score > 0)
{
?>
|
".get_lang('NoLearnpath')."
|
";
}
?>
|
|
|
|
|
0)
{
while($a_exercices = mysql_fetch_array($resultExercices))
{
$sqlEssais = " SELECT COUNT(ex.exe_id) as essais
FROM $tbl_stats_exercices AS ex
WHERE ex.exe_cours_id = '".$a_infosCours['code']."'
AND ex.exe_exo_id = ".$a_exercices['id']."
AND exe_user_id='".$_GET["student"]."'"
;
$resultEssais = api_sql_query($sqlEssais);
$a_essais = mysql_fetch_array($resultEssais);
$sqlScore = "SELECT exe_id, exe_result,exe_weighting
FROM $tbl_stats_exercices
WHERE exe_user_id = ".$_GET['student']."
AND exe_cours_id = '".$a_infosCours['code']."'
AND exe_exo_id = ".$a_exercices['id']."
ORDER BY exe_date DESC LIMIT 1";
$resultScore = api_sql_query($sqlScore);
$score = 0;
while($a_score = mysql_fetch_array($resultScore))
{
$score = $score + $a_score['exe_result'];
$weighting = $weighting + $a_score['exe_weighting'];
$exe_id = $a_score['exe_id'];
}
$pourcentageScore = round(($score*100)/$weighting);
$weighting = 0;
$csv_content[] = array($a_exercices['title'], $pourcentageScore.' %', $a_essais['essais']);
if($i%2==0){
$s_css_class="row_odd";
}
else{
$s_css_class="row_even";
}
$i++;
echo "
";
echo $a_exercices['title'];
echo " |
";
echo "
";
echo $pourcentageScore.' %';
echo " |
";
echo $a_essais['essais'];
echo " |
";
$sql_last_attempt='SELECT exe_id FROM '.$tbl_stats_exercices.' WHERE exe_exo_id="'.$a_exercices['id'].'" AND exe_user_id="'.$_GET['student'].'" AND exe_cours_id="'.$a_infosCours['code'].'" ORDER BY exe_date DESC LIMIT 1';
$resultLastAttempt = api_sql_query($sql_last_attempt);
$id_last_attempt=mysql_result($resultLastAttempt,0,0);
if($a_essais['essais']>0)
echo ' ';
echo " |
";
$dataExercices[$i][] = $a_exercices['title'];
$dataExercices[$i][] = $pourcentageScore.'%';
$dataExercices[$i][] = $a_essais['essais'];
//$dataExercices[$i][] = corrections;
$i++;
}
}
else
{
echo "
".get_lang('NoExercise')."
|
";
}
?>
|