From 5e12e8838dfa14b671f3a5e7d23af245519a6ea2 Mon Sep 17 00:00:00 2001 From: Wojtek Date: Fri, 16 Oct 2026 11:27:37 +0200 Subject: [PATCH] Add ordinary set ordering and random frontend questions --- README.md | 2 +- .../language/en-GB/com_testquestions.ini | 1 + .../sql/updates/mysql/1.40.0.sql | 1 + .../com_testquestions/tmpl/set/edit.php | 54 +++++++++++++++++-- com_testquestions.xml | 2 +- .../com_testquestions/src/Model/SetModel.php | 2 +- 6 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 administrator/components/com_testquestions/sql/updates/mysql/1.40.0.sql diff --git a/README.md b/README.md index c3c8da5..187a625 100644 --- a/README.md +++ b/README.md @@ -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.39.0). +W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.40.0). Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. diff --git a/administrator/components/com_testquestions/language/en-GB/com_testquestions.ini b/administrator/components/com_testquestions/language/en-GB/com_testquestions.ini index 75fdc3a..93aa779 100644 --- a/administrator/components/com_testquestions/language/en-GB/com_testquestions.ini +++ b/administrator/components/com_testquestions/language/en-GB/com_testquestions.ini @@ -58,6 +58,7 @@ COM_TESTQUESTIONS_SET_ADD_VARIANT="Dodaj wariant" COM_TESTQUESTIONS_SET_PARENT="Zestaw nadrzędny" COM_TESTQUESTIONS_SET_NO_VARIANTS="Brak wariantów" COM_TESTQUESTIONS_SET_MULTI_QUESTIONS_INFO="Pytania są dodawane w poszczególnych wariantach zestawu." +COM_TESTQUESTIONS_SET_REORDER_INFO="Przeciągnij pytania, aby zmienić ich kolejność." COM_TESTQUESTIONS_SET_SAVE="Zapisz" COM_TESTQUESTIONS_SET_SAVE_AND_CLOSE="Zapisz i zamknij" COM_TESTQUESTIONS_SET_VARIANT_DURATION_INFO="Czas testu jest pobierany z zestawu nadrzędnego." diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.40.0.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.40.0.sql new file mode 100644 index 0000000..5cf0d5b --- /dev/null +++ b/administrator/components/com_testquestions/sql/updates/mysql/1.40.0.sql @@ -0,0 +1 @@ +-- No database changes required for version 1.40.0. diff --git a/administrator/components/com_testquestions/tmpl/set/edit.php b/administrator/components/com_testquestions/tmpl/set/edit.php index c670476..119169b 100644 --- a/administrator/components/com_testquestions/tmpl/set/edit.php +++ b/administrator/components/com_testquestions/tmpl/set/edit.php @@ -8,6 +8,7 @@ use Joomla\CMS\Router\Route; HTMLHelper::_('behavior.formvalidator'); ?>
+ isVariant && (string) $this->item->set_type === 'ordinary'; ?>
form->renderField('parent_id'); ?> isVariant) : ?> @@ -51,10 +52,14 @@ HTMLHelper::_('behavior.formvalidator'); item->set_type === 'multi' && (int) $this->item->parent_id === 0)) : ?>
-
- questions as $question) : ?> - id, array_map('intval', (array) $this->item->question_ids), true)) continue; ?> -
+ +
+ +
+ questions as $availableQuestion) : $questionsById[(int) $availableQuestion->id] = $availableQuestion; endforeach; ?> + item->question_ids as $selectedQuestionId) : ?> + +
>