Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e034b68e6 | ||
|
|
d09360e587 |
@@ -23,6 +23,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.9.1).
|
||||
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.9.3).
|
||||
|
||||
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
|
||||
|
||||
@@ -56,3 +56,4 @@ COM_TESTQUESTIONS_SET_SEARCH="Szukaj zestawów..."
|
||||
COM_TESTQUESTIONS_SET_CATEGORY_FILTER="Filtruj pytania według kategorii"
|
||||
COM_TESTQUESTIONS_SET_ALL_CATEGORIES="Wszystkie kategorie"
|
||||
COM_TESTQUESTIONS_UNCATEGORIZED="Bez kategorii"
|
||||
COM_TESTQUESTIONS_SET_SHOW_DETAILS="Pokaż pytanie i odpowiedzi"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
-- No database changes required for version 1.9.2.
|
||||
@@ -0,0 +1 @@
|
||||
-- No database changes required for version 1.9.3.
|
||||
@@ -50,7 +50,7 @@ class SetModel extends AdminModel
|
||||
|
||||
return $db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->select(['q.id', 'q.question', 'q.category_id', 'c.title AS category_title'])
|
||||
->select(['q.id', 'q.question', 'q.question_type', 'q.answer_a', 'q.answer_b', 'q.answer_c', 'q.answer_d', 'q.answer_open', 'q.correct_answer', 'q.category_id', 'c.title AS category_title'])
|
||||
->from($db->quoteName('#__testquestions_questions', 'q'))
|
||||
->leftJoin($db->quoteName('#__testquestions_categories', 'c') . ' ON c.id = q.category_id')
|
||||
->order('c.title ASC, q.ordering ASC, q.id ASC')
|
||||
@@ -71,7 +71,8 @@ class SetModel extends AdminModel
|
||||
|
||||
public function save($data)
|
||||
{
|
||||
$questionIds = array_values(array_unique(array_filter(array_map('intval', (array) ($data['question_ids'] ?? [])))));
|
||||
$formData = Factory::getApplication()->getInput()->post->get('jform', [], 'array');
|
||||
$questionIds = array_values(array_unique(array_filter(array_map('intval', (array) ($formData['question_ids'] ?? $data['question_ids'] ?? [])))));
|
||||
unset($data['question_ids']);
|
||||
|
||||
if (!parent::save($data)) {
|
||||
|
||||
@@ -31,6 +31,19 @@ HTMLHelper::_('behavior.formvalidator');
|
||||
<span class="badge bg-secondary"><?php echo $this->escape($question->category_title ?: \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_UNCATEGORIZED')); ?></span>
|
||||
<?php echo $this->escape(trim(strip_tags($question->question))); ?>
|
||||
</label>
|
||||
<details class="ms-4 mt-1 mb-2">
|
||||
<summary><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SET_SHOW_DETAILS'); ?></summary>
|
||||
<div class="mt-2 p-2 bg-light border rounded">
|
||||
<?php if ($question->question_type === 'open') : ?>
|
||||
<div><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_FIELD_OPEN_PATTERN'); ?>:</strong> <?php echo $this->escape($question->answer_open); ?></div>
|
||||
<?php else : ?>
|
||||
<div><strong>A:</strong> <?php echo $question->answer_a; ?><?php echo (int) $question->correct_answer === 1 ? ' ✓' : ''; ?></div>
|
||||
<div><strong>B:</strong> <?php echo $question->answer_b; ?><?php echo (int) $question->correct_answer === 2 ? ' ✓' : ''; ?></div>
|
||||
<div><strong>C:</strong> <?php echo $question->answer_c; ?><?php echo (int) $question->correct_answer === 3 ? ' ✓' : ''; ?></div>
|
||||
<div><strong>D:</strong> <?php echo $question->answer_d; ?><?php echo (int) $question->correct_answer === 4 ? ' ✓' : ''; ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<creationDate>2026-10-14</creationDate>
|
||||
<author>Komponent</author>
|
||||
<license>GNU General Public License version 2 or later</license>
|
||||
<version>1.9.1</version>
|
||||
<version>1.9.3</version>
|
||||
<description>COM_TESTQUESTIONS_DESCRIPTION</description>
|
||||
<element>com_testquestions</element>
|
||||
<namespace path="src">Komponent\Component\Testquestions</namespace>
|
||||
|
||||
Reference in New Issue
Block a user