From be8429fd2010e3a01a72b5e3a1056ba89911b8b8 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 9 Feb 2011 22:00:32 +0100 Subject: [PATCH] Adding more columns --- main/tracking/lp_results_by_user.php | 44 ++++++++++++++++++---------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/main/tracking/lp_results_by_user.php b/main/tracking/lp_results_by_user.php index 0aea053b8c..5ab5a95b5b 100644 --- a/main/tracking/lp_results_by_user.php +++ b/main/tracking/lp_results_by_user.php @@ -137,7 +137,8 @@ foreach($course_list as $current_course ) { $exercise_stats = get_all_exercise_event_from_lp($exercise['path'], $course_info['id'], $session_id); //Looping Exercise Attempts foreach($exercise_stats as $stats) { - $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = array('exe_result' =>$stats['exe_result'],'exe_weighting' =>$stats['exe_weighting']); + //$attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = array('exe_result' =>$stats['exe_result'],'exe_weighting' =>$stats['exe_weighting']); + $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats; $user_list[$stats['exe_user_id']] = $stats['exe_user_id']; } $exercise_list_name[$exercise['id']] = $exercise['title']; @@ -158,11 +159,13 @@ $export_array = array(); if (!empty($main_result)) { $html_result .= ''; - $html_result .= ''; - $html_result .= ''; - $html_result .= ''; - $html_result .= ''; - $html_result .= ''; + $html_result .= ''; + $html_result .= ''; + $html_result .= ''; + $html_result .= ''; + $html_result .= ''; + $html_result .= ''; + $html_result .= ''; $html_result .= ''; foreach ($main_result as $course_code => $lps) { @@ -175,17 +178,22 @@ if (!empty($main_result)) { foreach($exercises as $exercise_id => $exercise_data) { $users = $exercise_data['users']; - foreach($users as $user_id => $attempts) { - foreach($attempts as $exe_id => $result) { + foreach($users as $user_id => $attempts) { + $attempt = 1; + foreach($attempts as $exe_id => $attempt_data) { $html_result .= ''; $html_result .= Display::tag('td', $course_code); $html_result .= Display::tag('td', $lp_list_name[$lp_id]); $html_result .= Display::tag('td', $exercise_list_name[$exercise_id]); $html_result .= Display::tag('td', $user_list_name[$user_id]); - $result = $result['exe_result'].' / '.$result['exe_weighting']; - $html_result .= Display::tag('td', $result); + $result = $attempt_data['exe_result'].' / '.$attempt_data['exe_weighting']; + $html_result .= Display::tag('td', $attempt); + $html_result .= Display::tag('td', api_get_local_time($attempt_data['exe_date'])); + $html_result .= Display::tag('td', $result); + $html_result .= ''; - $export_array[]= array($course_code,$lp_list_name[$lp_id], $exercise_list_name[$exercise_id], $user_list_name[$user_id], $result); + $export_array[]= array($course_code, $lp_list_name[$lp_id], $exercise_list_name[$exercise_id], $user_list_name[$user_id], $attempt, api_get_local_time($attempt_data['exe_date']), $result); + $attempt++; } } } @@ -217,16 +225,20 @@ function export_complete_report_xls($filename, $array) { $column = 0; //skip the first column (row titles) - $worksheet->write($line,$column,get_lang('Courses')); + $worksheet->write($line,$column,get_lang('Course')); $column++; - $worksheet->write($line,$column,get_lang('Lps')); + $worksheet->write($line,$column,get_lang('LearningPath')); $column++; - $worksheet->write($line,$column,get_lang('Exercises')); + $worksheet->write($line,$column,get_lang('Exercise')); $column++; - $worksheet->write($line,$column,get_lang('Users')); + $worksheet->write($line,$column,get_lang('User')); $column++; - $worksheet->write($line,$column,get_lang('Attempts')); + $worksheet->write($line,$column,get_lang('Attempt')); + $column++; + $worksheet->write($line,$column,get_lang('Date')); $column++; + $worksheet->write($line,$column,get_lang('Results')); + $column++; $line++; foreach ($array as $row) { $column = 0;
'.get_lang('Courses').''.get_lang('LPs').''.get_lang('Exercises').''.get_lang('Users').''.get_lang('Attempts').'
'.get_lang('Course').''.get_lang('LearningPath').''.get_lang('Exercise').''.get_lang('User').''.get_lang('Attempt').''.get_lang('Date').''.get_lang('Results').'