diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php
index 699d2f6589..3aa58d19e0 100755
--- a/main/exercice/exercise_show.php
+++ b/main/exercice/exercise_show.php
@@ -1,13 +1,15 @@
-0) {
- echo str_repeat(' ',0).'Entered exercise_result.php'."
\n";var_dump($_POST);
-}
-// general parameters passed via POST/GET
-
-if ( empty ( $formSent ) ) {
- $formSent= $_REQUEST['formSent'];
-}
-if ( empty ( $exerciseResult ) ) {
- $exerciseResult = $_SESSION['exerciseResult'];
-}
-if ( empty ( $questionId ) ) {
- $questionId = $_REQUEST['questionId'];
-}
-if ( empty ( $choice ) ) {
- $choice = $_REQUEST['choice'];
-}
-if ( empty ( $questionNum ) ) {
- $questionNum = $_REQUEST['questionNum'];
-}
-if ( empty ( $nbrQuestions ) ) {
- $nbrQuestions = $_REQUEST['nbrQuestions'];
-}
-if ( empty ( $questionList ) ) {
- $questionList = $_SESSION['questionList'];
-}
-if ( empty ( $objExercise ) ) {
- $objExercise = $_SESSION['objExercise'];
-}
-
-if ( empty ( $exeId ) ) {
- $exeId = $_REQUEST['id'];
-}
+// General parameters passed via POST/GET
+if($debug>0) { error_log('Entered exercise_result.php: '.print_r($_POST,1)); }
-if ( empty ( $action ) ) {
- $action = $_GET['action'];
-}
+if ( empty ( $formSent ) ) { $formSent = $_REQUEST['formSent']; }
+if ( empty ( $exerciseResult ) ) { $exerciseResult = $_SESSION['exerciseResult'];}
+if ( empty ( $questionId ) ) { $questionId = $_REQUEST['questionId'];}
+if ( empty ( $choice ) ) { $choice = $_REQUEST['choice'];}
+if ( empty ( $questionNum ) ) { $questionNum = $_REQUEST['questionNum'];}
+if ( empty ( $nbrQuestions ) ) { $nbrQuestions = $_REQUEST['nbrQuestions'];}
+if ( empty ( $questionList ) ) { $questionList = $_SESSION['questionList'];}
+if ( empty ( $objExercise ) ) { $objExercise = $_SESSION['objExercise'];}
+if ( empty ( $exeId ) ) { $exeId = $_REQUEST['id'];}
+if ( empty ( $action ) ) { $action = $_GET['action']; }
-$current_time = time();
-$emailId = $_REQUEST['email'];
-$id = $_REQUEST['id']; //exe id
+//$emailId = $_REQUEST['email'];
+$id = intval($_REQUEST['id']); //exe id
+$current_time = time();
if (empty($id)) {
api_not_allowed();
}
-$is_allowedToEdit=api_is_allowed_to_edit(null,true) || $is_courseTutor;
+$is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor;
-//Getting results
+//Getting results from the exe_id. This variable also contain all the information about the exercise
$track_exercise_info = get_exercise_track_exercise_info($id);
//No track info
@@ -102,23 +80,25 @@ if (empty($track_exercise_info)) {
api_not_allowed();
}
-
$exercise_id = $track_exercise_info['id'];
+$exercise_date = $track_exercise_info['exe_date'];
$student_id = $track_exercise_info['exe_user_id'];
$learnpath_id = $track_exercise_info['orig_lp_id'];
$learnpath_item_id = $track_exercise_info['orig_lp_item_id'];
$lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
$course_code = api_get_course_id();
+$current_user_id = api_get_user_id();
//Check if user can see the results
if (!$is_allowedToEdit) {
- $current_user_id = api_get_user_id();
+ if ($track_exercise_info['results_disabled']) {
+ api_not_allowed();
+ }
if ($student_id != $current_user_id) {
api_not_allowed();
}
}
-
if (!exercise_time_control_is_valid($exercise_id)) {
$sql_fraud = "UPDATE $TBL_TRACK_ATTEMPT SET answer = 0, marks=0, position=0 WHERE exe_id = $id ";
Database::query($sql_fraud);
@@ -127,8 +107,6 @@ if (!exercise_time_control_is_valid($exercise_id)) {
//Unset session for clock time
exercise_time_control_delete($exercise_id);
-
-
$nameTools=get_lang('CorrectTest');
if (isset($_SESSION['gradebook'])) {
$gradebook= Security::remove_XSS($_SESSION['gradebook']);
@@ -137,6 +115,7 @@ if (isset($_SESSION['gradebook'])) {
if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook'));
}
+
$fromlink = '';
if($origin=='user_course') {
$interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".Security::remove_XSS($_GET['course']), "name" => get_lang("Users"));
@@ -156,7 +135,6 @@ if($origin=='user_course') {
} else {
$this_section = SECTION_COURSES;
}
-
} elseif($origin=='student_progress') {
$this_section = SECTION_TRACKING;
$interbreadcrumb[] = array ("url" => "../auth/my_progress.php?id_session".Security::remove_XSS($_GET['id_session'])."&course=".$_cid, "name" => get_lang('MyProgress'));
@@ -166,9 +144,8 @@ if($origin=='user_course') {
$this_section=SECTION_COURSES;
}
-
if ($origin != 'learnpath') {
- Display::display_header($nameTools,"Exercise");
+ Display::display_header($nameTools,get_lang('Exercise'));
} else {
Display::display_reduced_header();
}
@@ -221,17 +198,14 @@ function getFCK(vals,marksid) {
-
: |
- + | : | ++ + | +
| : | ++ + | ||