|
|
@@ -32,9 +32,13 @@ $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; }
|
|
|
|
.container-fluid .result-pdf-comment { display: block !important; }
|
|
|
|
.container-fluid .result-pdf-comment.has-print-comment { display: block !important; }
|
|
|
|
.result-pdf-comment-text { white-space: pre-wrap; }
|
|
|
|
.result-pdf-comment-text { white-space: pre-wrap; }
|
|
|
|
.ai-feedback-screen, .ai-token-info { display: none !important; }
|
|
|
|
.ai-token-info { display: none !important; }
|
|
|
|
|
|
|
|
.ai-feedback-screen.ai-feedback-print-source { display: block !important; }
|
|
|
|
|
|
|
|
.ai-feedback-screen.ai-feedback-print-source.print-ai-hidden { display: none !important; }
|
|
|
|
|
|
|
|
.ai-feedback-screen.ai-feedback-print-source > strong { display: none !important; }
|
|
|
|
|
|
|
|
.ai-feedback-screen.ai-feedback-print-source::before { content: "Komentarz:"; display: block; font-weight: bold; margin-bottom: .35em; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
@@ -46,12 +50,17 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
window.addEventListener('beforeprint', function () {
|
|
|
|
window.addEventListener('beforeprint', function () {
|
|
|
|
document.querySelectorAll('.result-pdf-comment').forEach(function (commentBlock) {
|
|
|
|
document.querySelectorAll('.result-pdf-comment').forEach(function (commentBlock) {
|
|
|
|
const questionId = commentBlock.dataset.questionId;
|
|
|
|
const questionId = commentBlock.dataset.questionId;
|
|
|
|
const manualComment = document.getElementById('result-comment-' + questionId)?.value.trim() || '';
|
|
|
|
let manualComment = document.getElementById('result-comment-' + questionId)?.value.trim() || '';
|
|
|
|
const aiComment = commentBlock.dataset.aiComment || '';
|
|
|
|
if (manualComment === '-' || manualComment === '—') {
|
|
|
|
|
|
|
|
manualComment = '';
|
|
|
|
|
|
|
|
}
|
|
|
|
const output = commentBlock.querySelector('.result-pdf-comment-text');
|
|
|
|
const output = commentBlock.querySelector('.result-pdf-comment-text');
|
|
|
|
|
|
|
|
const aiSource = document.querySelector('.ai-feedback-print-source[data-question-id="' + questionId + '"]');
|
|
|
|
|
|
|
|
|
|
|
|
if (output) {
|
|
|
|
commentBlock.classList.toggle('has-print-comment', Boolean(manualComment));
|
|
|
|
output.textContent = manualComment || aiComment || '—';
|
|
|
|
aiSource?.classList.toggle('print-ai-hidden', Boolean(manualComment));
|
|
|
|
|
|
|
|
if (output && manualComment) {
|
|
|
|
|
|
|
|
output.textContent = manualComment;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
@@ -129,8 +138,9 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
$answerStatusPartial = $awardedPoints > 0 && !$answerStatusCorrect;
|
|
|
|
$answerStatusPartial = $awardedPoints > 0 && !$answerStatusCorrect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$manualComment = trim((string) ($answer['comment'] ?? ''));
|
|
|
|
$manualComment = trim((string) ($answer['comment'] ?? ''));
|
|
|
|
$aiComment = trim((string) ($answer['ai_feedback'] ?? ''));
|
|
|
|
if ($manualComment === '-' || $manualComment === '—') {
|
|
|
|
$printComment = $manualComment !== '' ? $manualComment : $aiComment;
|
|
|
|
$manualComment = '';
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|
<article class="mb-4 border rounded p-3">
|
|
|
|
<article class="mb-4 border rounded p-3">
|
|
|
|
<div class="mb-2"><?php echo $question->question; ?></div>
|
|
|
|
<div class="mb-2"><?php echo $question->question; ?></div>
|
|
|
@@ -143,9 +153,9 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
<?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 ($question->question_type === 'open') : ?>
|
|
|
|
<?php if ($question->question_type === 'open') : ?>
|
|
|
|
<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'); ?>">
|
|
|
|
<div class="result-pdf-comment mt-3" data-question-id="<?php echo (int) $questionId; ?>">
|
|
|
|
<strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_COMMENT'); ?>:</strong><br>
|
|
|
|
<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>
|
|
|
|
<span class="result-pdf-comment-text"><?php echo htmlspecialchars($manualComment, ENT_QUOTES, 'UTF-8'); ?></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php if (empty($answer['correct'])) : ?>
|
|
|
|
<?php if (empty($answer['correct'])) : ?>
|
|
|
@@ -172,11 +182,11 @@ $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 ai-feedback-print-source" 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) : ?>
|
|
|
|
<div class="row mt-3">
|
|
|
|
<div class="row mt-3 no-print">
|
|
|
|
<div class="col-md-3">
|
|
|
|
<div class="col-md-3">
|
|
|
|
<label for="awarded-points-<?php echo (int) $questionId; ?>" class="form-label"><?php echo \Joomla\CMS\Language\Text::sprintf('COM_TESTQUESTIONS_RESULT_AWARDED_POINTS', (int) ($question->points ?? 0)); ?></label>
|
|
|
|
<label for="awarded-points-<?php echo (int) $questionId; ?>" class="form-label"><?php echo \Joomla\CMS\Language\Text::sprintf('COM_TESTQUESTIONS_RESULT_AWARDED_POINTS', (int) ($question->points ?? 0)); ?></label>
|
|
|
|
<input type="number" min="0" max="<?php echo (int) ($question->points ?? 0); ?>" name="awarded_points[<?php echo (int) $questionId; ?>]" id="awarded-points-<?php echo (int) $questionId; ?>" class="form-control" value="<?php echo (int) ($answer['awarded_points'] ?? 0); ?>">
|
|
|
|
<input type="number" min="0" max="<?php echo (int) ($question->points ?? 0); ?>" name="awarded_points[<?php echo (int) $questionId; ?>]" id="awarded-points-<?php echo (int) $questionId; ?>" class="form-control" value="<?php echo (int) ($answer['awarded_points'] ?? 0); ?>">
|
|
|
|