|
|
@@ -21,7 +21,7 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
|
.pdf-only { display: none !important; }
|
|
|
|
.result-pdf-comment { display: none !important; }
|
|
|
|
@media print {
|
|
|
|
@media print {
|
|
|
|
@page { size: A4; margin: 15mm; }
|
|
|
|
@page { size: A4; margin: 15mm; }
|
|
|
|
.no-print, .toolbar, #toolbar, .subhead, .sidebar-wrapper, #sidebar, .navbar,
|
|
|
|
.no-print, .toolbar, #toolbar, .subhead, .sidebar-wrapper, #sidebar, .navbar,
|
|
|
@@ -32,7 +32,8 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
article { break-inside: auto; border-color: #aaa !important; }
|
|
|
|
article { break-inside: auto; border-color: #aaa !important; }
|
|
|
|
img { max-width: 100% !important; max-height: 150mm; object-fit: contain; }
|
|
|
|
img { max-width: 100% !important; max-height: 150mm; object-fit: contain; }
|
|
|
|
.alert { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
|
|
|
|
.alert { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
|
|
|
|
.pdf-only { display: block !important; }
|
|
|
|
.container-fluid .result-pdf-comment { display: block !important; }
|
|
|
|
|
|
|
|
.result-pdf-comment-text { white-space: pre-wrap; }
|
|
|
|
.ai-feedback-screen, .ai-token-info { display: none !important; }
|
|
|
|
.ai-feedback-screen, .ai-token-info { display: none !important; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
@@ -42,6 +43,19 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
window.print();
|
|
|
|
window.print();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
window.addEventListener('beforeprint', function () {
|
|
|
|
|
|
|
|
document.querySelectorAll('.result-pdf-comment').forEach(function (commentBlock) {
|
|
|
|
|
|
|
|
const questionId = commentBlock.dataset.questionId;
|
|
|
|
|
|
|
|
const manualComment = document.getElementById('result-comment-' + questionId)?.value.trim() || '';
|
|
|
|
|
|
|
|
const visibleAiFeedback = document.querySelector('.ai-feedback-screen[data-question-id="' + questionId + '"] .ai-feedback-text')?.textContent.trim() || '';
|
|
|
|
|
|
|
|
const aiComment = visibleAiFeedback || commentBlock.dataset.aiComment || '';
|
|
|
|
|
|
|
|
const output = commentBlock.querySelector('.result-pdf-comment-text');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (output) {
|
|
|
|
|
|
|
|
output.textContent = manualComment || aiComment || '—';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
<dl class="row">
|
|
|
|
<dl class="row">
|
|
|
|
<div class="row"<?php echo (int) $this->item->extra_time > 0 ? ' style="background-color: #fff3cd;"' : ''; ?>>
|
|
|
|
<div class="row"<?php echo (int) $this->item->extra_time > 0 ? ' style="background-color: #fff3cd;"' : ''; ?>>
|
|
|
@@ -129,8 +143,11 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
<div><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SELECTED_ANSWER'); ?>:</strong> <?php echo $answer['selected'] ? chr(64 + (int) $answer['selected']) : '—'; ?></div>
|
|
|
|
<div><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SELECTED_ANSWER'); ?>:</strong> <?php echo $answer['selected'] ? chr(64 + (int) $answer['selected']) : '—'; ?></div>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
<div class="mt-2 <?php echo $answerStatusCorrect ? 'text-success' : ($answerStatusPartial ? 'text-warning' : 'text-danger'); ?>"><?php echo $answerStatusCorrect ? '✓ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_CORRECT') : ($answerStatusPartial ? '◐ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_PARTIALLY_CORRECT') : '✗ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_INCORRECT')); ?></div>
|
|
|
|
<div class="mt-2 <?php echo $answerStatusCorrect ? 'text-success' : ($answerStatusPartial ? 'text-warning' : 'text-danger'); ?>"><?php echo $answerStatusCorrect ? '✓ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_CORRECT') : ($answerStatusPartial ? '◐ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_PARTIALLY_CORRECT') : '✗ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_INCORRECT')); ?></div>
|
|
|
|
<?php if ($printComment !== '') : ?>
|
|
|
|
<?php if ($question->question_type === 'open') : ?>
|
|
|
|
<div class="pdf-only mt-3"><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_COMMENT'); ?>:</strong><br><?php echo nl2br(htmlspecialchars($printComment, ENT_QUOTES, 'UTF-8')); ?></div>
|
|
|
|
<div class="result-pdf-comment mt-3" data-question-id="<?php echo (int) $questionId; ?>" data-ai-comment="<?php echo htmlspecialchars($aiComment, ENT_QUOTES, 'UTF-8'); ?>">
|
|
|
|
|
|
|
|
<strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_COMMENT'); ?>:</strong><br>
|
|
|
|
|
|
|
|
<span class="result-pdf-comment-text"><?php echo htmlspecialchars($printComment !== '' ? $printComment : '—', ENT_QUOTES, 'UTF-8'); ?></span>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php if (empty($answer['correct'])) : ?>
|
|
|
|
<?php if (empty($answer['correct'])) : ?>
|
|
|
|
<?php if ($question->question_type === 'open' && $hasResponse) : ?>
|
|
|
|
<?php if ($question->question_type === 'open' && $hasResponse) : ?>
|
|
|
@@ -156,7 +173,7 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
$maxPoints = (int) ($question->points ?? 0);
|
|
|
|
$maxPoints = (int) ($question->points ?? 0);
|
|
|
|
$aiAlertClass = $aiPoints <= 0 ? 'alert-danger' : ($aiPoints >= $maxPoints ? 'alert-success' : 'alert-info');
|
|
|
|
$aiAlertClass = $aiPoints <= 0 ? 'alert-danger' : ($aiPoints >= $maxPoints ? 'alert-success' : 'alert-info');
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|
<div class="alert <?php echo $aiAlertClass; ?> mt-3 ai-feedback-screen"><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_AI_RESULT'); ?>:</strong><br><?php echo nl2br(htmlspecialchars((string) $answer['ai_feedback'], ENT_QUOTES, 'UTF-8')); ?></div>
|
|
|
|
<div class="alert <?php echo $aiAlertClass; ?> mt-3 ai-feedback-screen" data-question-id="<?php echo (int) $questionId; ?>"><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_AI_RESULT'); ?>:</strong><br><span class="ai-feedback-text"><?php echo nl2br(htmlspecialchars((string) $answer['ai_feedback'], ENT_QUOTES, 'UTF-8')); ?></span></div>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php if ($question->question_type === 'open' && $hasResponse) : ?>
|
|
|
|
<?php if ($question->question_type === 'open' && $hasResponse) : ?>
|
|
|
|