|
@@ -57,11 +57,6 @@ class ExerciseShowFunctions
|
|
|
echo '<tr><td>';
|
|
|
echo Security::remove_XSS($answerHTML, COURSEMANAGERLOWSECURITY);
|
|
|
echo '</td>';
|
|
|
- if (!api_is_allowed_to_edit(null, true) && $feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
- echo '<td>';
|
|
|
- $comm = Event::get_comments($id, $questionId);
|
|
|
- echo '</td>';
|
|
|
- }
|
|
|
echo '</tr>';
|
|
|
}
|
|
|
}
|
|
@@ -103,11 +98,6 @@ class ExerciseShowFunctions
|
|
|
echo '</td><td>';
|
|
|
echo Security::remove_XSS($status);
|
|
|
echo '</td>';
|
|
|
- if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
- echo '<td>';
|
|
|
- $comm = Event::get_comments($id, $questionId);
|
|
|
- echo '</td>';
|
|
|
- }
|
|
|
echo '</tr>';
|
|
|
}
|
|
|
} else {
|
|
@@ -116,11 +106,6 @@ class ExerciseShowFunctions
|
|
|
} else {
|
|
|
echo '<tr><td>';
|
|
|
echo Security::remove_XSS($answer);
|
|
|
- if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
- echo '<td>';
|
|
|
- $comm = Event::get_comments($id, $questionId);
|
|
|
- echo '</td>';
|
|
|
- }
|
|
|
echo '</tr>';
|
|
|
}
|
|
|
}
|
|
@@ -254,55 +239,62 @@ class ExerciseShowFunctions
|
|
|
}
|
|
|
|
|
|
$hotspot_colors = [
|
|
|
- "",
|
|
|
- "#4271B5",
|
|
|
- "#FE8E16",
|
|
|
- "#45C7F0",
|
|
|
- "#BCD631",
|
|
|
- "#D63173",
|
|
|
- "#D7D7D7",
|
|
|
- "#90AFDD",
|
|
|
- "#AF8640",
|
|
|
- "#4F9242",
|
|
|
- "#F4EB24",
|
|
|
- "#ED2024",
|
|
|
- "#3B3B3B",
|
|
|
- "#F7BDE2",
|
|
|
+ '',
|
|
|
+ '#4271B5',
|
|
|
+ '#FE8E16',
|
|
|
+ '#45C7F0',
|
|
|
+ '#BCD631',
|
|
|
+ '#D63173',
|
|
|
+ '#D7D7D7',
|
|
|
+ '#90AFDD',
|
|
|
+ '#AF8640',
|
|
|
+ '#4F9242',
|
|
|
+ '#F4EB24',
|
|
|
+ '#ED2024',
|
|
|
+ '#3B3B3B',
|
|
|
+ '#F7BDE2',
|
|
|
];
|
|
|
- echo '<table class="data_table"><tr>';
|
|
|
- echo '<td class="text-center" width="5%">';
|
|
|
- echo '<span class="fa fa-square fa-fw fa-2x" aria-hidden="true" style="color:'.
|
|
|
+
|
|
|
+ $content = '<table class="data_table"><tr>';
|
|
|
+ $content .= '<td class="text-center" width="5%">';
|
|
|
+ $content .= '<span class="fa fa-square fa-fw fa-2x" aria-hidden="true" style="color:'.
|
|
|
$hotspot_colors[$orderColor].'"></span>';
|
|
|
- echo '</td>';
|
|
|
- echo '<td class="text-left" width="25%">';
|
|
|
- echo "$answerId - $answer";
|
|
|
- echo '</td>';
|
|
|
- echo '<td class="text-left" width="10%">';
|
|
|
+ $content .= '</td>';
|
|
|
+ $content .= '<td class="text-left" width="25%">';
|
|
|
+ $content .= "$answerId - $answer";
|
|
|
+ $content .= '</td>';
|
|
|
+ $content .= '<td class="text-left" width="10%">';
|
|
|
if (!$hide_expected_answer) {
|
|
|
$status = Display::label(get_lang('Incorrect'), 'danger');
|
|
|
if ($studentChoice) {
|
|
|
$status = Display::label(get_lang('Correct'), 'success');
|
|
|
+ } else {
|
|
|
+ if ($resultsDisabled == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
}
|
|
|
- echo $status;
|
|
|
+ $content .= $status;
|
|
|
}
|
|
|
- echo '</td>';
|
|
|
+ $content .= '</td>';
|
|
|
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
- echo '<td class="text-left" width="60%">';
|
|
|
+ $content .= '<td class="text-left" width="60%">';
|
|
|
if ($studentChoice) {
|
|
|
- echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>';
|
|
|
+ $content .= '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>';
|
|
|
}
|
|
|
- echo '</td>';
|
|
|
+ $content .= '</td>';
|
|
|
} else {
|
|
|
- echo '<td class="text-left" width="60%"> </td>';
|
|
|
+ $content .= '<td class="text-left" width="60%"> </td>';
|
|
|
}
|
|
|
- echo '</tr>';
|
|
|
+ $content .= '</tr>';
|
|
|
+
|
|
|
+ echo $content;
|
|
|
}
|
|
|
|
|
|
|
|
|
* Display the answers to a multiple choice question.
|
|
|
*
|
|
|
* @param Exercise $exercise
|
|
|
- * @param int $feedback_type Feedback type
|
|
|
+ * @param int $feedbackType Feedback type
|
|
|
* @param int $answerType Answer type
|
|
|
* @param int $studentChoice Student choice
|
|
|
* @param string $answer Textual answer
|
|
@@ -317,7 +309,7 @@ class ExerciseShowFunctions
|
|
|
*/
|
|
|
public static function display_unique_or_multiple_answer(
|
|
|
$exercise,
|
|
|
- $feedback_type,
|
|
|
+ $feedbackType,
|
|
|
$answerType,
|
|
|
$studentChoice,
|
|
|
$answer,
|
|
@@ -342,15 +334,22 @@ class ExerciseShowFunctions
|
|
|
$answer = str_replace($tags, '', $answer);
|
|
|
}
|
|
|
|
|
|
+ $studentChoiceInt = (int) $studentChoice;
|
|
|
+ $answerCorrectChoice = (int) $answerCorrect;
|
|
|
+
|
|
|
$hide_expected_answer = false;
|
|
|
switch ($resultsDisabled) {
|
|
|
case RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER:
|
|
|
+ if ($studentChoiceInt !== $answerCorrectChoice) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+
|
|
|
if (!$answerCorrect) {
|
|
|
- $hide_expected_answer = true;
|
|
|
+ return '';
|
|
|
}
|
|
|
break;
|
|
|
case RESULT_DISABLE_SHOW_SCORE_ONLY:
|
|
|
- if ($feedback_type == 0) {
|
|
|
+ if ($feedbackType == 0) {
|
|
|
$hide_expected_answer = true;
|
|
|
}
|
|
|
break;
|
|
@@ -384,14 +383,8 @@ class ExerciseShowFunctions
|
|
|
echo '</td>';
|
|
|
|
|
|
if ($exercise->showExpectedChoice()) {
|
|
|
-
|
|
|
- if ($studentChoice && $answerCorrect) {
|
|
|
- $status = Display::label(get_lang('Correct'), 'success');
|
|
|
- }*/
|
|
|
- $studentChoiceChoice = (int) $studentChoice;
|
|
|
- $answerCorrectChoice = (int) $answerCorrect;
|
|
|
$status = Display::label(get_lang('Incorrect'), 'danger');
|
|
|
- if ($studentChoiceChoice === $answerCorrectChoice) {
|
|
|
+ if ($studentChoiceInt === $answerCorrectChoice) {
|
|
|
$status = Display::label(get_lang('Correct'), 'success');
|
|
|
}
|
|
|
echo '<td width="20%">';
|
|
@@ -399,7 +392,7 @@ class ExerciseShowFunctions
|
|
|
echo '</td>';
|
|
|
}
|
|
|
|
|
|
- if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
+ if ($feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
echo '<td width="20%">';
|
|
|
if ($studentChoice) {
|
|
|
$color = 'black';
|
|
@@ -444,7 +437,7 @@ class ExerciseShowFunctions
|
|
|
*/
|
|
|
public static function display_multiple_answer_true_false(
|
|
|
$exercise,
|
|
|
- $feedback_type,
|
|
|
+ $feedbackType,
|
|
|
$answerType,
|
|
|
$studentChoice,
|
|
|
$answer,
|
|
@@ -459,7 +452,7 @@ class ExerciseShowFunctions
|
|
|
$hide_expected_answer = false;
|
|
|
switch ($resultsDisabled) {
|
|
|
case RESULT_DISABLE_SHOW_SCORE_ONLY:
|
|
|
- if ($feedback_type == 0) {
|
|
|
+ if ($feedbackType == 0) {
|
|
|
$hide_expected_answer = true;
|
|
|
}
|
|
|
break;
|
|
@@ -471,29 +464,30 @@ class ExerciseShowFunctions
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
- echo '<tr><td width="5%">';
|
|
|
+
|
|
|
+ $content = '<tr><td width="5%">';
|
|
|
$course_id = api_get_course_int_id();
|
|
|
$new_options = Question::readQuestionOption($questionId, $course_id);
|
|
|
|
|
|
if (isset($new_options[$studentChoice])) {
|
|
|
- echo get_lang($new_options[$studentChoice]['name']);
|
|
|
+ $content .= get_lang($new_options[$studentChoice]['name']);
|
|
|
} else {
|
|
|
- echo '-';
|
|
|
+ $content .= '-';
|
|
|
}
|
|
|
echo '</td><td width="5%">';
|
|
|
|
|
|
if (!$hide_expected_answer) {
|
|
|
if (isset($new_options[$answerCorrect])) {
|
|
|
- echo get_lang($new_options[$answerCorrect]['name']);
|
|
|
+ $content .= get_lang($new_options[$answerCorrect]['name']);
|
|
|
} else {
|
|
|
- echo '-';
|
|
|
+ $content .= '-';
|
|
|
}
|
|
|
} else {
|
|
|
- echo '-';
|
|
|
+ $content .= '-';
|
|
|
}
|
|
|
- echo '</td><td width="40%">';
|
|
|
- echo $answer;
|
|
|
- echo '</td>';
|
|
|
+ $content .= '</td><td width="40%">';
|
|
|
+ $content .= $answer;
|
|
|
+ $content .= '</td>';
|
|
|
if ($exercise->showExpectedChoice()) {
|
|
|
$status = Display::label(get_lang('Incorrect'), 'danger');
|
|
|
if (isset($new_options[$studentChoice])) {
|
|
@@ -501,31 +495,35 @@ class ExerciseShowFunctions
|
|
|
$status = Display::label(get_lang('Correct'), 'success');
|
|
|
}
|
|
|
}
|
|
|
- echo '<td width="20%">';
|
|
|
- echo $status;
|
|
|
- echo '</td>';
|
|
|
+ $content .= '<td width="20%">';
|
|
|
+ $content .= $status;
|
|
|
+ $content .= '</td>';
|
|
|
}
|
|
|
- if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
- echo '<td width="20%">';
|
|
|
- $color = "black";
|
|
|
+ if ($feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
+ if ($resultsDisabled == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
|
|
|
+ if ($studentChoice != $answerCorrect) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $content .= '<td width="20%">';
|
|
|
+ $color = 'black';
|
|
|
if (isset($new_options[$studentChoice])) {
|
|
|
if ($studentChoice == $answerCorrect) {
|
|
|
- $color = "green";
|
|
|
+ $color = 'green';
|
|
|
}
|
|
|
|
|
|
if ($hide_expected_answer) {
|
|
|
$color = '';
|
|
|
}
|
|
|
- echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
|
|
|
- }
|
|
|
- echo '</td>';
|
|
|
- if ($ans == 1) {
|
|
|
- $comm = Event::get_comments($id, $questionId);
|
|
|
+ $content .= '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
|
|
|
}
|
|
|
+ $content .= '</td>';
|
|
|
} else {
|
|
|
- echo '<td> </td>';
|
|
|
+ $content .= '<td> </td>';
|
|
|
}
|
|
|
- echo '</tr>';
|
|
|
+ $content .= '</tr>';
|
|
|
+
|
|
|
+ echo $content;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -582,7 +580,9 @@ class ExerciseShowFunctions
|
|
|
echo '</td><td width="20%">';
|
|
|
echo $answer;
|
|
|
echo '</td><td width="5%" style="text-align:center;">';
|
|
|
- echo $newOptions[$studentChoiceDegree]['name'];
|
|
|
+ if (isset($newOptions[$studentChoiceDegree])) {
|
|
|
+ echo $newOptions[$studentChoiceDegree]['name'];
|
|
|
+ }
|
|
|
echo '</td>';
|
|
|
|
|
|
$degreeInfo = $question->getResponseDegreeInfo(
|
|
@@ -628,7 +628,7 @@ class ExerciseShowFunctions
|
|
|
*/
|
|
|
public static function display_multiple_answer_combination_true_false(
|
|
|
$exercise,
|
|
|
- $feedback_type,
|
|
|
+ $feedbackType,
|
|
|
$answerType,
|
|
|
$studentChoice,
|
|
|
$answer,
|
|
@@ -643,7 +643,7 @@ class ExerciseShowFunctions
|
|
|
$hide_expected_answer = false;
|
|
|
switch ($resultsDisabled) {
|
|
|
case RESULT_DISABLE_SHOW_SCORE_ONLY:
|
|
|
- if ($feedback_type == 0) {
|
|
|
+ if ($feedbackType == 0) {
|
|
|
$hide_expected_answer = true;
|
|
|
}
|
|
|
break;
|
|
@@ -694,7 +694,7 @@ class ExerciseShowFunctions
|
|
|
echo '</td>';
|
|
|
}
|
|
|
|
|
|
- if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
+ if ($feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
echo '<td width="20%">';
|
|
|
|
|
|
if ($studentChoice) {
|
|
@@ -718,21 +718,21 @@ class ExerciseShowFunctions
|
|
|
}
|
|
|
|
|
|
|
|
|
- * @param $feedback_type
|
|
|
+ * @param $feedbackType
|
|
|
* @param $exe_id
|
|
|
* @param $questionId
|
|
|
* @param null $questionScore
|
|
|
* @param int $resultsDisabled
|
|
|
*/
|
|
|
public static function displayAnnotationAnswer(
|
|
|
- $feedback_type,
|
|
|
+ $feedbackType,
|
|
|
$exe_id,
|
|
|
$questionId,
|
|
|
$questionScore = null,
|
|
|
$resultsDisabled = 0
|
|
|
) {
|
|
|
$comments = Event::get_comments($exe_id, $questionId);
|
|
|
- if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
+ if ($feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
|
|
|
if ($questionScore <= 0 && empty($comments)) {
|
|
|
echo '<br />'.ExerciseLib::getNotCorrectedYetText();
|
|
|
}
|