From c158de40e4e6eab53347fbf405b77d71787ecd52 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 7 Jun 2012 19:21:44 +0200 Subject: [PATCH] Fixing feedback issue see #3846 --- main/inc/lib/exercise_show_functions.lib.php | 150 +++++++++++-------- 1 file changed, 84 insertions(+), 66 deletions(-) diff --git a/main/inc/lib/exercise_show_functions.lib.php b/main/inc/lib/exercise_show_functions.lib.php index 09dc86775c..2259156c40 100644 --- a/main/inc/lib/exercise_show_functions.lib.php +++ b/main/inc/lib/exercise_show_functions.lib.php @@ -61,14 +61,14 @@ class ExerciseShowFunctions { global $feedback_type; if (empty($id)) { if (!empty($answer)) { - echo ''; - echo Display::tag('td',nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)), array('width'=>'55%')); + echo ''; + echo Display::tag('td',nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)), array('width'=>'55%')); echo ''; } - if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { + if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { echo ''; - echo Display::tag('td',get_lang('notCorrectedYet'), array('width'=>'45%')); - echo ''; + echo Display::tag('td',get_lang('notCorrectedYet'), array('width'=>'45%')); + echo ''; } else { echo ' '; } @@ -79,7 +79,7 @@ class ExerciseShowFunctions { echo nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)); echo ''; } - if(!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { + if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { echo ''; $comm = get_comments($id,$questionId); echo ''; @@ -87,16 +87,16 @@ class ExerciseShowFunctions { echo ''; } } - + function display_oral_expression_answer($answer,$id,$questionId, $nano = null) { global $feedback_type; - + if (isset($nano)) { echo $nano->show_audio_file(); } - + if (empty($id)) { - + echo ''; echo Display::tag('td',nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)), array('width'=>'55%')); echo ''; @@ -114,8 +114,8 @@ class ExerciseShowFunctions { echo nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)); } echo ''; - - if(!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { + + if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { echo ''; $comm = get_comments($id,$questionId); echo ''; @@ -162,20 +162,19 @@ class ExerciseShowFunctions { - - - '.nl2br(make_clickable($answerComment)).''; - } else { - echo ''.nl2br(make_clickable($answerComment)).''; - } + '.nl2br(make_clickable($answerComment)).''; + } else { + //echo ''.nl2br(make_clickable($answerComment)).''; + } + ?> @@ -199,7 +198,7 @@ class ExerciseShowFunctions { * @param boolean Whether to show the answer comment or not * @return void */ - function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans) { + function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans) { global $feedback_type; ?> @@ -212,25 +211,30 @@ class ExerciseShowFunctions { border="0" alt=" " /> - - '.nl2br(make_clickable($answerComment)).''; + '.nl2br(make_clickable($answerComment)).''; } else { - echo ''.nl2br(make_clickable($answerComment)).''; + $color = 'black'; + //echo ''.nl2br(make_clickable($answerComment)).''; } + echo ''.nl2br(make_clickable($answerComment)).''; + } else { - if($answerCorrect) { - echo ''.nl2br(make_clickable($answerComment)).''; + if ($answerCorrect) { + //echo ''.nl2br(make_clickable($answerComment)).''; } else { - echo ''.nl2br(make_clickable($answerComment)).''; + //echo ''.nl2br(make_clickable($answerComment)).''; } } ?> @@ -244,9 +248,9 @@ class ExerciseShowFunctions {   - - + } + ?> - + } + ?> @@ -295,16 +299,26 @@ class ExerciseShowFunctions { - '.nl2br(make_clickable($answerComment)).''; + if ($studentChoice == $answerCorrect) { + $color = "green"; +// echo ''.nl2br(make_clickable($answerComment)).''; + } + + } + if ($studentChoice == 3 || $studentChoice == '') { - echo ''.nl2br(make_clickable($answerComment)).''; + //echo ''.nl2br(make_clickable($answerComment)).''; } else { if ($studentChoice == $answerCorrect) { - echo ''.nl2br(make_clickable($answerComment)).''; + //echo ''.nl2br(make_clickable($answerComment)).''; } else { - echo ''.nl2br(make_clickable($answerComment)).''; + //echo ''.nl2br(make_clickable($answerComment)).''; } } ?> @@ -320,7 +334,7 @@ class ExerciseShowFunctions { - options[$studentChoice])) { echo $question->options[$studentChoice]; } else { echo $question->options[2]; - } - ?> + } + ?> options[$answerCorrect]; } else { echo $question->options[2]; - } - ?> + } + ?> @@ -370,17 +384,22 @@ class ExerciseShowFunctions { '.nl2br(make_clickable($answerComment)).''; + } if ($studentChoice == 2 || $studentChoice == '') { - echo ''.nl2br(make_clickable($answerComment)).''; + //echo ''.nl2br(make_clickable($answerComment)).''; } else { if ($studentChoice == $answerCorrect) { - echo ''.nl2br(make_clickable($answerComment)).''; + //echo ''.nl2br(make_clickable($answerComment)).''; } else { - echo ''.nl2br(make_clickable($answerComment)).''; + //echo ''.nl2br(make_clickable($answerComment)).''; } } - ?>