';
echo Security::remove_XSS($answerHTML, COURSEMANAGERLOWSECURITY);
echo ' ';
} else {
echo '';
echo Security::remove_XSS($answerHTML, COURSEMANAGERLOWSECURITY);
echo ' ';
echo ' ';
}
}
/**
* Shows the answer to a calculated question, as HTML.
*
* @param Exercise $exercise
* @param string Answer text
* @param int Exercise ID
* @param int Question ID
*/
public static function display_calculated_answer(
$exercise,
$feedback_type,
$answer,
$id,
$questionId,
$resultsDisabled,
$showTotalScoreAndUserChoices,
$expectedChoice = '',
$choice = '',
$status = ''
) {
$answer = explode(':::', $answer);
$answer = $answer[0];
if ($exercise->showExpectedChoice()) {
if (empty($id)) {
echo ''.Security::remove_XSS($answer).' ';
echo ''.Security::remove_XSS($choice).' ';
if ($exercise->showExpectedChoiceColumn()) {
echo ''.Security::remove_XSS($expectedChoice).' ';
}
echo ''.Security::remove_XSS($status).' ';
echo ' ';
} else {
echo '';
echo Security::remove_XSS($answer);
echo ' ';
echo Security::remove_XSS($choice);
echo ' ';
if ($exercise->showExpectedChoiceColumn()) {
echo '';
echo Security::remove_XSS($expectedChoice);
echo ' ';
}
echo '';
echo Security::remove_XSS($status);
echo ' ';
echo ' ';
}
} else {
if (empty($id)) {
echo ''.Security::remove_XSS($answer).' ';
} else {
echo '';
echo Security::remove_XSS($answer);
echo ' ';
}
}
}
/**
* Shows the answer to an upload question.
*
* @param float|null $questionScore Only used to check if > 0
* @param int $resultsDisabled Unused
*/
public static function displayUploadAnswer(
string $feedbackType,
string $answer,
int $exeId,
int $questionId,
$questionScore = null,
$resultsDisabled = 0
) {
if (!empty($answer)) {
$exeInfo = Event::get_exercise_results_by_attempt($exeId);
if (empty($exeInfo)) {
global $exercise_stat_info;
$userId = $exercise_stat_info['exe_user_id'];
} else {
$userId = $exeInfo[$exeId]['exe_user_id'];
}
$userWebpath = UserManager::getUserPathById($userId, 'web').'my_files'.'/upload_answer/'.$exeId.'/'.$questionId.'/';
$filesNames = explode('|', $answer);
echo '';
foreach ($filesNames as $filename) {
$filename = Security::remove_XSS($filename);
echo ''.$filename.'
';
}
echo ' ';
}
if (EXERCISE_FEEDBACK_TYPE_EXAM != $feedbackType) {
$comments = Event::get_comments($exeId, $questionId);
if ($questionScore > 0 || !empty($comments)) {
} else {
echo '';
echo Display::tag('td', ExerciseLib::getNotCorrectedYetText());
echo ' ';
}
}
}
/**
* Shows the answer to a free-answer question, as HTML.
*
* @param string Answer text
* @param int Exercise ID
* @param int Question ID
*/
public static function display_free_answer(
$feedback_type,
$answer,
$exe_id,
$questionId,
$questionScore = null,
$resultsDisabled = 0
) {
$comments = Event::get_comments($exe_id, $questionId);
if (!empty($answer)) {
echo '';
echo Security::remove_XSS($answer);
echo ' ';
}
if (EXERCISE_FEEDBACK_TYPE_EXAM != $feedback_type) {
if ($questionScore > 0 || !empty($comments)) {
} else {
echo '';
echo Display::tag('td', ExerciseLib::getNotCorrectedYetText());
echo ' ';
}
}
}
/**
* @param $feedback_type
* @param $answer
* @param $id
* @param $questionId
* @param null $fileUrl
* @param int $resultsDisabled
* @param int $questionScore
*/
public static function display_oral_expression_answer(
$feedback_type,
$answer,
$id,
$questionId,
$fileUrl = null,
$resultsDisabled = 0,
$questionScore = 0
) {
if (isset($fileUrl)) {
echo '
';
}
if (empty($id)) {
echo '';
if (!empty($answer) && ($answer != basename($fileUrl))) {
echo Display::tag('td', Security::remove_XSS($answer), ['width' => '55%']);
}
echo ' ';
if (!$questionScore && EXERCISE_FEEDBACK_TYPE_EXAM != $feedback_type) {
echo '';
echo Display::tag('td', ExerciseLib::getNotCorrectedYetText(), ['width' => '45%']);
echo ' ';
} else {
echo ' ';
}
} else {
echo '';
echo '';
if (!empty($answer)) {
echo Security::remove_XSS($answer);
}
echo ' ';
echo ' ';
}
}
/**
* Displays the answer to a hotspot question.
*
* @param int $feedback_type
* @param int $answerId
* @param string $answer
* @param string $studentChoice
* @param string $answerComment
* @param int $resultsDisabled
* @param int $orderColor
* @param bool $showTotalScoreAndUserChoices
*/
public static function display_hotspot_answer(
$exercise,
$feedback_type,
$answerId,
$answer,
$studentChoice,
$answerComment,
$resultsDisabled,
$orderColor,
$showTotalScoreAndUserChoices
) {
$hide_expected_answer = false;
switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if (0 == $feedback_type) {
$hide_expected_answer = true;
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
break;
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK:
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
if (false === $showTotalScoreAndUserChoices && empty($studentChoice)) {
return '';
}
break;
}
if (!$hide_expected_answer
&& !$studentChoice
&& in_array($resultsDisabled, [RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER])
) {
return;
}
$hotspotColors = [
'', // $i starts from 1 on next loop (ugly fix)
'#4271B5',
'#FE8E16',
'#45C7F0',
'#BCD631',
'#D63173',
'#D7D7D7',
'#90AFDD',
'#AF8640',
'#4F9242',
'#F4EB24',
'#ED2024',
'#3B3B3B',
'#F7BDE2',
];
$content = '';
$content .= '';
$content .= ' ';
$content .= ' ';
$content .= '';
$content .= "$answerId - $answer";
$content .= ' ';
if (false === $exercise->hideComment) {
$content .= '';
if (!$hide_expected_answer) {
$status = Display::label(get_lang('Incorrect'), 'danger');
if ($studentChoice) {
$status = Display::label(get_lang('Correct'), 'success');
}
$content .= $status;
} else {
$content .= ' ';
}
$content .= ' ';
if (EXERCISE_FEEDBACK_TYPE_EXAM != $feedback_type) {
$content .= '';
if ($studentChoice) {
$content .= ''.Security::remove_XSS(nl2br($answerComment)).' ';
} else {
$content .= ' ';
}
$content .= ' ';
} else {
$content .= ' ';
}
}
$content .= ' ';
echo $content;
}
public static function displayMultipleAnswerDropdown(
Exercise $exercise,
Answer $answer,
array $correctAnswers,
array $studentChoices,
bool $showTotalScoreAndUserChoices = true
): string {
if (true === $exercise->hideNoAnswer && empty($studentChoices)) {
return '';
}
$studentChoices = array_filter(
$studentChoices,
function ($studentAnswerId) {
return -1 !== (int) $studentAnswerId;
}
);
$allChoices = array_unique(
array_merge($correctAnswers, $studentChoices)
);
sort($allChoices);
$checkboxOn = Display::return_icon('checkbox_on.png', null, null, ICON_SIZE_TINY);
$checkboxOff = Display::return_icon('checkbox_off.png', null, null, ICON_SIZE_TINY);
$labelSuccess = Display::label(get_lang('Correct'), 'success');
$labelIncorrect = Display::label(get_lang('Incorrect'), 'danger');
$html = '';
foreach ($allChoices as $choice) {
$isStudentAnswer = in_array($choice, $studentChoices);
$isExpectedAnswer = in_array($choice, $correctAnswers);
$isCorrectAnswer = $isStudentAnswer && $isExpectedAnswer;
$answerPosition = array_search($choice, $answer->iid);
$hideExpectedAnswer = false;
switch ($exercise->selectResultsDisabled()) {
case RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER:
$hideExpectedAnswer = true;
if (!$isCorrectAnswer && empty($studentChoices)) {
continue 2;
}
break;
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if (0 == $exercise->getFeedbackType()) {
$hideExpectedAnswer = true;
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$hideExpectedAnswer = true;
if ($showTotalScoreAndUserChoices) {
$hideExpectedAnswer = false;
}
break;
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK:
if (false === $showTotalScoreAndUserChoices && empty($studentChoices)) {
continue 2;
}
break;
}
$studentAnswerClass = '';
if ($isCorrectAnswer
&& in_array(
$exercise->selectResultsDisabled(),
[
RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER,
RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS_AND_RANKING,
]
)
) {
$studentAnswerClass = 'success';
}
$html .= '';
$html .= ''.($isStudentAnswer ? $checkboxOn : $checkboxOff).' ';
if ($exercise->showExpectedChoiceColumn()) {
$html .= '';
if ($hideExpectedAnswer) {
$html .= '— ';
} else {
$html .= $isExpectedAnswer ? $checkboxOn : $checkboxOff;
}
$html .= ' ';
}
$answerText = $answer->answer[$answerPosition] ?? get_lang('None');
if ($exercise->export) {
$answerText = strip_tags_blacklist($answerText, ['title', 'head']);
// Fix answers that contains this tags
$tags = ['', '', '', ''];
$answerText = str_replace($tags, '', $answerText);
}
$html .= ''.Security::remove_XSS($answerText).' ';
if ($exercise->showExpectedChoice()) {
$html .= ''.($isCorrectAnswer ? $labelSuccess : $labelIncorrect).' ';
}
$html .= ' ';
}
return $html;
}
/**
* Display the answers to a multiple choice question.
*
* @param Exercise $exercise
* @param int $feedbackType Feedback type
* @param int $answerType Answer type
* @param int $studentChoice Student choice
* @param string $answer Textual answer
* @param string $answerComment Comment on answer
* @param string $answerCorrect Correct answer comment
* @param int $id Exercise ID
* @param int $questionId Question ID
* @param bool $ans Whether to show the answer comment or not
* @param bool $resultsDisabled
* @param bool $showTotalScoreAndUserChoices
* @param bool $export
*/
public static function display_unique_or_multiple_answer(
$exercise,
$feedbackType,
$answerType,
$studentChoice,
$answer,
$answerComment,
$answerCorrect,
$id,
$questionId,
$ans,
$resultsDisabled,
$showTotalScoreAndUserChoices,
$export = false
) {
if (true === $exercise->hideNoAnswer && empty($studentChoice)) {
return '';
}
if ($export) {
$answer = strip_tags_blacklist($answer, ['title', 'head']);
// Fix answers that contains this tags
$tags = [
'',
'',
'',
'',
];
$answer = str_replace($tags, '', $answer);
}
$studentChoiceInt = (int) $studentChoice;
$answerCorrectChoice = (int) $answerCorrect;
$hide_expected_answer = false;
$showComment = false;
switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER:
$hide_expected_answer = true;
$showComment = true;
if (!$answerCorrect && empty($studentChoice)) {
return '';
}
break;
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if (0 == $feedbackType) {
$hide_expected_answer = true;
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
break;
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK:
if (false === $showTotalScoreAndUserChoices && empty($studentChoiceInt)) {
return '';
}
break;
}
$icon = in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION]) ? 'radio' : 'checkbox';
$icon .= $studentChoice ? '_on' : '_off';
$icon .= '.png';
$iconAnswer = in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION]) ? 'radio' : 'checkbox';
$iconAnswer .= $answerCorrect ? '_on' : '_off';
$iconAnswer .= '.png';
$studentChoiceClass = '';
if (in_array(
$resultsDisabled,
[
RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER,
RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS_AND_RANKING,
]
)
) {
if ($answerCorrect) {
$studentChoiceClass = 'success';
}
}
echo '';
echo '';
echo Display::return_icon($icon, null, null, ICON_SIZE_TINY);
echo ' ';
if ($exercise->showExpectedChoiceColumn()) {
if (false === $hide_expected_answer) {
echo '';
echo Display::return_icon($iconAnswer, null, null, ICON_SIZE_TINY);
echo ' ';
} else {
echo '';
echo '-';
echo ' ';
}
}
echo '';
echo Security::remove_XSS($answer);
echo ' ';
if ($exercise->showExpectedChoice()) {
$status = Display::label(get_lang('Incorrect'), 'danger');
if ($answerCorrect || ($answerCorrect && $studentChoiceInt === $answerCorrectChoice)) {
$status = Display::label(get_lang('Correct'), 'success');
}
echo '';
// Show only status for the selected student answer BT#16256
if ($studentChoice) {
echo $status;
}
echo ' ';
}
if (EXERCISE_FEEDBACK_TYPE_EXAM != $feedbackType) {
$showComment = true;
}
if (false === $exercise->hideComment) {
if ($showComment) {
echo '';
$color = 'black';
if ($answerCorrect) {
$color = 'green';
}
if ($hide_expected_answer) {
$color = '';
}
$comment = ''.
Security::remove_XSS($answerComment).
' ';
echo $comment;
echo ' ';
} else {
echo ' ';
}
}
echo ' ';
}
/**
* Display the answers to a multiple choice question.
*
* @param Exercise $exercise
* @param int Answer type
* @param int Student choice
* @param string Textual answer
* @param string Comment on answer
* @param string Correct answer comment
* @param int Exercise ID
* @param int Question ID
* @param bool Whether to show the answer comment or not
*/
public static function display_multiple_answer_true_false(
$exercise,
$feedbackType,
$answerType,
$studentChoice,
$answer,
$answerComment,
$answerCorrect,
$id,
$questionId,
$ans,
$resultsDisabled,
$showTotalScoreAndUserChoices
) {
$hide_expected_answer = false;
$hideStudentChoice = false;
switch ($resultsDisabled) {
//case RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS_AND_RANKING:
case RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER:
$hideStudentChoice = false;
$hide_expected_answer = true;
break;
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if (0 == $feedbackType) {
$hide_expected_answer = true;
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
break;
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK:
if (false === $showTotalScoreAndUserChoices && empty($studentChoice)) {
return '';
}
break;
}
$content = '';
if (false === $hideStudentChoice) {
$content .= '';
$course_id = api_get_course_int_id();
$new_options = Question::readQuestionOption($questionId, $course_id);
// Your choice
if (isset($new_options[$studentChoice])) {
$content .= get_lang($new_options[$studentChoice]['name']);
} else {
$content .= '-';
}
$content .= ' ';
}
// Expected choice
if ($exercise->showExpectedChoiceColumn()) {
if (!$hide_expected_answer) {
$content .= '';
if (isset($new_options[$answerCorrect])) {
$content .= get_lang($new_options[$answerCorrect]['name']);
} else {
$content .= '-';
}
$content .= ' ';
}
}
$content .= '';
$content .= Security::remove_XSS($answer);
$content .= ' ';
if ($exercise->showExpectedChoice()) {
$status = Display::label(get_lang('Incorrect'), 'danger');
if (isset($new_options[$studentChoice])) {
if ($studentChoice == $answerCorrect) {
$status = Display::label(get_lang('Correct'), 'success');
}
}
$content .= '';
$content .= $status;
$content .= ' ';
}
if (false === $exercise->hideComment) {
if (EXERCISE_FEEDBACK_TYPE_EXAM != $feedbackType) {
$content .= '';
$color = 'black';
if (isset($new_options[$studentChoice]) || in_array(
$exercise->results_disabled,
[
RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER,
RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS_AND_RANKING,
]
)
) {
if ($studentChoice == $answerCorrect) {
$color = 'green';
}
if ($hide_expected_answer) {
$color = '';
}
$content .= ''.Security::remove_XSS(nl2br($answerComment)).' ';
}
$content .= ' ';
}
}
$content .= ' ';
echo $content;
}
/**
* Display the answers to a multiple choice question.
*
* @param Exercise $exercise
* @param int $feedbackType
* @param int $studentChoice
* @param int $studentChoiceDegree
* @param string $answer
* @param string $answerComment
* @param int $answerCorrect
* @param int $questionId
* @param bool $inResultsDisabled
*/
public static function displayMultipleAnswerTrueFalseDegreeCertainty(
$exercise,
$feedbackType,
$studentChoice,
$studentChoiceDegree,
$answer,
$answerComment,
$answerCorrect,
$questionId,
$inResultsDisabled
) {
$hideExpectedAnswer = false;
if (0 == $feedbackType && 2 == $inResultsDisabled) {
$hideExpectedAnswer = true;
}
echo '';
$question = new MultipleAnswerTrueFalseDegreeCertainty();
$courseId = api_get_course_int_id();
$newOptions = Question::readQuestionOption($questionId, $courseId);
// Your choice
if (isset($newOptions[$studentChoice])) {
echo get_lang($newOptions[$studentChoice]['name']);
} else {
echo '-';
}
echo ' ';
// Expected choice
if ($exercise->showExpectedChoiceColumn()) {
echo '';
if (!$hideExpectedAnswer) {
if (isset($newOptions[$answerCorrect])) {
echo get_lang($newOptions[$answerCorrect]['name']);
} else {
echo '-';
}
} else {
echo '-';
}
echo ' ';
}
echo '';
echo Security::remove_XSS($answer);
echo ' ';
if (isset($newOptions[$studentChoiceDegree])) {
echo $newOptions[$studentChoiceDegree]['name'];
}
echo ' ';
$position = isset($newOptions[$studentChoiceDegree]) ? $newOptions[$studentChoiceDegree]['position'] : '';
$degreeInfo = $question->getResponseDegreeInfo(
$studentChoice,
$answerCorrect,
$position
);
$degreeInfo['color'] = isset($degreeInfo['color']) ? $degreeInfo['color'] : '';
$degreeInfo['background-color'] = isset($degreeInfo['background-color']) ? $degreeInfo['background-color'] : '';
$degreeInfo['description'] = isset($degreeInfo['description']) ? $degreeInfo['description'] : '';
$degreeInfo['label'] = isset($degreeInfo['label']) ? $degreeInfo['label'] : '';
echo '
'.
nl2br($degreeInfo['label']).
'
';
if (false === $exercise->hideComment) {
if (EXERCISE_FEEDBACK_TYPE_EXAM != $feedbackType) {
echo '';
if (isset($newOptions[$studentChoice])) {
echo ''.nl2br($answerComment).' ';
}
echo ' ';
} else {
echo ' ';
}
}
echo ' ';
}
/**
* Display the answers to a multiple choice question.
*
* @param Exercise $exercise
* @param int Answer type
* @param int Student choice
* @param string Textual answer
* @param string Comment on answer
* @param string Correct answer comment
* @param int Exercise ID
* @param int Question ID
* @param bool Whether to show the answer comment or not
*/
public static function display_multiple_answer_combination_true_false(
$exercise,
$feedbackType,
$answerType,
$studentChoice,
$answer,
$answerComment,
$answerCorrect,
$id,
$questionId,
$ans,
$resultsDisabled,
$showTotalScoreAndUserChoices
) {
$hide_expected_answer = false;
$hideStudentChoice = false;
switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS_AND_RANKING:
case RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER:
$hideStudentChoice = true;
$hide_expected_answer = true;
break;
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if (0 == $feedbackType) {
$hide_expected_answer = true;
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
break;
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK:
if (false === $showTotalScoreAndUserChoices && empty($studentChoice)) {
return '';
}
break;
}
echo '';
if (false === $hideStudentChoice) {
echo '';
// Your choice
$question = new MultipleAnswerCombinationTrueFalse();
if (isset($question->options[$studentChoice])) {
echo $question->options[$studentChoice];
} else {
echo $question->options[2];
}
echo ' ';
}
// Expected choice
if ($exercise->showExpectedChoiceColumn()) {
if (!$hide_expected_answer) {
echo '';
if (isset($question->options[$answerCorrect])) {
echo $question->options[$answerCorrect];
} else {
echo $question->options[2];
}
echo ' ';
}
}
echo '';
echo Security::remove_XSS($answer);
echo ' ';
if ($exercise->showExpectedChoice()) {
$status = '';
if (isset($studentChoice)) {
$status = Display::label(get_lang('Incorrect'), 'danger');
if ($studentChoice == $answerCorrect) {
$status = Display::label(get_lang('Correct'), 'success');
}
}
echo '';
echo $status;
echo ' ';
}
if (false === $exercise->hideComment) {
if (EXERCISE_FEEDBACK_TYPE_EXAM != $feedbackType) {
echo '';
//@todo replace this harcoded value
if ($studentChoice || in_array(
$resultsDisabled,
[
RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER,
RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS_AND_RANKING,
]
)
) {
$color = 'black';
if ($studentChoice == $answerCorrect) {
$color = 'green';
}
if ($hide_expected_answer) {
$color = '';
}
echo ''.nl2br($answerComment).' ';
}
echo ' ';
} else {
echo ' ';
}
}
echo ' ';
}
/**
* @param int $feedbackType
* @param int $exeId
* @param int $questionId
* @param null $questionScore
* @param int $resultsDisabled
*/
public static function displayAnnotationAnswer(
$feedbackType,
$exeId,
$questionId,
$questionScore = null,
$resultsDisabled = 0
) {
$comments = Event::get_comments($exeId, $questionId);
if (EXERCISE_FEEDBACK_TYPE_EXAM != $feedbackType) {
if ($questionScore <= 0 && empty($comments)) {
echo ' '.ExerciseLib::getNotCorrectedYetText();
}
}
}
}