Number and highlight questions in result details

This commit is contained in:
Wojtek
2026-10-17 13:32:32 +02:00
parent 55dc4c9d3c
commit 09cb36a8ea
4 changed files with 10 additions and 3 deletions
@@ -0,0 +1 @@
-- Brak zmian w schemacie bazy danych w wersji 1.43.45.
@@ -32,6 +32,7 @@ $resolveImageUrl = static function ($path) {
article { break-inside: auto; border-color: #aaa !important; }
img { max-width: 100% !important; max-height: 150mm; object-fit: contain; }
.alert { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.result-question-heading { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.container-fluid .result-pdf-comment.has-print-comment { display: block !important; }
.result-pdf-comment-text { white-space: pre-wrap; }
.ai-token-info { display: none !important; }
@@ -122,8 +123,10 @@ $resolveImageUrl = static function ($path) {
</div>
<?php endif; ?>
<h2><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_ANSWERS'); ?></h2>
<?php $questionNumber = 0; ?>
<?php foreach ($this->item->answers as $questionId => $answer) : ?>
<?php $question = $this->item->questions[(int) $questionId] ?? null; if (!$question) continue; ?>
<?php $questionNumber++; ?>
<?php $hasResponse = trim((string) ($answer['selected'] ?? '')) !== ''; ?>
<?php
$answerStatusCorrect = !empty($answer['correct']);
@@ -149,7 +152,10 @@ $resolveImageUrl = static function ($path) {
$printComment = $manualComment !== '' ? $manualComment : $aiComment;
?>
<article class="mb-4 border rounded p-3">
<div class="mb-2"><?php echo $question->question; ?></div>
<div class="result-question-heading d-flex align-items-start gap-2 mb-3 p-3 bg-light border-start border-4 border-primary rounded">
<span class="badge text-bg-primary flex-shrink-0"><?php echo $questionNumber; ?>.</span>
<div class="fw-semibold"><?php echo $question->question; ?></div>
</div>
<?php if (!empty($question->image)) : ?><div class="mb-3"><img src="<?php echo htmlspecialchars($resolveImageUrl($question->image), ENT_QUOTES, 'UTF-8'); ?>" alt="" loading="lazy" style="max-width: 100%; height: auto;"></div><?php endif; ?>
<?php if ($question->question_type === 'open') : ?>
<div><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_YOUR_ANSWER'); ?>:</strong> <?php echo htmlspecialchars($answer['selected'] ?: '—', ENT_QUOTES, 'UTF-8'); ?></div>