@ -541,7 +541,7 @@ class Tracking 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                exe_user_id="' . $user_id . '" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                orig_lp_id = "' . $lp_id . '" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                orig_lp_item_id = "' . $row['myid'] . '" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                exe_cours_id="' . $courseCode . '"  AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                c_id = ' . $course_id . '  AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                status < > "incomplete" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                session_id = ' . $session_id . '  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                             ORDER BY exe_date DESC  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -651,7 +651,7 @@ class Tracking 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                        exe_user_id="' . $user_id . '" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                        orig_lp_id = "' . $lp_id . '" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                        orig_lp_item_id = "' . $row['myid'] . '" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                        exe_cours_id="' . $courseCode. '"  AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                        c_id = ' . $course_id . '  AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                        status < > "incomplete" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                        session_id = ' . $session_id . '  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                     ORDER BY exe_date DESC ';  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -829,7 +829,7 @@ class Tracking 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            exe_user_id="' . $user_id . '" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            orig_lp_id = "' . (int) $lp_id . '" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            orig_lp_item_id = "' . (int) $lp_item_id . '" AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            exe_cours_id="' . $courseCode . '"   AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            c_id = ' . $course_id . '   AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            session_id = ' . $session_id . '  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                        ORDER BY exe_date';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                $res_attempts = Database::query($sql);  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1676,7 +1676,7 @@ class Tracking 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            exe_exo_id IN ('".$exercise_id."')  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            $condition_user AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            status = '' AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            exe_cours_id = '$course_code'   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            c_id = {$course_info['real_id']}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            $condition_session  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            $condition_into_lp  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        ORDER BY exe_date DESC";  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1724,9 +1724,9 @@ class Tracking 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    /**  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * Get count student's exercise COMPLETED attempts  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param $student_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param $course_code   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param $exercise_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param int  $student_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param int $courseId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param int  $exercise_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param int $lp_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param int $lp_item_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param int $session_id  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1742,24 +1742,24 @@ class Tracking 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     */  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public static function count_student_exercise_attempts(  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $student_id,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $course_code ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $courseId ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $exercise_id,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $lp_id = 0,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $lp_item_id = 0,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $session_id = 0,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $find_all_lp = 0  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	$course_code = Database::escape_string($course_code );  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $courseId = intval($courseId );  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	$student_id  = intval($student_id);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	$exercise_id = intval($exercise_id);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	$session_id  = intval($session_id);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	$lp_id = intval($lp_id);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $lp_item_id = intval($lp_item_id);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	$tbl_stats_exercic es = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	$tbl_stats_exercis es = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	$sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercic es AS ex  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE  ex.exe_cours_id = '$course_code'   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	$sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercis es AS ex  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE  ex.c_id = $courseId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                AND ex.exe_exo_id = $exercise_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                AND status = ''  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                AND exe_user_id= $student_id  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1785,28 +1785,28 @@ class Tracking 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param array  $exercise_list  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param int    $user_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param string $course_code   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param int    $courseId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param int    $session_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    */  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public static function get_exercise_student_progress($exercise_list, $user_id, $course_code , $session_id)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public static function get_exercise_student_progress($exercise_list, $user_id, $courseId , $session_id)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $course_code = Database::escape_string($course_code );  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $courseId = intval($courseId );  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $user_id = intval($user_id);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $session_id = intval($session_id);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if (empty($exercise_list)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return '0%';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $tbl_stats_exercic es = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $tbl_stats_exercis es = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $exercise_list = array_keys($exercise_list);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $exercise_list = array_map('intval', $exercise_list);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $exercise_list_imploded = implode("' ,'", $exercise_list);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $sql = "SELECT COUNT(DISTINCT ex.exe_exo_id)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                FROM $tbl_stats_exercic es AS ex  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                FROM $tbl_stats_exercis es AS ex  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    ex.exe_cours_id = '$course_code'  AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    ex.c_id = $courseId  AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    ex.session_id  = $session_id AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    ex.exe_user_id = $user_id AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    ex.exe_exo_id IN ('$exercise_list_imploded') ";  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2315,6 +2315,7 @@ class Tracking 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                $item_id = $row_max_score['iid'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                $item_path = $row_max_score['path'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                $lp_item_view_id = $row_max_score['lp_item_view_id'];  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                $courseId = api_get_course_int_id($course_code);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                // Get last attempt to this exercise through  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                // the current lp for the current user  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2325,7 +2326,7 @@ class Tracking 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            exe_user_id          = $user_id AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            orig_lp_item_id      = $item_id AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            orig_lp_item_view_id = $lp_item_view_id AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            exe_cours_id         = '$course_code'  AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            c_id                 = $course_id  AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            session_id           = $session_id AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                            status = ''  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                        ORDER BY exe_date DESC  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -5302,7 +5303,7 @@ class Tracking 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    qq.position = rq.question_order AND  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    ta.question_id = rq.question_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    te.exe_cours_id = '$whereCourseCode'  ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")."  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    te.c_id = $courseIdx  ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")."  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    AND q.c_id = $courseIdx  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    $where $order $limit";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            $sql_query = vsprintf($sql, $whereParams);  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -6044,7 +6045,7 @@ class TrackingCourseLog 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            $total_user_exercise = Tracking::get_exercise_student_progress(  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                $total_exercises,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                $user['user_id'],  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                $course_code ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                $courseId ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                $session_id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            );  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -6232,11 +6233,16 @@ class TrackingUserLog 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    /**  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * Displays the exercise results for a specific user in a specific course.  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param   string $view  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param   int $user_id    User ID  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param   string  $courseCode Course code  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @return array  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @todo remove globals  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     */  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public function display_exercise_tracking_info($view, $user_id, $course_id)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public function display_exercise_tracking_info($view, $user_id, $courseCode )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $courseId = api_get_course_int_id($courseCode);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	if(substr($view,1,1) == '1') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$new_view = substr_replace($view,'0',1,1);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		echo "< tr >   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -6248,15 +6254,15 @@ class TrackingUserLog 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE te.exe_cours_id = '".Database::escape_string($course_id)."'   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    AND te.exe_user_id = '" .intval($user_id)."'   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE te.c_id = $courseId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    AND te.exe_user_id = " .intval($user_id)."   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    AND te.exe_exo_id = ce.id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                ORDER BY ce.title ASC, te.exe_date ASC";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                FROM $TBL_TRACK_HOTPOTATOES AS te  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE te.exe_user_id = '".intval($user_id)."' AND te.exe_cours_id = '".Database::escape_string($course_id)."'   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                ORDER BY te.exe_ cours _id ASC, te.exe_date ASC";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE te.exe_user_id = '".intval($user_id)."' AND te.c_id = $courseId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                ORDER BY te.c_id ASC, te.exe_date ASC";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$hpresults = StatsUtils::getManyResultsXCol($hpsql, 4);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -6605,26 +6611,32 @@ class TrackingUserLogCSV 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    /**  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * Displays the exercise results for a specific user in a specific course.  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param   string $view  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param   int $user_id    User ID  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @param   string  $courseCode Course code  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @return array  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * @todo remove globals  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     */  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public function display_exercise_tracking_info($view, $user_id, $course_id)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public function display_exercise_tracking_info($view, $userId, $courseCode )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $courseId = api_get_course_int_id($courseCode);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        $userId = intval($userId);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    	if (substr($view,1,1) == '1') {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$new_view = substr_replace($view,'0',1,1);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$title[1]= get_lang('ExercicesDetails');  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$line='';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$title[1]  = get_lang('ExercicesDetails');  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$line  =  '';  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE te.exe_cours_id = '$course_id'   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    AND te.exe_user_id = '$user_id'   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE te.c_id = $courseId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    AND te.exe_user_id = $userId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    AND te.exe_exo_id = ce.id  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                ORDER BY ce.title ASC, te.exe_date ASC";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                FROM $TABLETRACK_HOTPOTATOES AS te  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE te.exe_user_id = '$user_id' AND te.exe_cours_id = '$course_id'   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                ORDER BY te.exe_ cours _id ASC, te.exe_date ASC";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                ORDER BY te.c_id ASC, te.exe_date ASC";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$hpresults = StatsUtils::getManyResultsXCol($hpsql, 4);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -6632,7 +6644,7 @@ class TrackingUserLogCSV 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$NoHPTestRes = 0;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$results = StatsUtils::getManyResultsXCol($sql, 4);  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$title_line=get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		$title_line  =  get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n";  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    		if (is_array($results)) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    			for($i = 0; $i <  sizeof ( $ results ) ;  $ i + + )