diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index dcef50bac9..b8169bae1b 100644 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -2520,7 +2520,7 @@ class Exercise { } } elseif($answerType == FREE_ANSWER) { if($origin != 'learnpath') { - ExerciseShowFunctions::display_free_answer($choice,0,0); + ExerciseShowFunctions::display_free_answer($choice, $exeId, $questionId); } } elseif($answerType == ORAL_EXPRESSION) { // to store the details of open questions in an array to be used in mail diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index b177453bd2..c0e436314c 100644 --- a/main/exercice/exercise_show.php +++ b/main/exercice/exercise_show.php @@ -487,8 +487,8 @@ foreach ($questionList as $questionId) { } } - //if ($show_results) { - if (0) { + if ($show_results) { + //if (0) { echo '
| ';
- }
-
+ }
if ($is_allowedToEdit) {
if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
$marksname = "marksName".$questionId;
@@ -558,8 +557,8 @@ foreach ($questionList as $questionId) {
echo '';
echo ' '; if ($questionScore==-1 ) { - $questionScore=0; - echo ' '.get_lang('notCorrectedYet'); + $questionScore = 0; + echo Display::return_message(get_lang('notCorrectedYet')); } } else { $arrmarks[] = $questionId; diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.inc.php index b74549830b..17677e55b1 100644 --- a/main/inc/lib/events.lib.inc.php +++ b/main/inc/lib/events.lib.inc.php @@ -1327,11 +1327,11 @@ function get_all_exercises_from_lp($lp_id, $course_id) { * @param int $question_id * @return str the comment */ -function get_comments($id,$question_id) { +function get_comments($exe_id, $question_id) { $table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); - $sql = "SELECT teacher_comment FROM ".$table_track_attempt." where exe_id='".Database::escape_string($id)."' and question_id = '".Database::escape_string($question_id)."' ORDER by question_id"; + $sql = "SELECT teacher_comment FROM ".$table_track_attempt." where exe_id='".Database::escape_string($exe_id)."' and question_id = '".Database::escape_string($question_id)."' ORDER by question_id"; $sqlres = Database::query($sql); - $comm = Database::result($sqlres,0,"teacher_comment"); + $comm = Database::result($sqlres, 0, "teacher_comment"); return $comm; } diff --git a/main/inc/lib/exercise_show_functions.lib.php b/main/inc/lib/exercise_show_functions.lib.php index 309b5d6542..25fccf0c58 100644 --- a/main/inc/lib/exercise_show_functions.lib.php +++ b/main/inc/lib/exercise_show_functions.lib.php @@ -55,34 +55,23 @@ class ExerciseShowFunctions { * @param int Question ID * @return void */ - static function display_free_answer($answer,$id,$questionId) { - global $feedback_type; - if (empty($id)) { - if (!empty($answer)) { - echo ' | |
| '; + echo nl2br(Security::remove_XSS($answer, COURSEMANAGERLOWSECURITY)); + echo ' | |
| '; - echo nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)); - echo ' | '; - } - if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { - echo ''; - $comm = get_comments($id,$questionId); - echo ' | '; - } - echo '