From 463160c0c78913f8503774cb13d63a6ac528c0cc Mon Sep 17 00:00:00 2001 From: Wojtek Date: Thu, 15 Oct 2026 18:12:53 +0200 Subject: [PATCH] Add two-step set test start form --- README.md | 3 +- .../sql/updates/mysql/1.15.0.sql | 1 + com_testquestions.xml | 2 +- .../language/en-GB/com_testquestions.ini | 4 +++ .../src/View/Set/HtmlView.php | 5 +++ .../com_testquestions/tmpl/set/default.php | 31 ++++++++++++++++--- 6 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 administrator/components/com_testquestions/sql/updates/mysql/1.15.0.sql diff --git a/README.md b/README.md index bc7e5e7..767abb2 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych. - przełącznik widoku listy: same pytania albo pytania z odpowiedziami, - frontendowy widok pytań filtrowany po symbolu arkusza egzaminacyjnego, - frontendowy widok testu na podstawie wybranego zestawu pytań, +- dwuetapowe rozpoczęcie testu z loginem użytkownika i możliwością przedłużenia czasu, - pozycję menu „Arkusz egzaminacyjny” z opcjonalnym symbolem arkusza, - listę wyboru dostępnych symboli arkuszy na stronie klienckiej, - możliwość rozwiązania arkusza i wyświetlenia wyniku oraz odpowiedzi poprawnych i zaznaczonych, @@ -25,6 +26,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.14.1). +W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.15.0). Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.15.0.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.15.0.sql new file mode 100644 index 0000000..dd267bc --- /dev/null +++ b/administrator/components/com_testquestions/sql/updates/mysql/1.15.0.sql @@ -0,0 +1 @@ +-- No database changes required for version 1.15.0. diff --git a/com_testquestions.xml b/com_testquestions.xml index 8cf62bf..36d59ce 100644 --- a/com_testquestions.xml +++ b/com_testquestions.xml @@ -4,7 +4,7 @@ 2026-10-14 Komponent GNU General Public License version 2 or later - 1.14.1 + 1.15.0 COM_TESTQUESTIONS_DESCRIPTION com_testquestions Komponent\Component\Testquestions diff --git a/components/com_testquestions/language/en-GB/com_testquestions.ini b/components/com_testquestions/language/en-GB/com_testquestions.ini index 1cddb81..1d17036 100644 --- a/components/com_testquestions/language/en-GB/com_testquestions.ini +++ b/components/com_testquestions/language/en-GB/com_testquestions.ini @@ -21,3 +21,7 @@ COM_TESTQUESTIONS_SET_DURATION="Czas trwania testu" COM_TESTQUESTIONS_SET_NOT_FOUND="Nie znaleziono wybranego zestawu testowego." COM_TESTQUESTIONS_SELECT_SET="Wybierz zestaw pytań" COM_TESTQUESTIONS_SHOW_SET="Pokaż zestaw" +COM_TESTQUESTIONS_PARTICIPANT_NAME="Login lub nazwa użytkownika" +COM_TESTQUESTIONS_EXTRA_TIME="Przedłużenie czasu" +COM_TESTQUESTIONS_START_TEST="Rozpocznij test" +COM_TESTQUESTIONS_SET_START_HINT="Wybierz zestaw, wpisz login lub nazwę użytkownika i zatwierdź rozpoczęcie testu." diff --git a/components/com_testquestions/src/View/Set/HtmlView.php b/components/com_testquestions/src/View/Set/HtmlView.php index a75cc82..45a5774 100644 --- a/components/com_testquestions/src/View/Set/HtmlView.php +++ b/components/com_testquestions/src/View/Set/HtmlView.php @@ -13,6 +13,7 @@ class HtmlView extends BaseHtmlView protected $items; protected $sets; protected $results; + protected $started; public function display($tpl = null) { @@ -23,6 +24,10 @@ class HtmlView extends BaseHtmlView $this->set = $this->get('Set'); $this->items = $this->get('Items'); $this->sets = $this->get('Sets'); + $input = Factory::getApplication()->getInput(); + $this->started = $input->getMethod() === 'POST' + && $input->post->getString('participant_name', '') !== '' + && $input->post->getInt('set_id', 0) > 0; $this->results = $this->buildResults($this->items); return parent::display($tpl); diff --git a/components/com_testquestions/tmpl/set/default.php b/components/com_testquestions/tmpl/set/default.php index 18180f3..debb0e0 100644 --- a/components/com_testquestions/tmpl/set/default.php +++ b/components/com_testquestions/tmpl/set/default.php @@ -1,9 +1,12 @@
-
+ started) : ?> +
-
+
+ + +
+
+ + +
+
- set) : ?> + + started) : ?> + set && $this->sets) : ?>
+ set) : ?>
set->subject_title) : ?>
set->subject_title, ENT_QUOTES, 'UTF-8'); ?>

set->title, ENT_QUOTES, 'UTF-8'); ?>

- set->duration > 0) : ?>
: set->duration; ?> min
+ getInput()->post->getInt('extra_time', 0); ?> + set->duration > 0) : ?>
: set->duration + $extraTime; ?> min
set->image) : ?>
set->test_content) : ?>
set->test_content; ?>
@@ -59,6 +80,8 @@ defined('_JEXEC') or die; + +