From 3f91f58429f060ac3bd92bc9c3f87c3e708351d2 Mon Sep 17 00:00:00 2001 From: Cristian Fasanando Date: Thu, 7 Jan 2010 12:03:49 -0500 Subject: [PATCH] hidden comments when no feedback is enable in test - partial CT#462 --- main/exercice/exercise_result.php | 28 +++++++++++- main/exercice/exercise_show.php | 59 ++++++++++++++++++------- main/exercice/hotspot_admin.inc.php | 40 ++++++++++++----- main/exercice/matching.class.php | 4 +- main/exercice/multiple_answer.class.php | 27 +++++++---- main/exercice/unique_answer.class.php | 11 ++--- 6 files changed, 128 insertions(+), 41 deletions(-) diff --git a/main/exercice/exercise_result.php b/main/exercice/exercise_result.php index 1c9e5d3355..09385aefa0 100755 --- a/main/exercice/exercise_result.php +++ b/main/exercice/exercise_result.php @@ -332,6 +332,7 @@ FUNCTIONS function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect) { + global $feedback_type; ?> @@ -348,6 +349,7 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, echo $answer; ?> + + +   + + + +   + + '; ?> + +   + + + +   + + + +   +

+

+ +   + @@ -267,6 +268,8 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, echo $answer; ?> + + + +   + - + + + + + - - + + + - + + + + + + +   + + + + +   +   @@ -606,7 +631,11 @@ if ($show_results) { + + +   +   @@ -1008,7 +1037,7 @@ if ($show_results) { } echo ''; echo '
'; - if ($questionScore==-1) { + if ($questionScore==-1 ) { $questionScore=0; echo '
'.get_lang('notCorrectedYet'); } diff --git a/main/exercice/hotspot_admin.inc.php b/main/exercice/hotspot_admin.inc.php index 50cec7e944..c01f3fe30d 100755 --- a/main/exercice/hotspot_admin.inc.php +++ b/main/exercice/hotspot_admin.inc.php @@ -172,7 +172,9 @@ if($modifyAnswers) for($i=1;$i <= $nbrAnswers;$i++) { $reponse[$i]=$objAnswer->selectAnswer($i); - $comment[$i]=$objAnswer->selectComment($i); + if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { + $comment[$i]=$objAnswer->selectComment($i); + } $weighting[$i]=$objAnswer->selectWeighting($i); $hotspot_coordinates[$i]=$objAnswer->selectHotspotCoordinates($i); $hotspot_type[$i]=$objAnswer->selectHotspotType($i); @@ -183,7 +185,9 @@ if($modifyAnswers) $_SESSION['tmp_answers'] = array(); $_SESSION['tmp_answers']['answer'] = $reponse; - $_SESSION['tmp_answers']['comment'] = $comment; + if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { + $_SESSION['tmp_answers']['comment'] = $comment; + } $_SESSION['tmp_answers']['weighting'] = $weighting; $_SESSION['tmp_answers']['hotspot_coordinates'] = $hotspot_coordinates; $_SESSION['tmp_answers']['hotspot_type'] = $hotspot_type; @@ -195,7 +199,9 @@ if($modifyAnswers) $nbrAnswers--; // Remove the last answer $tmp = array_pop($_SESSION['tmp_answers']['answer']); - $tmp = array_pop($_SESSION['tmp_answers']['comment']); + if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { + $tmp = array_pop($_SESSION['tmp_answers']['comment']); + } $tmp = array_pop($_SESSION['tmp_answers']['weighting']); $tmp = array_pop($_SESSION['tmp_answers']['hotspot_coordinates']); $tmp = array_pop($_SESSION['tmp_answers']['hotspot_type']); @@ -212,7 +218,9 @@ if($modifyAnswers) // Add a new answer $_SESSION['tmp_answers']['answer'][]=''; - $_SESSION['tmp_answers']['comment'][]=''; + if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { + $_SESSION['tmp_answers']['comment'][]=''; + } $_SESSION['tmp_answers']['weighting'][]='1'; $_SESSION['tmp_answers']['hotspot_coordinates'][]='0;0|0|0'; $_SESSION['tmp_answers']['hotspot_type'][]='square'; @@ -293,9 +301,16 @@ if($modifyAnswers) --> -   - * - +   + + + selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> + * + + + * + + * @@ -303,8 +318,9 @@ if($modifyAnswers) for($i=1;$i <= $nbrAnswers;$i++) { ?> -
- +
+ selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> + CreateHtml(); /**/ ?> - + + + + + diff --git a/main/exercice/matching.class.php b/main/exercice/matching.class.php index 9b7053e6a9..2797ea7bda 100755 --- a/main/exercice/matching.class.php +++ b/main/exercice/matching.class.php @@ -142,7 +142,7 @@ class Matching extends Question { if ($nb_matches < 1) { $nb_matches = 1; - Display::display_normal_message(get_lang('YouHaveToCreateAlLeastOneAnswer')); + Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); } for($i = 1 ; $i <= $nb_matches ; ++$i) { @@ -195,7 +195,7 @@ class Matching extends Question { if ($nb_options < 1) { $nb_options = 1; - Display::display_normal_message(get_lang('YouHaveToCreateAlLeastOneAnswer')); + Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); } for($i = 1 ; $i <= $nb_options ; ++$i) { diff --git a/main/exercice/multiple_answer.class.php b/main/exercice/multiple_answer.class.php index d726b9ecd9..1a7ca2541d 100755 --- a/main/exercice/multiple_answer.class.php +++ b/main/exercice/multiple_answer.class.php @@ -66,6 +66,8 @@ class MultipleAnswer extends Question { $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 2; $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); + $obj_ex = $_SESSION['objExercise']; + $html='
@@ -82,11 +84,15 @@ class MultipleAnswer extends Question { '.get_lang('Answer').' - - + '; + // show column comment when feedback is enable + if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM ) { + $html .=' '.get_lang('Comment').' - - + '; + } + + $html .= ' '.get_lang('Weighting').' '; @@ -107,7 +113,7 @@ class MultipleAnswer extends Question { if ($nb_answers < 1) { $nb_answers = 1; - Display::display_normal_message(get_lang('YouHaveToCreateAlLeastOneAnswer')); + Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); } for($i = 1 ; $i <= $nb_answers ; ++$i) { @@ -135,10 +141,15 @@ class MultipleAnswer extends Question { $form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox" style="margin-left: 0em;"'); $boxes_names[] = 'correct['.$i.']'; - - $form->addElement('html_editor', 'answer['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); + + $form->addElement('html_editor', 'answer['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); - $form->addElement('html_editor', 'comment['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); + + // show comment when feedback is enable + if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { + $form->addElement('html_editor', 'comment['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); + } + $form->addElement('text', 'weighting['.$i.']',null, 'style="vertical-align:middle;margin-left: 0em;" size="5" value="10"'); $form -> addElement ('html', ''); } diff --git a/main/exercice/unique_answer.class.php b/main/exercice/unique_answer.class.php index ecd3d16e94..1e0487fbab 100755 --- a/main/exercice/unique_answer.class.php +++ b/main/exercice/unique_answer.class.php @@ -159,7 +159,7 @@ class UniqueAnswer extends Question { if ($nb_answers < 1) { $nb_answers = 1; - Display::display_normal_message(get_lang('YouHaveToCreateAlLeastOneAnswer')); + Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer')); } for($i = 1 ; $i <= $nb_answers ; ++$i) @@ -230,11 +230,12 @@ class UniqueAnswer extends Question { $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"'); $form->addElement('html_editor', 'answer['.$i.']', null, 'style="vertical-align:middle"', $editor_config); $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); - - if ($obj_ex->selectFeedbackType()==0) // feedback + + if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_END) { + // feedback $form->addElement('html_editor', 'comment['.$i.']', null, 'style="vertical-align:middle"', $editor_config); - elseif ($obj_ex->selectFeedbackType()==1) // direct feedback - { + } elseif ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { + // direct feedback $form->addElement('html_editor', 'comment['.$i.']', null, 'style="vertical-align:middle"', $editor_config); //Adding extra feedback fields $group = array();