From 8b28a5fd4438dbd1a9280d6f6f69611d8b1e3953 Mon Sep 17 00:00:00 2001 From: Wojtek Date: Fri, 16 Oct 2026 21:23:43 +0200 Subject: [PATCH] Show images in saved test details --- README.md | 2 +- .../sql/updates/mysql/1.43.21.sql | 1 + .../com_testquestions/src/Model/ResultModel.php | 4 ++-- .../com_testquestions/tmpl/result/default.php | 14 ++++++++++++++ com_testquestions.xml | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 administrator/components/com_testquestions/sql/updates/mysql/1.43.21.sql diff --git a/README.md b/README.md index 5f37be9..59ae10b 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.43.20). +W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.21). Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.43.21.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.43.21.sql new file mode 100644 index 0000000..802f4c1 --- /dev/null +++ b/administrator/components/com_testquestions/sql/updates/mysql/1.43.21.sql @@ -0,0 +1 @@ +-- Wydanie 1.43.21: naprawiono wyświetlanie obrazów w szczegółach rozwiązanego testu. diff --git a/administrator/components/com_testquestions/src/Model/ResultModel.php b/administrator/components/com_testquestions/src/Model/ResultModel.php index 2b5b84d..e9b8e22 100644 --- a/administrator/components/com_testquestions/src/Model/ResultModel.php +++ b/administrator/components/com_testquestions/src/Model/ResultModel.php @@ -17,7 +17,7 @@ class ResultModel extends BaseDatabaseModel $db = Factory::getContainer()->get('DatabaseDriver'); $item = $db->setQuery( $db->getQuery(true) - ->select(['r.*', 's.title AS set_title', 'sub.title AS subject_title']) + ->select(['r.*', 's.title AS set_title', 's.image AS set_image', 'sub.title AS subject_title']) ->from($db->quoteName('#__testquestions_results', 'r')) ->leftJoin($db->quoteName('#__testquestions_sets', 's') . ' ON s.id = r.set_id') ->leftJoin($db->quoteName('#__testquestions_subjects', 'sub') . ' ON sub.id = s.subject_id') @@ -35,7 +35,7 @@ class ResultModel extends BaseDatabaseModel if ($ids) { $item->questions = $db->setQuery( $db->getQuery(true) - ->select(['id', 'question_type', 'question', 'answer_a', 'answer_b', 'answer_c', 'answer_d', 'answer_open', 'correct_answer', 'points']) + ->select(['id', 'question_type', 'question', 'answer_a', 'answer_b', 'answer_c', 'answer_d', 'answer_open', 'correct_answer', 'points', 'image']) ->from($db->quoteName('#__testquestions_questions')) ->where('id IN (' . implode(',', $ids) . ')') )->loadObjectList('id'); diff --git a/administrator/components/com_testquestions/tmpl/result/default.php b/administrator/components/com_testquestions/tmpl/result/default.php index b7a061e..b6a98f9 100644 --- a/administrator/components/com_testquestions/tmpl/result/default.php +++ b/administrator/components/com_testquestions/tmpl/result/default.php @@ -1,6 +1,18 @@ + +
item->extra_time > 0 ? ' style="background-color: #fff3cd;"' : ''; ?>> @@ -9,6 +21,7 @@
escape(($this->item->subject_title ? $this->item->subject_title . ' — ' : '') . $this->item->set_title); ?>
+ item->set_image)) : ?>
item->correct_count; ?> / item->total_count; ?> (item->percentage, ENT_QUOTES, 'UTF-8'); ?>%)
@@ -61,6 +74,7 @@ item->questions[(int) $questionId] ?? null; if (!$question) continue; ?>
question; ?>
+ image)) : ?>
question_type === 'open') : ?>
:
: answer_open, ENT_QUOTES, 'UTF-8'); ?>
diff --git a/com_testquestions.xml b/com_testquestions.xml index 8e9162c..ce84d55 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.43.20 + 1.43.21 COM_TESTQUESTIONS_DESCRIPTION com_testquestions Komponent\Component\Testquestions