From b7b1ff2cceeaecad9c9eea89ce02e69ad4ec62ec Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 12 Oct 2010 16:48:12 +0200 Subject: [PATCH] Adding session id. Fixes lp results in the lp stats page BT#1613 --- main/newscorm/lp_stats.php | 40 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/main/newscorm/lp_stats.php b/main/newscorm/lp_stats.php index 33523e0453..091dd9d363 100755 --- a/main/newscorm/lp_stats.php +++ b/main/newscorm/lp_stats.php @@ -618,18 +618,21 @@ if (is_array($list) && count($list) > 0) { if ($num_attempts > 0) { $n = 1; while ($row_attempts = Database :: fetch_array($res_attempts)) { - $my_score = $row_attempts['exe_result']; - $my_maxscore = $row_attempts['exe_weighting']; - $my_exe_id = $row_attempts['exe_id']; - $my_orig_lp = $row_attempts['orig_lp_id']; - $my_orig_lp_item = $row_attempts['orig_lp_item_id']; - $my_exo_exe_id=$row_attempts['exe_exo_id']; - $mktime_start_date = convert_mysql_date($row_attempts['start_date']); - $mktime_exe_date = convert_mysql_date($row_attempts['exe_date']); - $mytime = ((int)$mktime_exe_date-(int)$mktime_start_date); - $time_attemp = learnpathItem :: get_scorm_time('js', $mytime); - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); - + $my_score = $row_attempts['exe_result']; + $my_maxscore = $row_attempts['exe_weighting']; + $my_exe_id = $row_attempts['exe_id']; + $my_orig_lp = $row_attempts['orig_lp_id']; + $my_orig_lp_item = $row_attempts['orig_lp_item_id']; + $my_exo_exe_id = $row_attempts['exe_exo_id']; + $mktime_start_date = api_strtotime($row_attempts['start_date'],'UTC'); + $mktime_exe_date = api_strtotime($row_attempts['exe_date'],'UTC'); + if ($mktime_start_date && $mktime_exe_date) { + $mytime = ((int)$mktime_exe_date-(int)$mktime_start_date); + $time_attemp = learnpathItem :: get_scorm_time('js', $mytime); + $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); + } else { + $time_attemp = ' - '; + } if (!$is_allowed_to_edit && $result_disabled_ext_all) { $view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); } else { @@ -658,16 +661,15 @@ if (is_array($list) && count($list) > 0) { . '
' . $my_lesson_status . '
' . $view_score . '
' . $time_attemp . '
'; if ($origin != 'tracking') { if (!$is_allowed_to_edit && $result_disabled_ext_all) { - $output .= ''.get_lang('ShowAttempt').''; + $output .= ''.get_lang('ShowAttempt').''; } else { - $output .= ''.get_lang('ShowAttempt').''; + $output .= ''.get_lang('ShowAttempt').''; } } else { if (!$is_allowed_to_edit && $result_disabled_ext_all ) { - $output .= ''.get_lang('ShowAndQualifyAttempt').''; + $output .= ''.get_lang('ShowAndQualifyAttempt').''; } else { - - $output .= ''.get_lang('ShowAndQualifyAttempt').''; + $output .= ''.get_lang('ShowAndQualifyAttempt').''; } } $output .= ''; @@ -698,13 +700,13 @@ if (!empty($a_my_id)) { $my_studen_id = intval(api_get_user_id()); $my_course_id = Database::escape_string(api_get_course_id()); } - $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, $a_my_id); + $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, $a_my_id, api_get_session_id()); } else { if ($origin == 'tracking') { $my_studen_id = $student_id; $my_course_id = Database::escape_string($_GET['course']); if (!empty($my_studen_id) && !empty($my_course_id)) { - $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, array(intval($_GET['lp_id']))); + $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, array(intval($_GET['lp_id'])), api_get_session_id()); } else { $total_score = 0; }