From 54c4c56469f3412ba1f91925a7674cd6bdaae991 Mon Sep 17 00:00:00 2001 From: Wojtek Date: Thu, 15 Oct 2026 18:05:11 +0200 Subject: [PATCH] Match set frontend to exam view --- README.md | 2 +- .../com_testquestions/sql/updates/mysql/1.14.1.sql | 1 + com_testquestions.xml | 2 +- .../language/en-GB/com_testquestions.ini | 2 ++ .../com_testquestions/src/Model/SetModel.php | 14 ++++++++++++++ .../com_testquestions/src/View/Set/HtmlView.php | 6 ++++++ components/com_testquestions/tmpl/set/default.php | 12 ++++++++++++ 7 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 administrator/components/com_testquestions/sql/updates/mysql/1.14.1.sql diff --git a/README.md b/README.md index 835cf28..bc7e5e7 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,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.0). +W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.14.1). Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.14.1.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.14.1.sql new file mode 100644 index 0000000..3876e7a --- /dev/null +++ b/administrator/components/com_testquestions/sql/updates/mysql/1.14.1.sql @@ -0,0 +1 @@ +-- No database changes required for version 1.14.1. diff --git a/com_testquestions.xml b/com_testquestions.xml index 036f9a4..8cf62bf 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.0 + 1.14.1 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 7edce07..1cddb81 100644 --- a/components/com_testquestions/language/en-GB/com_testquestions.ini +++ b/components/com_testquestions/language/en-GB/com_testquestions.ini @@ -19,3 +19,5 @@ COM_TESTQUESTIONS_MENU_TEST_SYMBOL_DESC="Opcjonalnie wybierz symbol arkusza, kt COM_TESTQUESTIONS_ENTER_ANSWER="Wpisz odpowiedź" 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" diff --git a/components/com_testquestions/src/Model/SetModel.php b/components/com_testquestions/src/Model/SetModel.php index 8d549ab..8fdca1b 100644 --- a/components/com_testquestions/src/Model/SetModel.php +++ b/components/com_testquestions/src/Model/SetModel.php @@ -56,4 +56,18 @@ class SetModel extends BaseDatabaseModel ->order('sq.ordering ASC, q.id ASC') )->loadObjectList(); } + + public function getSets() + { + $db = Factory::getContainer()->get('DatabaseDriver'); + + return $db->setQuery( + $db->getQuery(true) + ->select(['s.id', 's.title', 'sub.title AS subject_title']) + ->from($db->quoteName('#__testquestions_sets', 's')) + ->leftJoin($db->quoteName('#__testquestions_subjects', 'sub') . ' ON sub.id = s.subject_id') + ->where('s.published = 1') + ->order('sub.title ASC, s.title ASC') + )->loadObjectList(); + } } diff --git a/components/com_testquestions/src/View/Set/HtmlView.php b/components/com_testquestions/src/View/Set/HtmlView.php index 8061646..a75cc82 100644 --- a/components/com_testquestions/src/View/Set/HtmlView.php +++ b/components/com_testquestions/src/View/Set/HtmlView.php @@ -11,12 +11,18 @@ class HtmlView extends BaseHtmlView { protected $set; protected $items; + protected $sets; protected $results; public function display($tpl = null) { + $this->getDocument()->getWebAssetManager()->registerAndUseStyle( + 'com_testquestions.exam', + 'media/com_testquestions/egzamin.css' + ); $this->set = $this->get('Set'); $this->items = $this->get('Items'); + $this->sets = $this->get('Sets'); $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 ecfb635..18180f3 100644 --- a/components/com_testquestions/tmpl/set/default.php +++ b/components/com_testquestions/tmpl/set/default.php @@ -3,6 +3,18 @@ defined('_JEXEC') or die; ?>
+
+ +
+ + +
+
set) : ?>