Skip to content

Commit

Permalink
Version 3.5.7: translated quiz in the backend module
Browse files Browse the repository at this point in the history
  • Loading branch information
bihor committed Feb 15, 2023
1 parent bbb6411 commit b89d30f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Classes/Controller/QuizController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1758,10 +1758,15 @@ public function closureAction(\Fixpunkt\FpMasterquiz\Domain\Model\Participant $p
*/
function indexAction()
{
$otherLangs = [];
$pid = (int)GeneralUtility::_GP('id');
$quizzes = $this->quizRepository->findFromPid($pid);
foreach ($quizzes as $quiz) {
$otherLangs[] = $this->quizRepository->findFormUidAndPidOtherLanguages($quiz->getUid());
}
$this->view->assign('pid', $pid);
$this->view->assign('quizzes', $quizzes);
$this->view->assign('otherQuizzes', $otherLangs);
}

/**
Expand Down
19 changes: 19 additions & 0 deletions Classes/Domain/Repository/QuizRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ public function findFromPid($pageId)
return $query->execute();
}

/**
* Fetches quizzes with other languages
*
* @param integer $uid quiz-uid
* @return array
*/
public function findFormUidAndPidOtherLanguages(int $uid)
{
$queryBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)->getQueryBuilderForTable('tx_fpmasterquiz_domain_model_quiz');
$statement = $queryBuilder
->select('*')
->from('tx_fpmasterquiz_domain_model_quiz')
->where(
$queryBuilder->expr()->eq('l10n_parent', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT))
)
->execute();
return $statement->fetchAll();
}

/**
* Get the PIDs
*
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# fp_masterquiz

version 3.5.6
version 3.5.7

TYPO3 extension to create a quiz, poll or test. The participant result will be saved in the DB too and can be deleted automatically via Scheduler.

Expand Down Expand Up @@ -36,5 +36,5 @@ Changes in version 3.5.5:
- Reformatting source code and PHP 8 bugfix
- Bugfix: optional checkbox.

Changes in version 3.5.6:
Changes in version 3.5.7:
- Bugfix for other languages than 0.
17 changes: 15 additions & 2 deletions Resources/Private/Backend/Templates/Quiz/Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,23 @@ <h1><f:translate key="LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang
<tr>
<td>{quiz.name}</td>
<td>{quiz.about}</td>
<td><f:link.action action="detail" arguments="{quiz : quiz}"><f:translate key="LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_mod1.xlf:detail-prop" /></f:link.action></td>
<td><f:link.action action="detail" arguments="{quiz : quiz.uid}"><f:translate key="LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_mod1.xlf:detail-prop" /></f:link.action></td>
<td><f:link.action controller="Participant" action="list" arguments="{quiz : quiz.uid}"><f:translate key="LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_mod1.xlf:detail-user" /></f:link.action></td>
<td><f:link.action action="charts" arguments="{quiz : quiz, be : 1}"><f:translate key="LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_mod1.xlf:detail-chart" /></f:link.action></td>
<td><f:link.action action="charts" arguments="{quiz : quiz.uid, be : 1}"><f:translate key="LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_mod1.xlf:detail-chart" /></f:link.action></td>
</tr>
<f:for each="{otherQuizzes}" as="otherQuizArray">
<f:for each="{otherQuizArray}" as="otherQuiz">
<f:if condition="{otherQuiz.l10n_parent} == {quiz.uid}">
<tr>
<td style="background-color: #e8e8e8;">- {otherQuiz.name}</td>
<td style="background-color: #e8e8e8;">{otherQuiz.about}</td>
<td style="background-color: #e8e8e8;"><f:link.action action="detail" arguments="{quiz : otherQuiz.uid}"><f:translate key="LLL:EXT:fp_masterquiz/Resources/Private/Language/locallang_mod1.xlf:detail-prop" /></f:link.action></td>
<td style="background-color: #e8e8e8;">-</td>
<td style="background-color: #e8e8e8;">-</td>
</tr>
</f:if>
</f:for>
</f:for>
</f:for>
</table>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'state' => 'stable',
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '3.5.6',
'version' => '3.5.7',
'constraints' => [
'depends' => [
'typo3' => '10.4.6-11.5.99',
Expand Down

0 comments on commit b89d30f

Please sign in to comment.