Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d0b6d7798 | ||
|
|
6c23252eef | ||
|
|
1e14949574 | ||
|
|
5e259cd5c7 |
@@ -30,6 +30,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych.
|
|||||||
|
|
||||||
## Instalacja
|
## Instalacja
|
||||||
|
|
||||||
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.22.0).
|
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.26.0).
|
||||||
|
|
||||||
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
|
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ COM_TESTQUESTIONS_RESULT_POINTS_BEFORE_AFTER="Punkty przed / po korekcie"
|
|||||||
COM_TESTQUESTIONS_RESULT_DATE="Data zakończenia"
|
COM_TESTQUESTIONS_RESULT_DATE="Data zakończenia"
|
||||||
COM_TESTQUESTIONS_RESULT_ANSWERS="Odpowiedzi"
|
COM_TESTQUESTIONS_RESULT_ANSWERS="Odpowiedzi"
|
||||||
COM_TESTQUESTIONS_RESULT_EXECUTION_TIME="Czas wykonania"
|
COM_TESTQUESTIONS_RESULT_EXECUTION_TIME="Czas wykonania"
|
||||||
COM_TESTQUESTIONS_RESULT_AWARDED_POINTS="Uznane punkty"
|
COM_TESTQUESTIONS_RESULT_AWARDED_POINTS="Uznane punkty (maksymalnie %s)"
|
||||||
COM_TESTQUESTIONS_RESULT_COMMENT="Komentarz"
|
COM_TESTQUESTIONS_RESULT_COMMENT="Komentarz"
|
||||||
COM_TESTQUESTIONS_RESULT_SAVED="Dane wyniku zostały zapisane."
|
COM_TESTQUESTIONS_RESULT_SAVED="Dane wyniku zostały zapisane."
|
||||||
COM_TESTQUESTIONS_RESULTS_SEARCH="Szukaj po użytkowniku lub zestawie..."
|
COM_TESTQUESTIONS_RESULTS_SEARCH="Szukaj po użytkowniku lub zestawie..."
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
-- No database changes required for version 1.23.0.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
-- No database changes required for version 1.24.0.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
-- No database changes required for version 1.25.0.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
-- No database changes required for version 1.26.0.
|
||||||
@@ -52,7 +52,8 @@ class ResultModel extends BaseDatabaseModel
|
|||||||
|
|
||||||
foreach ($item->answers as $questionId => &$answer) {
|
foreach ($item->answers as $questionId => &$answer) {
|
||||||
$key = (string) $questionId;
|
$key = (string) $questionId;
|
||||||
$answer['awarded_points'] = max(0, (int) ($awardedPoints[$key] ?? 0));
|
$maxPoints = (int) ($item->questions[(int) $questionId]->points ?? 0);
|
||||||
|
$answer['awarded_points'] = min($maxPoints, max(0, (int) ($awardedPoints[$key] ?? 0)));
|
||||||
$answer['comment'] = trim((string) ($comments[$key] ?? ''));
|
$answer['comment'] = trim((string) ($comments[$key] ?? ''));
|
||||||
}
|
}
|
||||||
unset($answer);
|
unset($answer);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
<form action="<?php echo Route::_('index.php?option=com_testquestions&view=result&id=' . (int) $this->item->id); ?>" method="post" name="resultForm" id="result-form">
|
<form action="<?php echo Route::_('index.php?option=com_testquestions&view=result&id=' . (int) $this->item->id); ?>" method="post" name="resultForm" id="result-form">
|
||||||
<h2><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_ANSWERS'); ?></h2>
|
<h2><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_ANSWERS'); ?></h2>
|
||||||
|
<button type="submit" class="btn btn-primary mb-3"><?php echo \Joomla\CMS\Language\Text::_('JSAVE'); ?></button>
|
||||||
<?php foreach ($this->item->answers as $questionId => $answer) : ?>
|
<?php foreach ($this->item->answers as $questionId => $answer) : ?>
|
||||||
<?php $question = $this->item->questions[(int) $questionId] ?? null; if (!$question) continue; ?>
|
<?php $question = $this->item->questions[(int) $questionId] ?? null; if (!$question) continue; ?>
|
||||||
<article class="mb-4 border rounded p-3">
|
<article class="mb-4 border rounded p-3">
|
||||||
@@ -27,22 +28,22 @@
|
|||||||
<div><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_CORRECT_PATTERN'); ?>:</strong> <?php echo htmlspecialchars($question->answer_open, ENT_QUOTES, 'UTF-8'); ?></div>
|
<div><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_CORRECT_PATTERN'); ?>:</strong> <?php echo htmlspecialchars($question->answer_open, ENT_QUOTES, 'UTF-8'); ?></div>
|
||||||
<?php else : ?>
|
<?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>
|
<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_CORRECT_ANSWER'); ?>:</strong> <?php echo chr(64 + (int) $question->correct_answer); ?></div>
|
|
||||||
<?php endif; ?>
|
<?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 !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>
|
||||||
|
<?php if (empty($answer['correct'])) : ?>
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
<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::_('COM_TESTQUESTIONS_RESULT_AWARDED_POINTS'); ?></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" 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); ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<label for="result-comment-<?php echo (int) $questionId; ?>" class="form-label"><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_COMMENT'); ?></label>
|
<label for="result-comment-<?php echo (int) $questionId; ?>" class="form-label"><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_COMMENT'); ?></label>
|
||||||
<textarea name="comments[<?php echo (int) $questionId; ?>]" id="result-comment-<?php echo (int) $questionId; ?>" class="form-control" rows="2"><?php echo htmlspecialchars((string) ($answer['comment'] ?? ''), ENT_QUOTES, 'UTF-8'); ?></textarea>
|
<textarea name="comments[<?php echo (int) $questionId; ?>]" id="result-comment-<?php echo (int) $questionId; ?>" class="form-control" rows="2"><?php echo htmlspecialchars((string) ($answer['comment'] ?? ''), ENT_QUOTES, 'UTF-8'); ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</article>
|
</article>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<button type="submit" class="btn btn-primary"><?php echo \Joomla\CMS\Language\Text::_('JSAVE'); ?></button>
|
|
||||||
<input type="hidden" name="task" value="result.save">
|
<input type="hidden" name="task" value="result.save">
|
||||||
<input type="hidden" name="id" value="<?php echo (int) $this->item->id; ?>">
|
<input type="hidden" name="id" value="<?php echo (int) $this->item->id; ?>">
|
||||||
<?php echo HTMLHelper::_('form.token'); ?>
|
<?php echo HTMLHelper::_('form.token'); ?>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<creationDate>2026-10-14</creationDate>
|
<creationDate>2026-10-14</creationDate>
|
||||||
<author>Komponent</author>
|
<author>Komponent</author>
|
||||||
<license>GNU General Public License version 2 or later</license>
|
<license>GNU General Public License version 2 or later</license>
|
||||||
<version>1.22.0</version>
|
<version>1.26.0</version>
|
||||||
<description>COM_TESTQUESTIONS_DESCRIPTION</description>
|
<description>COM_TESTQUESTIONS_DESCRIPTION</description>
|
||||||
<element>com_testquestions</element>
|
<element>com_testquestions</element>
|
||||||
<namespace path="src">Komponent\Component\Testquestions</namespace>
|
<namespace path="src">Komponent\Component\Testquestions</namespace>
|
||||||
|
|||||||
Reference in New Issue
Block a user