Add PDF print button to result details

This commit is contained in:
Wojtek
2026-10-17 12:46:50 +02:00
parent 2bc1b30704
commit 14f2eec18d
5 changed files with 30 additions and 2 deletions
+1 -1
View File
@@ -30,6 +30,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych.
## Instalacja ## Instalacja
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.34). W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.35).
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
@@ -131,6 +131,7 @@ COM_TESTQUESTIONS_RESULT_SCORE="Wynik"
COM_TESTQUESTIONS_RESULT_POINTS_BEFORE_AFTER="Punkty przed / po korekcie" COM_TESTQUESTIONS_RESULT_POINTS_BEFORE_AFTER="Punkty przed / po korekcie"
COM_TESTQUESTIONS_RESULT_GRADE="Ocena" COM_TESTQUESTIONS_RESULT_GRADE="Ocena"
COM_TESTQUESTIONS_RESULT_NOT_ASSESSED="Nie sprawdzono" COM_TESTQUESTIONS_RESULT_NOT_ASSESSED="Nie sprawdzono"
COM_TESTQUESTIONS_RESULT_GENERATE_PDF="Generuj PDF / drukuj"
COM_TESTQUESTIONS_RESULT_DATE="Data zakończenia" COM_TESTQUESTIONS_RESULT_DATE="Data zakończenia"
COM_TESTQUESTIONS_RESULT_ANSWERS="Odpowiedzi" COM_TESTQUESTIONS_RESULT_ANSWERS="Odpowiedzi"
COM_TESTQUESTIONS_RESULT_EXECUTION_TIME="Czas wykonania" COM_TESTQUESTIONS_RESULT_EXECUTION_TIME="Czas wykonania"
@@ -0,0 +1 @@
-- Brak zmian w schemacie bazy danych w wersji 1.43.35.
@@ -14,6 +14,32 @@ $resolveImageUrl = static function ($path) {
}; };
?> ?>
<div class="container-fluid"> <div class="container-fluid">
<div class="mb-3 no-print">
<button type="button" class="btn btn-outline-secondary" id="result-pdf-button">
<span class="icon-print" aria-hidden="true"></span>
<?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_GENERATE_PDF'); ?>
</button>
</div>
<style>
@media print {
@page { size: A4; margin: 15mm; }
.no-print, .toolbar, #toolbar, .subhead, .sidebar-wrapper, #sidebar, .navbar,
#system-message-container, #adminForm input, #adminForm textarea,
#adminForm select, #adminForm button { display: none !important; }
body, .container-main, .container-fluid { background: #fff !important; width: 100% !important; margin: 0 !important; padding: 0 !important; }
.container-fluid { max-width: none !important; }
article { break-inside: auto; border-color: #aaa !important; }
img { max-width: 100% !important; max-height: 150mm; object-fit: contain; }
.alert { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('result-pdf-button')?.addEventListener('click', function () {
window.print();
});
});
</script>
<dl class="row"> <dl class="row">
<div class="row"<?php echo (int) $this->item->extra_time > 0 ? ' style="background-color: #fff3cd;"' : ''; ?>> <div class="row"<?php echo (int) $this->item->extra_time > 0 ? ' style="background-color: #fff3cd;"' : ''; ?>>
<dt class="col-sm-3"><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_PARTICIPANT'); ?></dt> <dt class="col-sm-3"><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_PARTICIPANT'); ?></dt>
+1 -1
View File
@@ -4,7 +4,7 @@
<creationDate>2026-10-14</creationDate> <creationDate>2026-10-14</creationDate>
<author>Komponent</author> <author>Komponent</author>
<license>GNU General Public License version 2 or later</license> <license>GNU General Public License version 2 or later</license>
<version>1.43.34</version> <version>1.43.35</version>
<description>COM_TESTQUESTIONS_DESCRIPTION</description> <description>COM_TESTQUESTIONS_DESCRIPTION</description>
<element>com_testquestions</element> <element>com_testquestions</element>
<namespace path="src">Komponent\Component\Testquestions</namespace> <namespace path="src">Komponent\Component\Testquestions</namespace>