2
2
3
3
namespace Fixpunkt \FpMasterquiz \Controller ;
4
4
5
- use TYPO3 \CMS \Fluid \View \StandaloneView ;
6
- use TYPO3 \CMS \Core \Mail \MailMessage ;
7
- use Symfony \Component \Mime \Address ;
8
5
use Fixpunkt \FpMasterquiz \Domain \Repository \QuizRepository ;
9
6
use Fixpunkt \FpMasterquiz \Domain \Repository \AnswerRepository ;
10
7
use Fixpunkt \FpMasterquiz \Domain \Repository \ParticipantRepository ;
25
22
use TYPO3 \CMS \Extbase \Utility \LocalizationUtility ;
26
23
use TYPO3 \CMS \Core \Context \Context ;
27
24
use TYPO3 \CMS \Core \Pagination \ArrayPaginator ;
28
- use Psr \Http \Message \ResponseInterface ;
29
25
use TYPO3 \CMS \Core \Localization \LanguageService ;
30
26
use TYPO3 \CMS \Backend \Template \ModuleTemplate ;
31
27
use TYPO3 \CMS \Backend \Template \ModuleTemplateFactory ;
28
+ use TYPO3 \CMS \Fluid \View \StandaloneView ;
29
+ use TYPO3 \CMS \Core \Mail \MailMessage ;
30
+ use Symfony \Component \Mime \Address ;
31
+ use Psr \Http \Message \ResponseInterface ;
32
32
use Psr \Log \LoggerInterface ;
33
33
34
34
/***
@@ -1229,7 +1229,7 @@ protected function evaluateInputTextAnswerResult(int $i_quid,
1229
1229
}
1230
1230
1231
1231
// for security reasons check the input from the frontend
1232
- $ answerText = filter_var ($ answerText , FILTER_SANITIZE_STRING );
1232
+ $ answerText = htmlspecialchars ( $ answerText ); // filter_var($answerText, FILTER_SANITIZE_STRING);
1233
1233
1234
1234
// store the answer of the participant in the selected dataset
1235
1235
$ c_selected ->setEntered ($ answerText );
@@ -1239,7 +1239,7 @@ protected function evaluateInputTextAnswerResult(int $i_quid,
1239
1239
$ c_selected ->addAnswer ($ answer );
1240
1240
1241
1241
if ($ i_question ->getQmode () == 3 ) {
1242
- // sum the the points of the current answer to the max. possible point until the current question
1242
+ // sum the points of the current answer to the max. possible point until the current question
1243
1243
$ maximum1 += $ answer ->getPoints ();
1244
1244
1245
1245
// if the answer is right
@@ -1294,7 +1294,7 @@ public function getFeUser(int $userid): array
1294
1294
$ connection = GeneralUtility::makeInstance (ConnectionPool::class)->getConnectionForTable ('fe_users ' );
1295
1295
$ queryBuilder = $ connection ->createQueryBuilder ();
1296
1296
$ statement = $ queryBuilder ->select ('* ' )->from ('fe_users ' )->where (
1297
- $ queryBuilder ->expr ()->eq ('uid ' , $ queryBuilder ->createNamedParameter ($ userid , \PDO ::PARAM_INT ))
1297
+ $ queryBuilder ->expr ()->eq ('uid ' , $ queryBuilder ->createNamedParameter ($ userid , \TYPO3 \ CMS \ Core \ Database \Connection ::PARAM_INT ))
1298
1298
)->setMaxResults (1 )->executeQuery ();
1299
1299
while ($ row = $ statement ->fetch ()) {
1300
1300
return $ row ;
@@ -2123,11 +2123,11 @@ public function indexAction(): ResponseInterface
2123
2123
$ otherLangs [] = $ this ->quizRepository ->findFormUidAndPidOtherLanguages ($ quiz ->getUid ());
2124
2124
}
2125
2125
2126
- $ this ->view ->assign ('pid ' , $ pid );
2127
- $ this ->view ->assign ('quizzes ' , $ quizzes );
2128
- $ this ->view ->assign ('otherQuizzes ' , $ otherLangs );
2126
+ $ this ->moduleTemplate ->assign ('pid ' , $ pid );
2127
+ $ this ->moduleTemplate ->assign ('quizzes ' , $ quizzes );
2128
+ $ this ->moduleTemplate ->assign ('otherQuizzes ' , $ otherLangs );
2129
2129
$ this ->addDocHeaderDropDown ('index ' );
2130
- return $ this ->defaultRendering ( );
2130
+ return $ this ->moduleTemplate -> renderResponse ( ' Quiz/Index ' );
2131
2131
}
2132
2132
2133
2133
/**
@@ -2162,30 +2162,30 @@ public function detailAction(Quiz $quiz): ResponseInterface
2162
2162
$ lostArray [$ question ->getUid ()] = $ question ->getTitle ();
2163
2163
}
2164
2164
2165
- $ this ->view ->assign ('quiz ' , $ quiz );
2166
- $ this ->view ->assign ('lostArray ' , $ lostArray );
2167
- $ this ->view ->assign ('lost ' , count ($ lostArray ));
2168
- $ this ->view ->assign ('updated ' , $ updated );
2165
+ $ this ->moduleTemplate ->assign ('quiz ' , $ quiz );
2166
+ $ this ->moduleTemplate ->assign ('lostArray ' , $ lostArray );
2167
+ $ this ->moduleTemplate ->assign ('lost ' , count ($ lostArray ));
2168
+ $ this ->moduleTemplate ->assign ('updated ' , $ updated );
2169
2169
if ($ this ->request ->hasArgument ('prop ' )) {
2170
- $ this ->view ->assign ('prop ' , $ this ->request ->getArgument ('prop ' ));
2170
+ $ this ->moduleTemplate ->assign ('prop ' , $ this ->request ->getArgument ('prop ' ));
2171
2171
} else {
2172
- $ this ->view ->assign ('prop ' , 0 );
2172
+ $ this ->moduleTemplate ->assign ('prop ' , 0 );
2173
2173
}
2174
2174
2175
2175
if ($ this ->request ->hasArgument ('user ' )) {
2176
- $ this ->view ->assign ('user ' , $ this ->request ->getArgument ('user ' ));
2176
+ $ this ->moduleTemplate ->assign ('user ' , $ this ->request ->getArgument ('user ' ));
2177
2177
} else {
2178
- $ this ->view ->assign ('user ' , 0 );
2178
+ $ this ->moduleTemplate ->assign ('user ' , 0 );
2179
2179
}
2180
2180
2181
2181
if ($ this ->request ->hasArgument ('chart ' )) {
2182
- $ this ->view ->assign ('chart ' , $ this ->request ->getArgument ('chart ' ));
2182
+ $ this ->moduleTemplate ->assign ('chart ' , $ this ->request ->getArgument ('chart ' ));
2183
2183
} else {
2184
- $ this ->view ->assign ('chart ' , 0 );
2184
+ $ this ->moduleTemplate ->assign ('chart ' , 0 );
2185
2185
}
2186
2186
2187
2187
$ this ->addDocHeaderDropDown ('index ' );
2188
- return $ this ->defaultRendering ( );
2188
+ return $ this ->moduleTemplate -> renderResponse ( ' Quiz/Detail ' );
2189
2189
}
2190
2190
2191
2191
/**
@@ -2197,11 +2197,11 @@ public function chartsAction(Quiz $quiz): ResponseInterface
2197
2197
$ pid = $ be ? $ this ->id : (int )$ GLOBALS ['TSFE ' ]->id ;
2198
2198
2199
2199
$ debug = $ this ->setAllUserAnswers ($ quiz , $ pid , $ be );
2200
- $ this ->view ->assign ('debug ' , $ debug );
2201
- $ this ->view ->assign ('pid ' , $ pid );
2202
- $ this ->view ->assign ('quiz ' , $ quiz );
2200
+ $ this ->moduleTemplate ->assign ('debug ' , $ debug );
2201
+ $ this ->moduleTemplate ->assign ('pid ' , $ pid );
2202
+ $ this ->moduleTemplate ->assign ('quiz ' , $ quiz );
2203
2203
$ this ->addDocHeaderDropDown ('index ' );
2204
- return $ this ->defaultRendering ( );
2204
+ return $ this ->moduleTemplate -> renderResponse ( ' Quiz/Charts ' );
2205
2205
}
2206
2206
2207
2207
/**
@@ -2268,12 +2268,6 @@ protected function getLanguageService(): LanguageService
2268
2268
return $ GLOBALS ['LANG ' ];
2269
2269
}
2270
2270
2271
- protected function defaultRendering (): ResponseInterface
2272
- {
2273
- $ this ->moduleTemplate ->setContent ($ this ->view ->render ());
2274
- return $ this ->htmlResponse ($ this ->moduleTemplate ->renderContent ());
2275
- }
2276
-
2277
2271
protected function addDocHeaderDropDown (string $ currentAction ): void
2278
2272
{
2279
2273
$ languageService = $ this ->getLanguageService ();
0 commit comments