|
|
|
|
|
|
0)
{
$i = 0;
while($a_learnpath = Database::fetch_array($resultLearnpath))
{
$any_result = false;
$progress = learnpath :: get_db_progress($a_learnpath['id'],$student_id, '%',$a_infosCours['db_name'],true);
if($progress === null)
{
$progress = '0%';
}
else
{
$any_result = true;
}
// 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 = 0;
if(Database::num_rows($rs)>0)
{
$total_time = Database::result($rs, 0, 0);
if($total_time>0) $any_result = true;
}
// 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 = null;
if(Database::num_rows($rs)>0)
{
$start_time = Database::result($rs, 0, 0);
if($start_time > 0) $any_result = true;
}
//QUIZZ IN LP
$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__);
//We get the last view id of this LP
$sql='SELECT max(id) as id FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view.' WHERE lp_id='.$a_learnpath['id'].' AND user_id="'.intval($_GET['student']).'"';
$rs_last_lp_view_id = api_sql_query($sql, __FILE__, __LINE__);
$lp_view_id = 0;
if(Database::num_rows($rs_last_lp_view_id)>0)
{
$lp_view_id = Database::result($rs_last_lp_view_id,0,'id');
if($lp_view_id > 0) $any_result = true;
}
$total_score = $total_weighting = 0;
if($lp_view_id)
{
while($item = Database :: fetch_array($rsItems, 'ASSOC'))
{
$sql = 'SELECT score as student_score
FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' as lp_view_item
WHERE lp_view_item.lp_item_id = '.$item['item_id'].'
AND lp_view_id = "'.$lp_view_id.'"';
$rsScores = api_sql_query($sql, __FILE__, __LINE__);
$total_score += mysql_result($rsScores, 0, 0);
$total_weighting += $item['max_score'];
}
$any_result = true;
}
$sql = 'SELECT id, max_score
FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_item.' AS lp_item
WHERE lp_id='.$a_learnpath['id'].'
AND item_type="sco" LIMIT 1';
$rs_lp_item_id_scorm = api_sql_query($sql, __FILE__, __LINE__);
if(Database::num_rows($rs_lp_item_id_scorm)>0){
$lp_item_id = Database::result($rs_lp_item_id_scorm,0,'id');
$lp_item__max_score = Database::result($rs_lp_item_id_scorm,0,'max_score');
$total_weighting+=$lp_item__max_score;
//We get the last view id of this LP
$sql='SELECT max(id) as id FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view.' WHERE lp_id='.$a_learnpath['id'].' AND user_id="'.intval($_GET['student']).'"';
$rs_last_lp_view_id = api_sql_query($sql, __FILE__, __LINE__);
$lp_view_id = Database::result($rs_last_lp_view_id,0,'id');
$sql='SELECT SUM(score)/count(lp_item_id) as score FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' WHERE lp_view_id="'.$lp_view_id.'" GROUP BY lp_view_id';
$rs_score = api_sql_query($sql, __FILE__, __LINE__);
if(Database::num_rows($rs_score)>0)
{
$lp_scorm_score = Database::result($rs_score,0,'score');
$total_score+=$lp_scorm_score;
$any_result = true;
}
}
$score = 0;
if($total_weighting != 0)
{
$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),$score.'%',$progress,date('Y-m-d',$start_time));
?>
|
|
0 ? $score.'%' : '-' ?>
|
|
0) echo format_locale_date(get_lang('DateFormatLongWithoutDay'),$start_time); else echo '-'; ?>
|
|
".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 = 0;
if($weighting!=0)
{
$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);
if(Database::num_rows($resultLastAttempt)>0)
{
$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')."
|
";
}
}
else
{
echo "
".get_lang('NoExercise')."
|
";
}
?>
|