diff --git a/README.md b/README.md index 85ea12d..220a239 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.27.0). +W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.28.0). Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.28.0.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.28.0.sql new file mode 100644 index 0000000..0b24985 --- /dev/null +++ b/administrator/components/com_testquestions/sql/updates/mysql/1.28.0.sql @@ -0,0 +1 @@ +-- No database changes required for version 1.28.0. diff --git a/administrator/components/com_testquestions/src/Controller/ResultController.php b/administrator/components/com_testquestions/src/Controller/ResultController.php index 8dbae16..69f2547 100644 --- a/administrator/components/com_testquestions/src/Controller/ResultController.php +++ b/administrator/components/com_testquestions/src/Controller/ResultController.php @@ -13,6 +13,26 @@ use Joomla\CMS\Session\Session; class ResultController extends BaseController { public function save(): void + { + $this->saveAssessment(); + $id = Factory::getApplication()->getInput()->post->getInt('id'); + + $this->setRedirect( + Route::_('index.php?option=com_testquestions&view=result&id=' . $id, false), + Text::_('COM_TESTQUESTIONS_RESULT_SAVED') + ); + } + + public function save2close(): void + { + $this->saveAssessment(); + $this->setRedirect( + Route::_('index.php?option=com_testquestions&view=results', false), + Text::_('COM_TESTQUESTIONS_RESULT_SAVED') + ); + } + + private function saveAssessment(): void { if (!Session::checkToken()) { throw new \RuntimeException(Text::_('JINVALID_TOKEN'), 403); @@ -27,10 +47,5 @@ class ResultController extends BaseController if (!$model->saveAssessment($id, $points, $comments)) { throw new \RuntimeException(Text::_('COM_TESTQUESTIONS_RESULT_NOT_FOUND')); } - - $this->setRedirect( - Route::_('index.php?option=com_testquestions&view=result&id=' . $id, false), - Text::_('COM_TESTQUESTIONS_RESULT_SAVED') - ); } } diff --git a/administrator/components/com_testquestions/src/View/Result/HtmlView.php b/administrator/components/com_testquestions/src/View/Result/HtmlView.php index ff758ab..f12f400 100644 --- a/administrator/components/com_testquestions/src/View/Result/HtmlView.php +++ b/administrator/components/com_testquestions/src/View/Result/HtmlView.php @@ -22,6 +22,7 @@ class HtmlView extends BaseHtmlView ToolbarHelper::title(Text::_('COM_TESTQUESTIONS_RESULT_PREVIEW')); ToolbarHelper::save('result.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::save2close('result.save2close', 'JTOOLBAR_SAVE_AND_CLOSE'); ToolbarHelper::link('index.php?option=com_testquestions&view=results', 'COM_TESTQUESTIONS_RESULTS', 'back'); return parent::display($tpl); diff --git a/com_testquestions.xml b/com_testquestions.xml index 5374b45..6c2c94e 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.27.0 + 1.28.0 COM_TESTQUESTIONS_DESCRIPTION com_testquestions Komponent\Component\Testquestions