diff --git a/Classes/Controller/QuizController.php b/Classes/Controller/QuizController.php index 0d161b9..8a5f30c 100644 --- a/Classes/Controller/QuizController.php +++ b/Classes/Controller/QuizController.php @@ -429,6 +429,7 @@ public function doAll(\Fixpunkt\FpMasterquiz\Domain\Model\Quiz $quiz, array $use $finalImageuid = 0; // image for the final page $finalContent = ''; // special content for the final page $finalCategoryArray = []; // Auswertung der angeklickten Kategorien + $redirectTo = ''; // redirect to uri (after evaluation) $emailAnswers = []; // special admin email to answer relations $specialRecievers = []; // special admin email recievers $debug = $userData['debug']; // debug output @@ -845,11 +846,9 @@ public function doAll(\Fixpunkt\FpMasterquiz\Domain\Model\Quiz $quiz, array $use // Punkte-Match if ($evaluation->getPage() > 0) { // Weiterleitung zu dieser Seite - $this->redirectToURI( - $this->uriBuilder->reset() + $redirectTo = $this->uriBuilder->reset() ->setTargetPageUid($evaluation->getPage()) - ->build() - ); + ->build(); } else if ($evaluation->getCe() > 0) { // Content-Element ausgeben $ttContentConfig = [ @@ -1015,6 +1014,7 @@ public function doAll(\Fixpunkt\FpMasterquiz\Domain\Model\Quiz $quiz, array $use 'useJoker' => $useJoker, 'mandatoryNotAnswered' => $mandatoryNotAnswered, 'session' => $session, + 'redirectTo' => $redirectTo, 'debug' => $debug ]; } @@ -1419,26 +1419,29 @@ public function showAction(\Fixpunkt\FpMasterquiz\Domain\Model\Quiz $quiz = null return $this->htmlResponse(); } if ($this->checkForClosure()) { - $this->redirectToURI( - $this->uriBuilder->reset() - ->setTargetPageUid($this->settings['closurePageUid']) - ->uriFor( - 'closure', - [ - 'participant' => $this->participant, - 'session' => $this->participant->getSession() - ], - 'Quiz', - null, - 'closure' - ) - ->build() - ); + $uri = $this->uriBuilder->reset() + ->setTargetPageUid($this->settings['closurePageUid']) + ->uriFor( + 'closure', + [ + 'participant' => $this->participant, + 'session' => $this->participant->getSession() + ], + 'Quiz', + null, + 'closure' + ); + return $this->responseFactory->createResponse(307) + ->withHeader('Location', $uri); } // participant wird zuerst hier definiert ... $userData = $this->findParticipant($quiz->getUid(), $quiz->getPid()); /// ... und dann hier in der DB abgespeichert $data = $this->doAll($quiz, $userData, 0, []); + if ($data['redirectTo']) { + return $this->responseFactory->createResponse(307) + ->withHeader('Location', $data['redirectTo']); + } $page = $data['page']; $pages = $data['pages']; $languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language'); @@ -1515,21 +1518,20 @@ public function showByTagAction(\Fixpunkt\FpMasterquiz\Domain\Model\Quiz $quiz = return $this->htmlResponse(); } if ($this->checkForClosure()) { - $this->redirectToURI( - $this->uriBuilder->reset() - ->setTargetPageUid($this->settings['closurePageUid']) - ->uriFor( - 'closure', - [ - 'participant' => $this->participant, - 'session' => $this->participant->getSession() - ], - 'Quiz', - null, - 'closure' - ) - ->build() - ); + $uri = $this->uriBuilder->reset() + ->setTargetPageUid($this->settings['closurePageUid']) + ->uriFor( + 'closure', + [ + 'participant' => $this->participant, + 'session' => $this->participant->getSession() + ], + 'Quiz', + null, + 'closure' + ); + return $this->responseFactory->createResponse(307) + ->withHeader('Location', $uri); } $userData = $this->findParticipant($quiz->getUid(), $quiz->getPid()); $page = $this->request->hasArgument('currentPage') ? intval($this->request->getArgument('currentPage')) : 1; @@ -1541,6 +1543,10 @@ public function showByTagAction(\Fixpunkt\FpMasterquiz\Domain\Model\Quiz $quiz = } $pages = $tagArray['pages']; $data = $this->doAll($quiz, $userData, $pages, $tagArray['randomNumbers']); + if ($data['redirectTo']) { + return $this->responseFactory->createResponse(307) + ->withHeader('Location', $data['redirectTo']); + } $lastPage = $data['lastPage']; if ($this->settings['allowEdit']) { $lastPage = $page; @@ -1636,21 +1642,20 @@ public function showAjaxAction(\Fixpunkt\FpMasterquiz\Domain\Model\Quiz $quiz): return $this->htmlResponse(); } if ($this->checkForClosure()) { - $this->redirectToURI( - $this->uriBuilder->reset() - ->setTargetPageUid($this->settings['closurePageUid']) - ->uriFor( - 'closure', - [ - 'participant' => $this->participant, - 'session' => $this->participant->getSession() - ], - 'Quiz', - null, - 'closure' - ) - ->build() - ); + $uri = $this->uriBuilder->reset() + ->setTargetPageUid($this->settings['closurePageUid']) + ->uriFor( + 'closure', + [ + 'participant' => $this->participant, + 'session' => $this->participant->getSession() + ], + 'Quiz', + null, + 'closure' + ); + return $this->responseFactory->createResponse(307) + ->withHeader('Location', $uri); } // siehe: https://www.sebkln.de/tutorials/erstellung-einer-typo3-extension-mit-ajax-aufruf/ // $quizUid = $this->request->hasArgument('quiz') ? intval($this->request->getArgument('quiz')) : 0; @@ -1659,6 +1664,10 @@ public function showAjaxAction(\Fixpunkt\FpMasterquiz\Domain\Model\Quiz $quiz): $this->settings['user']['useCookie'] = 0; $userData = $this->findParticipant($quiz->getUid(), $quiz->getPid()); $data = $this->doAll($quiz, $userData, 0, []); + if ($data['redirectTo']) { + return $this->responseFactory->createResponse(307) + ->withHeader('Location', $data['redirectTo']); + } $page = $data['page']; $pages = $data['pages']; $from = 1 + (($page - 1) * intval($this->settings['pagebrowser']['itemsPerPage'])); diff --git a/Classes/Domain/Model/Participant.php b/Classes/Domain/Model/Participant.php index 9ae5ac5..6ef9832 100644 --- a/Classes/Domain/Model/Participant.php +++ b/Classes/Domain/Model/Participant.php @@ -314,7 +314,7 @@ public function getUsername() $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($this->user, \PDO::PARAM_INT)) ) ->setMaxResults(1) - ->execute(); + ->executeQuery(); while ($row = $statement->fetch()) { return $row['username']; } diff --git a/Classes/Domain/Model/Question.php b/Classes/Domain/Model/Question.php index 14378c2..515361d 100644 --- a/Classes/Domain/Model/Question.php +++ b/Classes/Domain/Model/Question.php @@ -527,6 +527,6 @@ public function getSortedCategoriesArray() { $queryBuilder->expr()->eq('mm.tablenames', $queryBuilder->createNamedParameter('tx_fpmasterquiz_domain_model_question')) ) ->orderBy('sys_category.sorting') - ->execute(); + ->executeQuery(); } } diff --git a/Classes/Domain/Repository/QuestionRepository.php b/Classes/Domain/Repository/QuestionRepository.php index 9083c63..8b30d4e 100644 --- a/Classes/Domain/Repository/QuestionRepository.php +++ b/Classes/Domain/Repository/QuestionRepository.php @@ -82,7 +82,7 @@ public function moveToQuiz($questionID, $quizID) $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($questionID, \PDO::PARAM_INT)) ) ->set('quiz', intval($quizID)) - ->execute(); + ->executeStatement(); } /** diff --git a/Classes/Domain/Repository/QuizRepository.php b/Classes/Domain/Repository/QuizRepository.php index 2d7a0f6..c69ff62 100644 --- a/Classes/Domain/Repository/QuizRepository.php +++ b/Classes/Domain/Repository/QuizRepository.php @@ -79,7 +79,7 @@ public function getMyLocalizedUid(int $defaultQuizUid, int $sys_language_uid) $queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($sys_language_uid, \PDO::PARAM_INT)) ) ->setMaxResults(1) - ->execute(); + ->executeQuery(); while ($row = $statement->fetch()) { $uid = $row['uid']; } @@ -117,8 +117,8 @@ public function findFormUidAndPidOtherLanguages(int $uid) ->where( $queryBuilder->expr()->eq('l10n_parent', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)) ) - ->execute(); - return $statement->fetchAll(); + ->executeQuery(); + return $statement->fetchAllAssociative(); } /** diff --git a/Classes/Domain/Repository/SelectedRepository.php b/Classes/Domain/Repository/SelectedRepository.php index 790ff80..07a164c 100644 --- a/Classes/Domain/Repository/SelectedRepository.php +++ b/Classes/Domain/Repository/SelectedRepository.php @@ -130,8 +130,8 @@ public function deleteByParticipantAndQuestion($participantId, $questionId) $queryBuilder->expr()->eq('question', $queryBuilder->createNamedParameter($questionId, \PDO::PARAM_INT)) ) ) - ->execute() - ->fetchAll(); + ->executeQuery() + ->fetchAllAssociative(); foreach ($rows as $row) { GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($table) ->delete( diff --git a/Configuration/TCA/tx_fpmasterquiz_domain_model_answer.php b/Configuration/TCA/tx_fpmasterquiz_domain_model_answer.php index df3208d..abdab5e 100644 --- a/Configuration/TCA/tx_fpmasterquiz_domain_model_answer.php +++ b/Configuration/TCA/tx_fpmasterquiz_domain_model_answer.php @@ -24,7 +24,7 @@ 'iconfile' => 'EXT:fp_masterquiz/Resources/Public/Icons/tx_fpmasterquiz_domain_model_answer.gif' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, points, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, points, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime, --div--;LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_db.xlf:tabs.categories, categories'], ], 'columns' => [ 'sys_language_uid' => [ @@ -146,5 +146,4 @@ ], ], ], -]; -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_fpmasterquiz_domain_model_answer', 'categories'); \ No newline at end of file +]; \ No newline at end of file diff --git a/Configuration/TCA/tx_fpmasterquiz_domain_model_evaluation.php b/Configuration/TCA/tx_fpmasterquiz_domain_model_evaluation.php index 23af47a..e304b00 100644 --- a/Configuration/TCA/tx_fpmasterquiz_domain_model_evaluation.php +++ b/Configuration/TCA/tx_fpmasterquiz_domain_model_evaluation.php @@ -23,7 +23,7 @@ 'iconfile' => 'EXT:fp_masterquiz/Resources/Public/Icons/tx_fpmasterquiz_domain_model_evaluation.gif' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, evaluate, minimum, maximum, image, bodytext, ce, page, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, evaluate, minimum, maximum, image, bodytext, ce, page, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime, --div--;LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_db.xlf:tabs.categories, categories'], ], 'columns' => [ 'sys_language_uid' => [ @@ -210,5 +210,4 @@ ], ], ], -]; -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_fpmasterquiz_domain_model_evaluation', 'categories'); \ No newline at end of file +]; \ No newline at end of file diff --git a/Configuration/TCA/tx_fpmasterquiz_domain_model_participant.php b/Configuration/TCA/tx_fpmasterquiz_domain_model_participant.php index 5c01330..d0f65ea 100644 --- a/Configuration/TCA/tx_fpmasterquiz_domain_model_participant.php +++ b/Configuration/TCA/tx_fpmasterquiz_domain_model_participant.php @@ -21,7 +21,7 @@ 'iconfile' => 'EXT:fp_masterquiz/Resources/Public/Icons/tx_fpmasterquiz_domain_model_participant.gif' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, email, homepage, user, ip, session, sessionstart, randompages, points, maximum1, maximum2, page, completed, quiz, selections'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, email, homepage, user, ip, session, sessionstart, randompages, points, maximum1, maximum2, page, completed, quiz, selections, --div--;LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_db.xlf:tabs.categories, categories'], ], 'columns' => [ 'sys_language_uid' => [ @@ -254,5 +254,4 @@ ], ], ], -]; -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_fpmasterquiz_domain_model_participant', 'categories'); \ No newline at end of file +]; \ No newline at end of file diff --git a/Configuration/TCA/tx_fpmasterquiz_domain_model_question.php b/Configuration/TCA/tx_fpmasterquiz_domain_model_question.php index 4977096..4e56f2c 100644 --- a/Configuration/TCA/tx_fpmasterquiz_domain_model_question.php +++ b/Configuration/TCA/tx_fpmasterquiz_domain_model_question.php @@ -24,7 +24,7 @@ 'iconfile' => 'EXT:fp_masterquiz/Resources/Public/Icons/tx_fpmasterquiz_domain_model_question.gif' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, qmode, image, bodytext, explanation, tag, optional, answers, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, qmode, image, bodytext, explanation, tag, optional, answers, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime, --div--;LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_db.xlf:tabs.categories, categories'], ], 'columns' => [ 'sys_language_uid' => [ @@ -254,5 +254,4 @@ ], ], ], -]; -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_fpmasterquiz_domain_model_question', 'categories'); \ No newline at end of file +]; \ No newline at end of file diff --git a/Configuration/TCA/tx_fpmasterquiz_domain_model_quiz.php b/Configuration/TCA/tx_fpmasterquiz_domain_model_quiz.php index 737d6fe..307e718 100644 --- a/Configuration/TCA/tx_fpmasterquiz_domain_model_quiz.php +++ b/Configuration/TCA/tx_fpmasterquiz_domain_model_quiz.php @@ -28,7 +28,8 @@ 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, path_segment, about, timeperiod, media, qtype, --div--;LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_db.xlf:tabs.questions, questions, --div--;LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_db.xlf:tabs.evaluations, evaluations, - --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime, closed'], + --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime, closed, + --div--;LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_db.xlf:tabs.categories, categories'], ], 'columns' => [ 'sys_language_uid' => [ @@ -249,5 +250,4 @@ ], ], ], -]; -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_fpmasterquiz_domain_model_quiz', 'categories'); \ No newline at end of file +]; \ No newline at end of file diff --git a/Configuration/TCA/tx_fpmasterquiz_domain_model_selected.php b/Configuration/TCA/tx_fpmasterquiz_domain_model_selected.php index 8750c73..7515d65 100644 --- a/Configuration/TCA/tx_fpmasterquiz_domain_model_selected.php +++ b/Configuration/TCA/tx_fpmasterquiz_domain_model_selected.php @@ -21,7 +21,8 @@ 'iconfile' => 'EXT:fp_masterquiz/Resources/Public/Icons/tx_fpmasterquiz_domain_model_selected.gif' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, points, entered, question, answers'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, points, entered, question, answers, + --div--;LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_db.xlf:tabs.categories, categories'], ], 'columns' => [ 'sys_language_uid' => [ @@ -142,5 +143,4 @@ ], ], ], -]; -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_fpmasterquiz_domain_model_selected', 'categories'); \ No newline at end of file +]; \ No newline at end of file diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index f8b34d2..5080d01 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -19,6 +19,10 @@ Evaluations Auswertungen + + Categories + Kategorien + Quiz Quiz/Test diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 024ca41..389e9b9 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -15,6 +15,9 @@ Evaluations + + Categories + Quiz diff --git a/ext_tables.sql b/ext_tables.sql index 695aa47..4fb3523 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -15,7 +15,6 @@ CREATE TABLE tx_fpmasterquiz_domain_model_quiz ( evaluations int(11) unsigned DEFAULT '0' NOT NULL, closed smallint(5) unsigned DEFAULT '0' NOT NULL, path_segment varchar(2048), - categories int(11) unsigned DEFAULT '0' NOT NULL, tstamp int(11) unsigned DEFAULT '0' NOT NULL, crdate int(11) unsigned DEFAULT '0' NOT NULL, @@ -326,25 +325,6 @@ CREATE TABLE tx_fpmasterquiz_domain_model_answer ( ); -# -# Table structure for table 'tx_fpmasterquiz_domain_model_question' -# -CREATE TABLE tx_fpmasterquiz_domain_model_question ( - categories int(11) unsigned DEFAULT '0' NOT NULL, -); - -# -# Table structure for table 'tx_fpmasterquiz_domain_model_answer' -# -CREATE TABLE tx_fpmasterquiz_domain_model_answer ( - categories int(11) unsigned DEFAULT '0' NOT NULL, -); - -CREATE TABLE tx_fpmasterquiz_domain_model_evaluation -( - categories int(11) unsigned DEFAULT '0' NOT NULL, -); - # # Table structure for table 'tx_fpmasterquiz_domain_model_selected' # @@ -354,20 +334,6 @@ CREATE TABLE tx_fpmasterquiz_domain_model_selected ( ); -# -# Table structure for table 'tx_fpmasterquiz_domain_model_participant' -# -CREATE TABLE tx_fpmasterquiz_domain_model_participant ( - categories int(11) unsigned DEFAULT '0' NOT NULL, -); - -# -# Table structure for table 'tx_fpmasterquiz_domain_model_selected' -# -CREATE TABLE tx_fpmasterquiz_domain_model_selected ( - categories int(11) unsigned DEFAULT '0' NOT NULL, -); - # # Table structure for table 'tx_fpmasterquiz_selected_answer_mm' #