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); } $input = Factory::getApplication()->getInput(); $id = $input->post->getInt('id'); $points = (array) $input->post->get('awarded_points', [], 'array'); $comments = (array) $input->post->get('comments', [], 'array'); $model = $this->getModel('Result'); if (!$model->saveAssessment($id, $points, $comments)) { throw new \RuntimeException(Text::_('COM_TESTQUESTIONS_RESULT_NOT_FOUND')); } } }