diff --git a/README.md b/README.md
index dbae1df..5a0431f 100644
--- a/README.md
+++ b/README.md
@@ -21,6 +21,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.6.1).
+W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.6.2).
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.6.2.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.6.2.sql
new file mode 100644
index 0000000..557b94c
--- /dev/null
+++ b/administrator/components/com_testquestions/sql/updates/mysql/1.6.2.sql
@@ -0,0 +1 @@
+-- Display formatted exam sheet labels on the frontend.
diff --git a/com_testquestions.xml b/com_testquestions.xml
index 00025e0..f70ad78 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.6.1
+ 1.6.2
COM_TESTQUESTIONS_DESCRIPTION
com_testquestions
Komponent\Component\Testquestions
diff --git a/components/com_testquestions/src/Model/QuestionsModel.php b/components/com_testquestions/src/Model/QuestionsModel.php
index d8d906e..dd88009 100644
--- a/components/com_testquestions/src/Model/QuestionsModel.php
+++ b/components/com_testquestions/src/Model/QuestionsModel.php
@@ -45,14 +45,16 @@ class QuestionsModel extends ListModel
return $db->setQuery(
$db->getQuery(true)
->select([
- $db->quoteName('test_symbol', 'value'),
- $db->quoteName('test_symbol', 'text'),
+ 'q.' . $db->quoteName('test_symbol'),
+ 'q.' . $db->quoteName('exam_year'),
+ 'c.' . $db->quoteName('title', 'category_title'),
])
- ->from($db->quoteName('#__testquestions_questions'))
- ->where($db->quoteName('published') . ' = 1')
- ->where($db->quoteName('test_symbol') . ' <> ' . $db->quote(''))
- ->group($db->quoteName('test_symbol'))
- ->order($db->quoteName('test_symbol') . ' ASC')
+ ->from($db->quoteName('#__testquestions_questions', 'q'))
+ ->leftJoin($db->quoteName('#__testquestions_categories', 'c') . ' ON c.id = q.category_id')
+ ->where('q.' . $db->quoteName('published') . ' = 1')
+ ->where('q.' . $db->quoteName('test_symbol') . ' <> ' . $db->quote(''))
+ ->group(['q.' . $db->quoteName('test_symbol'), 'q.' . $db->quoteName('exam_year'), 'c.' . $db->quoteName('title')])
+ ->order('q.' . $db->quoteName('exam_year') . ' DESC, q.' . $db->quoteName('test_symbol') . ' ASC')
)->loadObjectList();
}
}
diff --git a/components/com_testquestions/src/View/Questions/HtmlView.php b/components/com_testquestions/src/View/Questions/HtmlView.php
index f5383bc..fa735db 100644
--- a/components/com_testquestions/src/View/Questions/HtmlView.php
+++ b/components/com_testquestions/src/View/Questions/HtmlView.php
@@ -12,6 +12,32 @@ class HtmlView extends BaseHtmlView
protected $symbol;
protected $symbols;
+ public function formatSheetLabel($sheet)
+ {
+ $qualification = (string) ($sheet->category_title ?: '');
+
+ if (preg_match('/^([A-Z]+)(\d+)$/i', $qualification, $matches)) {
+ $qualification = strtoupper($matches[1]) . '.' . $matches[2];
+ }
+
+ $months = [
+ 1 => 'Styczeń', 2 => 'Luty', 3 => 'Marzec', 4 => 'Kwiecień',
+ 5 => 'Maj', 6 => 'Czerwiec', 7 => 'Lipiec', 8 => 'Sierpień',
+ 9 => 'Wrzesień', 10 => 'Październik', 11 => 'Listopad', 12 => 'Grudzień',
+ ];
+ $period = '';
+
+ if (preg_match('/-(\d{2})\.(\d{2})$/', (string) $sheet->test_symbol, $matches)) {
+ $month = (int) $matches[2];
+ $year = (int) $sheet->exam_year ?: 2000 + (int) $matches[1];
+ $period = ($months[$month] ?? '') . ' ' . $year;
+ } elseif ($sheet->exam_year) {
+ $period = (string) $sheet->exam_year;
+ }
+
+ return trim('Kwalifikacja ' . $qualification . ($period ? ' - ' . $period : '') . ' (' . $sheet->test_symbol . ')');
+ }
+
public function display($tpl = null)
{
$this->items = $this->get('Items');
diff --git a/components/com_testquestions/tmpl/questions/default.php b/components/com_testquestions/tmpl/questions/default.php
index 08862eb..f720447 100644
--- a/components/com_testquestions/tmpl/questions/default.php
+++ b/components/com_testquestions/tmpl/questions/default.php
@@ -12,7 +12,7 @@ use Joomla\CMS\HTML\HTMLHelper;