Skip to content

Commit 543ccb4

Browse files
committed
Quiz: #add new option 'Hide comment' to the result page configuration extra parameter - refs BT#22618
1 parent 378899f commit 543ccb4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

main/exercise/exercise.class.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2312,6 +2312,12 @@ public function createForm($form, $type = 'full')
23122312
null,
23132313
get_lang('HideCorrectAnsweredQuestions')
23142314
),
2315+
$form->createElement(
2316+
'checkbox',
2317+
'hide_comment',
2318+
null,
2319+
get_lang('HideComment')
2320+
),
23152321
];
23162322
$form->addGroup($group, null, get_lang('ResultsConfigurationPage'));
23172323
}
@@ -4082,7 +4088,12 @@ function ($answerId) use ($objAnswerTmp) {
40824088
$matchingCorrectAnswers = [];
40834089
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
40844090
$answer = $objAnswerTmp->selectAnswer($answerId);
4085-
$answerComment = $objAnswerTmp->selectComment($answerId);
4091+
$hideComment = (int) $this->getPageConfigurationAttribute('hide_comment');
4092+
if (1 === $hideComment) {
4093+
$answerComment = null;
4094+
} else {
4095+
$answerComment = $objAnswerTmp->selectComment($answerId);
4096+
}
40864097
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
40874098
$answerWeighting = (float) $objAnswerTmp->selectWeighting($answerId);
40884099
$answerAutoId = $objAnswerTmp->selectId($answerId);
@@ -8938,6 +8949,7 @@ public function setPageResultConfiguration($values)
89388949
'hide_total_score' => $values['hide_total_score'] ?? '',
89398950
'hide_category_table' => $values['hide_category_table'] ?? '',
89408951
'hide_correct_answered_questions' => $values['hide_correct_answered_questions'] ?? '',
8952+
'hide_comment' => $values['hide_comment'] ?? '',
89418953
];
89428954
$type = Type::getType('array');
89438955
$platform = Database::getManager()->getConnection()->getDatabasePlatform();

0 commit comments

Comments
 (0)