Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14f2eec18d | ||
|
|
2bc1b30704 | ||
|
|
c9ba3df1f3 | ||
|
|
d0989e78d1 |
@@ -30,6 +30,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych.
|
||||
|
||||
## Instalacja
|
||||
|
||||
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.31).
|
||||
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.35).
|
||||
|
||||
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
|
||||
|
||||
@@ -130,6 +130,8 @@ COM_TESTQUESTIONS_RESULTS_AI_TOKENS_TOTAL="Łączne wykorzystanie tokenów w wyn
|
||||
COM_TESTQUESTIONS_RESULT_SCORE="Wynik"
|
||||
COM_TESTQUESTIONS_RESULT_POINTS_BEFORE_AFTER="Punkty przed / po korekcie"
|
||||
COM_TESTQUESTIONS_RESULT_GRADE="Ocena"
|
||||
COM_TESTQUESTIONS_RESULT_NOT_ASSESSED="Nie sprawdzono"
|
||||
COM_TESTQUESTIONS_RESULT_GENERATE_PDF="Generuj PDF / drukuj"
|
||||
COM_TESTQUESTIONS_RESULT_DATE="Data zakończenia"
|
||||
COM_TESTQUESTIONS_RESULT_ANSWERS="Odpowiedzi"
|
||||
COM_TESTQUESTIONS_RESULT_EXECUTION_TIME="Czas wykonania"
|
||||
@@ -149,6 +151,7 @@ COM_TESTQUESTIONS_YOUR_ANSWER="Twoja odpowiedź"
|
||||
COM_TESTQUESTIONS_SELECTED_ANSWER="Zaznaczona odpowiedź"
|
||||
COM_TESTQUESTIONS_ANSWER_CORRECT="Poprawna odpowiedź"
|
||||
COM_TESTQUESTIONS_ANSWER_INCORRECT="Niepoprawna odpowiedź"
|
||||
COM_TESTQUESTIONS_ANSWER_PARTIALLY_CORRECT="Odpowiedź częściowo poprawna"
|
||||
COM_TESTQUESTIONS_CORRECT_PATTERN="Wzorzec poprawnej odpowiedzi"
|
||||
COM_TESTQUESTIONS_SUBJECT="Przedmiot"
|
||||
COM_TESTQUESTIONS_SUBJECT_TITLE="Nazwa przedmiotu"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
-- Brak zmian w schemacie bazy danych w wersji 1.43.32.
|
||||
@@ -0,0 +1 @@
|
||||
-- Brak zmian w schemacie bazy danych w wersji 1.43.33.
|
||||
@@ -0,0 +1 @@
|
||||
-- Brak zmian w schemacie bazy danych w wersji 1.43.34.
|
||||
@@ -0,0 +1 @@
|
||||
-- Brak zmian w schemacie bazy danych w wersji 1.43.35.
|
||||
@@ -14,6 +14,7 @@ class ResultsModel extends ListModel
|
||||
$items = parent::getItems();
|
||||
|
||||
foreach ($items as $item) {
|
||||
$item->has_assessment = false;
|
||||
$item->ai_input_tokens = 0;
|
||||
$item->ai_output_tokens = 0;
|
||||
$item->ai_total_tokens = 0;
|
||||
@@ -30,6 +31,11 @@ class ResultsModel extends ListModel
|
||||
continue;
|
||||
}
|
||||
|
||||
// Manual assessment and AI both save awarded_points in the answer JSON.
|
||||
if (array_key_exists('awarded_points', $answer)) {
|
||||
$item->has_assessment = true;
|
||||
}
|
||||
|
||||
$usages = $answer['ai_usage_history'] ?? (isset($answer['ai_usage']) ? [$answer['ai_usage']] : []);
|
||||
if (!is_array($usages)) {
|
||||
continue;
|
||||
|
||||
@@ -20,10 +20,10 @@ $resolveImageUrl = static function ($path) {
|
||||
<?php if ($this->set) : ?>
|
||||
<header class="test-set-header">
|
||||
<h1><?php echo htmlspecialchars($this->set->title, ENT_QUOTES, 'UTF-8'); ?></h1>
|
||||
<?php if ($this->set->test_content) : ?><div class="test-set-content"><?php echo $this->set->test_content; ?></div><?php endif; ?>
|
||||
<?php if ($this->set->image) : ?>
|
||||
<div class="foto_pyt"><img src="<?php echo htmlspecialchars($resolveImageUrl($this->set->image), ENT_QUOTES, 'UTF-8'); ?>" alt="" loading="lazy"></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->set->test_content) : ?><div class="test-set-content"><?php echo $this->set->test_content; ?></div><?php endif; ?>
|
||||
</header>
|
||||
<?php endif; ?>
|
||||
<?php if (!$this->items) : ?>
|
||||
|
||||
@@ -14,6 +14,32 @@ $resolveImageUrl = static function ($path) {
|
||||
};
|
||||
?>
|
||||
<div class="container-fluid">
|
||||
<div class="mb-3 no-print">
|
||||
<button type="button" class="btn btn-outline-secondary" id="result-pdf-button">
|
||||
<span class="icon-print" aria-hidden="true"></span>
|
||||
<?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_GENERATE_PDF'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<style>
|
||||
@media print {
|
||||
@page { size: A4; margin: 15mm; }
|
||||
.no-print, .toolbar, #toolbar, .subhead, .sidebar-wrapper, #sidebar, .navbar,
|
||||
#system-message-container, #adminForm input, #adminForm textarea,
|
||||
#adminForm select, #adminForm button { display: none !important; }
|
||||
body, .container-main, .container-fluid { background: #fff !important; width: 100% !important; margin: 0 !important; padding: 0 !important; }
|
||||
.container-fluid { max-width: none !important; }
|
||||
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; }
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('result-pdf-button')?.addEventListener('click', function () {
|
||||
window.print();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<dl class="row">
|
||||
<div class="row"<?php echo (int) $this->item->extra_time > 0 ? ' style="background-color: #fff3cd;"' : ''; ?>>
|
||||
<dt class="col-sm-3"><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_PARTICIPANT'); ?></dt>
|
||||
@@ -77,6 +103,16 @@ $resolveImageUrl = static function ($path) {
|
||||
<?php foreach ($this->item->answers as $questionId => $answer) : ?>
|
||||
<?php $question = $this->item->questions[(int) $questionId] ?? null; if (!$question) continue; ?>
|
||||
<?php $hasResponse = trim((string) ($answer['selected'] ?? '')) !== ''; ?>
|
||||
<?php
|
||||
$answerStatusCorrect = !empty($answer['correct']);
|
||||
$answerStatusPartial = false;
|
||||
if ($question->question_type === 'open' && array_key_exists('awarded_points', $answer)) {
|
||||
$awardedPoints = (int) $answer['awarded_points'];
|
||||
$maximumPoints = (int) ($question->points ?? 0);
|
||||
$answerStatusCorrect = $awardedPoints > 0 && $awardedPoints >= $maximumPoints;
|
||||
$answerStatusPartial = $awardedPoints > 0 && !$answerStatusCorrect;
|
||||
}
|
||||
?>
|
||||
<article class="mb-4 border rounded p-3">
|
||||
<div class="mb-2"><?php echo $question->question; ?></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; ?>
|
||||
@@ -86,7 +122,7 @@ $resolveImageUrl = static function ($path) {
|
||||
<?php else : ?>
|
||||
<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; ?>
|
||||
<div class="mt-2 <?php echo !empty($answer['correct']) ? 'text-success' : 'text-danger'; ?>"><?php echo !empty($answer['correct']) ? '✓ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_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 (empty($answer['correct'])) : ?>
|
||||
<?php if ($question->question_type === 'open' && $hasResponse) : ?>
|
||||
<div class="mt-3">
|
||||
|
||||
@@ -84,12 +84,14 @@ HTMLHelper::_('behavior.multiselect');
|
||||
<?php $pointsTotal = (int) $item->points_total ?: (int) $item->total_count; ?>
|
||||
<?php $pointsBeforePercentage = $pointsTotal ? round(((int) $item->points_before / $pointsTotal) * 100, 2) : 0; ?>
|
||||
<?php $pointsAfterPercentage = $pointsTotal ? round(((int) $item->points_after / $pointsTotal) * 100, 2) : 0; ?>
|
||||
<?php if ($item->has_assessment) : ?>
|
||||
<?php $grade = 'NDST'; ?>
|
||||
<?php foreach ([['CEL', 100], ['BDB', 90], ['BDB-', 80], ['DB+', 75], ['DB', 70], ['DB-', 65], ['DST+', 60], ['DST', 55], ['DST-', 50], ['DOP+', 45], ['DOP', 40], ['DOP-', 35], ['NDST+', 30], ['NDST', 0]] as $gradeScale) : ?>
|
||||
<?php if ($pointsAfterPercentage >= $gradeScale[1]) { $grade = $gradeScale[0]; break; } ?>
|
||||
<?php endforeach; ?>
|
||||
<td><?php echo (int) $item->points_before; ?> (<?php echo $pointsBeforePercentage; ?>%) / <?php echo (int) $item->points_after; ?> (<?php echo $pointsAfterPercentage; ?>%)</td>
|
||||
<td><?php echo $this->escape($grade); ?></td>
|
||||
<?php endif; ?>
|
||||
<td><?php echo (int) $item->points_before; ?> (<?php echo $pointsBeforePercentage; ?>%) / <?php if ($item->has_assessment) : ?><?php echo (int) $item->points_after; ?> (<?php echo $pointsAfterPercentage; ?>%)<?php else : ?><span class="text-muted"><?php echo $this->escape(\Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_NOT_ASSESSED')); ?></span><?php endif; ?></td>
|
||||
<td><?php echo $item->has_assessment ? $this->escape($grade) : '<span class="text-muted">' . $this->escape(\Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_NOT_ASSESSED')) . '</span>'; ?></td>
|
||||
<td><?php echo floor((int) $item->execution_time / 60); ?>:<?php echo str_pad((string) ((int) $item->execution_time % 60), 2, '0', STR_PAD_LEFT); ?></td>
|
||||
<td><?php echo HTMLHelper::_('date', $item->created, 'Y-m-d H:i'); ?></td>
|
||||
<td>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<creationDate>2026-10-14</creationDate>
|
||||
<author>Komponent</author>
|
||||
<license>GNU General Public License version 2 or later</license>
|
||||
<version>1.43.31</version>
|
||||
<version>1.43.35</version>
|
||||
<description>COM_TESTQUESTIONS_DESCRIPTION</description>
|
||||
<element>com_testquestions</element>
|
||||
<namespace path="src">Komponent\Component\Testquestions</namespace>
|
||||
|
||||
Reference in New Issue
Block a user