diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php index 32fe995525..4fe5a8f998 100644 --- a/main/exercice/exercise.lib.php +++ b/main/exercice/exercise.lib.php @@ -976,10 +976,12 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex tth.exe_cours_id ASC, tth.exe_date DESC"; } else { + //any view is proposed to the student, they should see the results in the overview.php page exit; + // Student view - + /* $sql = "SELECT DISTINCT te.exe_duration, te.start_date, @@ -1013,6 +1015,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex FROM $TBL_TRACK_HOTPOTATOES WHERE exe_user_id = '" . api_get_user_id() . "' AND exe_cours_id = '" . api_get_course_id() . "' $hotpotatoe_where ORDER BY exe_cours_id ASC, exe_date DESC"; + */ } $teacher_list = CourseManager::get_teacher_list_from_course_code(api_get_course_id()); diff --git a/main/inc/ajax/model.ajax.php b/main/inc/ajax/model.ajax.php index 1a5a9c349f..5884086bf9 100644 --- a/main/inc/ajax/model.ajax.php +++ b/main/inc/ajax/model.ajax.php @@ -10,7 +10,7 @@ require_once '../global.inc.php'; $libpath = api_get_path(LIBRARY_PATH); // 1. Setting variables needed by jqgrid - + $action = $_GET['a']; $page = intval($_REQUEST['page']); //page $limit = intval($_REQUEST['rows']); //quantity of rows @@ -105,7 +105,7 @@ switch ($action) { case 'get_exercise_results': require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php'; $exercise_id = $_REQUEST['exerciseId']; - $count = get_count_exam_results($exercise_id); + $count = get_count_exam_results($exercise_id); break; case 'get_sessions': $count = SessionManager::get_count_admin(); @@ -187,10 +187,18 @@ switch ($action) { if ($is_allowedToEdit || $is_tutor) { $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_duration', 'start_date', 'exe_date', 'score','status','actions'); } else { - $columns = array('exe_duration', 'start_date', 'exe_date', 'score', 'status', 'actions'); - } - $result = get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $where_condition); - + //$columns = array('exe_duration', 'start_date', 'exe_date', 'score', 'status', 'actions'); + } + + if (isset($_GET['filter_by_user']) && !empty($_GET['filter_by_user'])) { + $filter_user = intval($_GET['filter_by_user']); + if ($where_condition == "") { + $where_condition .= " te.exe_user_id = '$filter_user'" ; + } else { + $where_condition .= " AND te.exe_user_id = '$filter_user'"; + } + } + $result = get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $where_condition); break; case 'get_sessions': $columns = array('name', 'nbr_courses', 'nbr_users', 'category_name', 'date_start','date_end', 'coach_name', 'session_active', 'visibility'); @@ -370,6 +378,6 @@ if (in_array($action, $allowed_actions)) { $i++; } } - echo json_encode($response); + echo json_encode($response); } exit; \ No newline at end of file