diff --git a/main/auth/my_progress.php b/main/auth/my_progress.php index bc63e91587..4b0d36d897 100644 --- a/main/auth/my_progress.php +++ b/main/auth/my_progress.php @@ -152,90 +152,16 @@ $totalProgress = 0; foreach($Courses as $enreg) { - $sqlTime = "SELECT total_time - FROM ".$enreg['db_name'].'.'.$tbl_course_lp_view_item." AS lpi - INNER JOIN ".$enreg['db_name'].'.'.$tbl_course_lp_view." AS lpv - ON lpv.lp_id = lpi.lp_view_id - AND lpv.user_id = ".$_user['user_id'] - ; - $result = api_sql_query($sqlTime); - while($totalTime = mysql_fetch_array($result)) - { - //print_r($totalTime); - } - - $sqlScore = "SELECT exe_result,exe_weighting - FROM $tbl_stats_exercices - WHERE exe_user_id = ".$_user['user_id']." - AND exe_cours_id = '".$enreg['code']."' - "; - - $resultScore = api_sql_query($sqlScore); - $i = 0; - $score = 0; - while($a_score = mysql_fetch_array($resultScore)) - { - $score = $score + $a_score['exe_result']; - $weighting = $weighting + $a_score['exe_weighting']; - $i++; - } - - $totalScore = $totalScore + $score; - $totalWeighting = $totalWeighting + $weighting; - - $pourcentageScore = round(($score*100)/$weighting); - $weighting = 0; - - $sqlLastAccess = " SELECT access_date - FROM $tbl_stats_lastaccess - WHERE access_user_id = ".$_user['user_id']." - AND access_cours_code = '".$enreg['code']."' - ORDER BY access_date DESC LIMIT 0,1" - ; - $result = api_sql_query($sqlLastAccess); - $lastAccess = mysql_fetch_array($result); - - if(!empty($lastAccess['access_date'])) - { - $a_lastConnexion = explode(' ',$lastAccess['access_date']); - $a_date = explode('-',$a_lastConnexion[0]); - $a_heure = explode(':',$a_lastConnexion[1]); - $lastConnexion = $a_date[2]."/".$a_date[1]."/".$a_date[0]; - $lastAccessTms = mktime ( $a_heure[0], $a_heure[1] ,$a_heure[2] ,$a_date[1], $a_date[2],$a_date[0]); - } - else - { - $lastConnexion = get_lang('NoConnexion'); - } + + $lastConnexion = Tracking :: get_last_connection_date_on_the_course($_user['user_id'],$enreg['code']); $progress = Tracking :: get_avg_student_progress($_user['user_id'], $enreg['code']); + + $time = api_time_to_hms(Tracking :: get_time_spent_on_the_course($_user['user_id'], $enreg['code'])); - /*$time = $lastAccessTms - $firstAccessTms; + $pourcentageScore = Tracking :: get_avg_student_score($_user['user_id'], $enreg['code']); - if($time >= 60) - { - $minute = round($time/60); - if($minute >= 60) - { - $heure = round($minute/60); - $minute = $minute - round((60*(($time/60)/60))); - if($minute == 0) - { - $minute = '00'; - } - } - else - { - $heure = 0; - } - $temps = $heure.'h'.$minute; - } - else - { - $temps = '0h00'; - } - $totalTime .= $time; */ ?>
';
+ echo '
';
echo "