diff --git a/main/tracking/question_course_report.php b/main/tracking/question_course_report.php index 8e4bc5ddb5..8e4597b5db 100755 --- a/main/tracking/question_course_report.php +++ b/main/tracking/question_course_report.php @@ -1,18 +1,17 @@ $course_item['db_name'],'code'=>$course_item['code'], 'title'=>$course_item['title'], 'visual_code'=>$course_item['visual_code']); + $course_list[] = array( + 'db_name' => $course_item['db_name'], + 'code' => $course_item['code'], + 'title' => $course_item['title'], + 'visual_code' => $course_item['visual_code'] + ); $course_select_list[$temp_course_item['code']] = $course_item['title']; } @@ -94,41 +98,35 @@ if (!empty($course_info)) { $main_question_list = array(); foreach ($lp_list as $lp_id =>$lp) { $exercise_list = get_all_exercises_from_lp($lp_id, $course_info['real_id']); - //var_dump($exercise_list); foreach ($exercise_list as $exercise) { $my_exercise = new Exercise(); - //$my_exercise->read($exercise['ref']); $my_exercise->read($exercise['path']); $question_list = $my_exercise->selectQuestionList(); - $exercise_stats = get_all_exercise_event_from_lp($exercise['path'],$course_info['id'], $session_id); - //echo '
'; print_r($exercise_stats);
+			$exercise_stats = get_all_exercise_event_from_lp(
+				$exercise['path'],
+				$course_info['id'],
+				$session_id
+			);
 
-			foreach($question_list  as $question_id) {
+			foreach ($question_list  as $question_id) {
 				$question_data = Question::read($question_id);
-				///var_dump($question_data);
 				$main_question_list[$question_id] = $question_data;
 				$quantity_exercises = 0;
 				$question_result = 0;
-				//echo '
';
-				//print_r($exercise_stats);
 				foreach($exercise_stats as $stats) {
 					if (!empty($stats['question_list'])) {
 						foreach($stats['question_list'] as $my_question_stat) {
-							// var_dump($my_question_stat);
 							if ($question_id == $my_question_stat['question_id']) {
-								//var_dump($my_question_stat);
 								$question_result =  $question_result + $my_question_stat['marks'];
-								//			var_dump($my_question_stat['marks']);
 								$quantity_exercises++;
 							}
 						}
 					}
 				}
-				//echo $question_id;
-				//var_dump($question_result.' - '.$quantity_exercises.$main_question_list[$question_id]->weighting);
-				if(!empty($quantity_exercises)) {
-					$main_question_list[$question_id]->results =(($question_result / ($quantity_exercises)) ) ; // Score % average
+				if (!empty($quantity_exercises)) {
+					// Score % average
+					$main_question_list[$question_id]->results =(($question_result / ($quantity_exercises)) ) ;
 				} else {
 					$main_question_list[$question_id]->results = 0;
 				}
@@ -139,11 +137,6 @@ if (!empty($course_info)) {
 	}
 }
 
-//var_dump($main_question_list);
-
-//var_dump($main_question_list);
-//$course_list = SessionManager::get_course_list_by_session_id($session_id);
-
 if (!$export_to_xls) {
 
 	Display :: display_header(get_lang("MySpace"));
@@ -173,7 +166,6 @@ if (!$export_to_xls) {
 }
 
 $course_average = array();
-
 $counter = 0;
 
 if (!empty($main_question_list) && is_array($main_question_list)) {
@@ -228,7 +220,8 @@ if ($export_to_xls) {
 	exit;
 }
 
-function sort_user($a, $b) {
+function sort_user($a, $b)
+{
 	if (is_numeric($a['score']) && is_numeric($b['score'])) {
 		echo $a['score'].' : '.$b['score'];
 		echo '
'; @@ -240,7 +233,8 @@ function sort_user($a, $b) { return 1; } -function export_complete_report_xls($filename, $array) { +function export_complete_report_xls($filename, $array) +{ global $charset; $workbook = new Spreadsheet_Excel_Writer(); $workbook ->setTempDir(api_get_path(SYS_ARCHIVE_PATH));