Should show comments when the teacher is correcting an exercise see #5812

skala
Julio Montoya 12 years ago
parent 7310ee0f23
commit 5011fa9971
  1. 41
      main/exercice/exercise.class.php
  2. 1
      main/exercice/exercise_submit.php
  3. 55
      main/inc/lib/exercise_show_functions.lib.php

@ -1968,9 +1968,6 @@ class Exercise {
$totalWeighting = 0;
$totalScore = 0;
// Destruction of the Question object
unset ($objQuestionTmp);
@ -2576,36 +2573,36 @@ class Exercise {
if ($answerType != MATCHING || $answerCorrect) {
if (in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, MULTIPLE_ANSWER, MULTIPLE_ANSWER_COMBINATION, GLOBAL_MULTIPLE_ANSWER))) {
if ($origin != 'learnpath') {
ExerciseShowFunctions::display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,0,0,0);
ExerciseShowFunctions::display_unique_or_multiple_answer($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect, 0, 0, 0);
}
} elseif($answerType == MULTIPLE_ANSWER_TRUE_FALSE) {
if ($origin!='learnpath') {
ExerciseShowFunctions::display_multiple_answer_true_false($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,0,$questionId,0);
ExerciseShowFunctions::display_multiple_answer_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,0,$questionId,0);
}
} elseif($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) {
if ($origin!='learnpath') {
ExerciseShowFunctions::display_multiple_answer_combination_true_false($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,0,0,0);
ExerciseShowFunctions::display_multiple_answer_combination_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,0,0,0);
}
} elseif($answerType == FILL_IN_BLANKS) {
if ($origin!='learnpath') {
ExerciseShowFunctions::display_fill_in_blanks_answer($answer,0,0);
ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer,0,0);
}
} elseif($answerType == FREE_ANSWER) {
if($origin != 'learnpath') {
ExerciseShowFunctions::display_free_answer($choice, $exeId, $questionId, $questionScore);
ExerciseShowFunctions::display_free_answer($feedback_type, $choice, $exeId, $questionId, $questionScore);
}
} elseif($answerType == ORAL_EXPRESSION) {
// to store the details of open questions in an array to be used in mail
if ($origin != 'learnpath') {
ExerciseShowFunctions::display_oral_expression_answer($choice, 0, 0, $nano);
ExerciseShowFunctions::display_oral_expression_answer($feedback_type, $choice, 0, 0, $nano);
}
} elseif($answerType == HOT_SPOT) {
if ($origin != 'learnpath') {
ExerciseShowFunctions::display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment);
ExerciseShowFunctions::display_hotspot_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment);
}
} elseif($answerType == HOT_SPOT_ORDER) {
if ($origin != 'learnpath') {
ExerciseShowFunctions::display_hotspot_order_answer($answerId, $answer, $studentChoice, $answerComment);
ExerciseShowFunctions::display_hotspot_order_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment);
}
} elseif ($answerType == HOT_SPOT_DELINEATION) {
$user_answer = $_SESSION['exerciseResultCoordinates'][$questionId];
@ -2775,39 +2772,39 @@ class Exercise {
case GLOBAL_MULTIPLE_ANSWER :
case MULTIPLE_ANSWER_COMBINATION :
if ($answerId==1) {
ExerciseShowFunctions::display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,$answerId);
ExerciseShowFunctions::display_unique_or_multiple_answer($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,$answerId);
} else {
ExerciseShowFunctions::display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,"");
ExerciseShowFunctions::display_unique_or_multiple_answer($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,"");
}
break;
case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE:
if ($answerId==1) {
ExerciseShowFunctions::display_multiple_answer_combination_true_false($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,$answerId);
ExerciseShowFunctions::display_multiple_answer_combination_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,$answerId);
} else {
ExerciseShowFunctions::display_multiple_answer_combination_true_false($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,"");
ExerciseShowFunctions::display_multiple_answer_combination_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,"");
}
break;
case MULTIPLE_ANSWER_TRUE_FALSE :
if ($answerId==1) {
ExerciseShowFunctions::display_multiple_answer_true_false($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,$answerId);
ExerciseShowFunctions::display_multiple_answer_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId,$answerId);
} else {
ExerciseShowFunctions::display_multiple_answer_true_false($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId, "");
ExerciseShowFunctions::display_multiple_answer_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$exeId,$questionId, "");
}
break;
case FILL_IN_BLANKS:
ExerciseShowFunctions::display_fill_in_blanks_answer($answer,$exeId,$questionId);
ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer,$exeId,$questionId);
break;
case FREE_ANSWER:
echo ExerciseShowFunctions::display_free_answer($choice, $exeId, $questionId, $questionScore);
echo ExerciseShowFunctions::display_free_answer($feedback_type, $choice, $exeId, $questionId, $questionScore);
break;
case ORAL_EXPRESSION:
echo '<tr>
<td valign="top">'.ExerciseShowFunctions::display_oral_expression_answer($choice, $exeId, $questionId, $nano).'</td>
<td valign="top">'.ExerciseShowFunctions::display_oral_expression_answer($feedback_type, $choice, $exeId, $questionId, $nano).'</td>
</tr>
</table>';
break;
case HOT_SPOT:
ExerciseShowFunctions::display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment);
ExerciseShowFunctions::display_hotspot_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment);
break;
case HOT_SPOT_DELINEATION:
$user_answer = $user_array;
@ -2955,7 +2952,7 @@ class Exercise {
}
break;
case HOT_SPOT_ORDER:
ExerciseShowFunctions::display_hotspot_order_answer($answerId, $answer, $studentChoice, $answerComment);
ExerciseShowFunctions::display_hotspot_order_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment);
break;
case MATCHING:
if ($origin != 'learnpath') {

@ -1043,6 +1043,7 @@ if (!empty($error)) {
}
echo '</form>';
}
if ($origin != 'learnpath') {
//so we are not in learnpath tool
echo '</div>'; //End glossary div

@ -24,8 +24,7 @@ class ExerciseShowFunctions {
* @param int Question ID
* @return void
*/
static function display_fill_in_blanks_answer($answer,$id,$questionId) {
global $feedback_type;
static function display_fill_in_blanks_answer($feedback_type, $answer,$id,$questionId) {
if (empty($id)) {
echo '<tr><td>'. nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)).'</td></tr>';
} else {
@ -55,9 +54,7 @@ class ExerciseShowFunctions {
* @param int Question ID
* @return void
*/
static function display_free_answer($answer, $exe_id, $questionId, $questionScore = null) {
global $feedback_type;
static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) {
$comments = get_comments($exe_id, $questionId);
if (!empty($answer)) {
@ -76,9 +73,7 @@ class ExerciseShowFunctions {
}
}
static function display_oral_expression_answer($answer, $id, $questionId, $nano = null) {
global $feedback_type;
static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) {
if (isset($nano)) {
echo $nano->show_audio_file();
}
@ -119,22 +114,23 @@ class ExerciseShowFunctions {
* @param string $studentChoice
* @param string $answerComment
*/
static function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment) {
global $feedback_type;
$hotspot_colors = array("", // $i starts from 1 on next loop (ugly fix)
"#4271B5",
"#FE8E16",
"#45C7F0",
"#BCD631",
"#D63173",
"#D7D7D7",
"#90AFDD",
"#AF8640",
"#4F9242",
"#F4EB24",
"#ED2024",
"#3B3B3B",
"#F7BDE2");
static function display_hotspot_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment) {
$hotspot_colors = array(
"", // $i starts from 1 on next loop (ugly fix)
"#4271B5",
"#FE8E16",
"#45C7F0",
"#BCD631",
"#D63173",
"#D7D7D7",
"#90AFDD",
"#AF8640",
"#4F9242",
"#F4EB24",
"#ED2024",
"#3B3B3B",
"#F7BDE2");
?>
<table class="data_table">
<tr>
@ -185,8 +181,7 @@ class ExerciseShowFunctions {
* @param boolean Whether to show the answer comment or not
* @return void
*/
static function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans) {
global $feedback_type;
static function display_unique_or_multiple_answer($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans) {
?>
<tr>
<td width="5%">
@ -250,8 +245,7 @@ class ExerciseShowFunctions {
* @param boolean Whether to show the answer comment or not
* @return void
*/
static function display_multiple_answer_true_false($answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans) {
global $feedback_type;
static function display_multiple_answer_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans) {
?>
<tr>
<td width="5%">
@ -277,7 +271,7 @@ class ExerciseShowFunctions {
} else {
echo '-';
}
?>
</td>
<td width="40%">
@ -321,8 +315,7 @@ class ExerciseShowFunctions {
* @param boolean Whether to show the answer comment or not
* @return void
*/
static function display_multiple_answer_combination_true_false($answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans) {
global $feedback_type;
static function display_multiple_answer_combination_true_false($feedback_type, $answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans) {
?>
<tr>
<td width="5%">

Loading…
Cancel
Save