Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
335 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010 Georg Ringer <typo3@ringerge.org> | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
/* | ||
* modified 2019 by Kurt Gusbeth | ||
*/ | ||
namespace Fixpunkt\FpMasterquiz\Hooks; | ||
|
||
/** | ||
* Userfunc: Individuelles... | ||
* | ||
* @package fp_masterquiz | ||
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later | ||
* | ||
*/ | ||
class ItemsProcFunc { | ||
|
||
/** | ||
* Itemsproc for templateLayouts | ||
* | ||
* @param array &$config configuration array | ||
* @return void | ||
*/ | ||
public function user_templateLayout(array &$config) { | ||
$row = $this->getContentElementRow($config['row']['uid']); | ||
// $pid = $config['row']['pid']; geht nicht mehr | ||
$pid = $row['pid']; | ||
$templateLayoutsUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Fixpunkt\\FpMasterquiz\\Utility\\TemplateLayout'); | ||
$templateLayouts = $templateLayoutsUtility->getAvailableTemplateLayouts($pid); | ||
foreach ($templateLayouts as $layout) { | ||
$additionalLayout = array( | ||
$GLOBALS['LANG']->sL($layout[0], TRUE), | ||
$layout[1] | ||
); | ||
array_push($config['items'], $additionalLayout); | ||
} | ||
} | ||
|
||
/** | ||
* Get tt_content record | ||
* | ||
* @param int $uid | ||
* @return array | ||
*/ | ||
protected function getContentElementRow($uid) | ||
{ | ||
return \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('tt_content', $uid); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2014 Frans Saris <franssaris@gmail.com> | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
/* | ||
* modified 2019 by Kurt Gusbeth | ||
*/ | ||
namespace Fixpunkt\FpMasterQuiz\Utility; | ||
|
||
/** | ||
* TemplateLayout: Template-Layout per TSconfig | ||
* | ||
* @package fp_masterquiz | ||
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later | ||
* | ||
*/ | ||
class TemplateLayout implements \TYPO3\CMS\Core\SingletonInterface { | ||
|
||
/** | ||
* Get available template layouts for a page | ||
* | ||
* @param int $pageUid | ||
* @return array | ||
*/ | ||
public function getAvailableTemplateLayouts($pageUid) { | ||
$templateLayouts = array(); | ||
foreach($this->getTemplateLayoutsFromTsConfig($pageUid) as $templateKey => $title) { | ||
$templateLayouts[] = array($title, $templateKey); | ||
} | ||
return $templateLayouts; | ||
} | ||
|
||
/** | ||
* Get template layouts defined in TSconfig | ||
* | ||
* @param $pageUid | ||
* @return array | ||
*/ | ||
protected function getTemplateLayoutsFromTsConfig($pageUid) { | ||
$templateLayouts = array(); | ||
$pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pageUid); | ||
if (isset($pagesTsConfig['tx_fpmasterquiz.']['templateLayouts.']) && is_array($pagesTsConfig['tx_fpmasterquiz.']['templateLayouts.'])) { | ||
$templateLayouts = $pagesTsConfig['tx_fpmasterquiz.']['templateLayouts.']; | ||
} | ||
return $templateLayouts; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
.. include:: ../../Includes.txt | ||
|
||
.. ================================================== | ||
.. FOR YOUR INFORMATION | ||
.. -------------------------------------------------- | ||
.. -*- coding: utf-8 -*- with BOM. | ||
.. ================================================== | ||
.. DEFINE SOME TEXTROLES | ||
.. -------------------------------------------------- | ||
.. role:: underline | ||
.. role:: typoscript(code) | ||
.. role:: ts(typoscript) | ||
:class: typoscript | ||
.. role:: php(code) | ||
|
||
|
||
Page TSconfig | ||
^^^^^^^^^^^^^ | ||
|
||
- You can use the Page TSconfig to define some template layouts. | ||
|
||
Example | ||
~~~~~~~ | ||
|
||
Here an example with 2 layouts for your templates: | ||
|
||
:: | ||
|
||
tx_fpmasterquiz.templateLayouts { | ||
0 = Standard-Layout | ||
1 = Layout for a poll with a pie chart | ||
} | ||
|
||
|
||
- You can use every number and description for the layouts. | ||
- Now you can select a layout in the FlexForm of every page. | ||
- Finally you can use now different layouts in your templates. | ||
|
||
Example | ||
~~~~~~~ | ||
|
||
Here an example for a template (extract) with 2 layouts: | ||
|
||
:: | ||
|
||
<f:if condition="{settings.templateLayout} == 1"> | ||
<f:then> | ||
show a pie chart | ||
</f:then> | ||
<f:else> | ||
show only text | ||
</f:else> | ||
</f:if> | ||
|
||
- Furthermore you can use TSconfig to rename or hide quiz-fields. Here two examples: | ||
|
||
:: | ||
|
||
TCEFORM.tx_fpmasterquiz_domain_model_question.explanation.disabled = 1 | ||
TCEFORM.tx_fpmasterquiz_domain_model_quiz.about.label = Description for the list view | ||
|
||
You find the TSconfig when you edit a page. Go to the tab Ressources. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
# fp_masterquiz | ||
|
||
version 0.3.7 | ||
version 0.4.0 | ||
|
||
TYPO3 extension to create a quiz or test. The participant result will be saved in the DB too and can be deleted automatically via Scheduler. | ||
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. | ||
|
||
It is the official successor extension of myquizpoll. | ||
Currently it is only a beta release. Please give me feedback. | ||
This extension is not backward compatible to myquizpoll! | ||
This extension is not backward compatible to myquizpoll, but there is a simple import-task for myquizpoll-questions. | ||
|
||
Features: a quiz or test can be played by submitting a form or by submitting an AJAX-request. | ||
Features: a quiz, poll or test can be played by submitting a form or by submitting an AJAX-request. | ||
|
||
You find the documentation at typo3.org: https://docs.typo3.org/typo3cms/extensions/fp_masterquiz/ | ||
|
||
Last feature: show all answers and own answer at the final page. | ||
Last feature: templateLayout with a pie chart. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<html xmlns:f="https://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> | ||
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script> | ||
<div id="pollChart"></div> | ||
<script> | ||
var options = { | ||
//title: { | ||
// text: '{selection.question.title}', | ||
// align: 'left' | ||
//}, | ||
chart: { | ||
width: 492, | ||
type: 'pie', | ||
}, | ||
labels: [<f:for each="{selection.question.answers}" as="answer3" iteration="iter3">'{answer3.title}'<f:if condition="{iter3.isLast}"><f:then></f:then><f:else>,</f:else></f:if></f:for>], | ||
series: [<f:for each="{selection.question.answers}" as="answer3" iteration="iter3">{answer3.allAnswers}<f:if condition="{iter3.isLast}"><f:then></f:then><f:else>,</f:else></f:if></f:for>], | ||
responsive: [{ | ||
breakpoint: 480, | ||
options: { | ||
chart: { | ||
width: 200 | ||
}, | ||
legend: { | ||
position: 'bottom' | ||
} | ||
} | ||
}] | ||
} | ||
|
||
var chart = new ApexCharts( | ||
document.querySelector("#pollChart"), | ||
options | ||
); | ||
|
||
chart.render(); | ||
</script> | ||
</html> |
Oops, something went wrong.