Initial survey bundle import

This commit is contained in:
Jürgen Mummert
2026-05-17 17:31:28 +02:00
commit b8475e3a57
84 changed files with 7157 additions and 0 deletions
+241
View File
@@ -0,0 +1,241 @@
<?php
declare(strict_types=1);
use Contao\DC_Table;
use Mummert\SurveyBundle\EventListener\SurveyDcaListener;
$guardCallback = [SurveyDcaListener::class, 'guardContentSave'];
$GLOBALS['TL_DCA']['tl_survey_content'] = [
'config' => [
'dataContainer' => DC_Table::class,
'ptable' => 'tl_survey',
'enableVersioning' => true,
'onsubmit_callback' => [
[SurveyDcaListener::class, 'touchSurveyContentParent'],
],
'onpalette_callback' => [
[SurveyDcaListener::class, 'resolveSurveyContentPalette'],
],
'ondelete_callback' => [
[SurveyDcaListener::class, 'guardContentDelete'],
[SurveyDcaListener::class, 'touchSurveyContentParent'],
],
'sql' => [
'keys' => [
'id' => 'primary',
'pid' => 'index',
'sorting' => 'index',
'published' => 'index',
],
],
],
'list' => [
'sorting' => [
'mode' => 4,
'fields' => ['sorting'],
'headerFields' => ['title', 'alias', 'published', 'isLocked'],
'child_record_class' => 'survey-question-record',
'panelLayout' => 'sort,search,limit',
],
'label' => [
'fields' => ['question', 'type'],
'showColumns' => true,
],
'operations' => [
'edit' => [
'href' => 'act=edit',
'icon' => 'edit.svg',
],
'copy' => [
'href' => 'act=copy',
'icon' => 'copy.svg',
],
'delete' => [
'href' => 'act=delete',
'icon' => 'delete.svg',
'attributes' => 'onclick="if(!confirm(\'Eintrag wirklich loeschen?\'))return false;Backend.getScrollOffset()"',
],
'show' => [
'href' => 'act=show',
'icon' => 'show.svg',
],
],
],
'palettes' => [
'default' => '{question_legend},type,question,description;{settings_legend},mandatory,published',
'yes_no_maybe' => '{question_legend},type,question,description;{settings_legend},mandatory,published,allowMaybe,jumpOnYes,jumpOnNo',
'text' => '{question_legend},type,question,description;{settings_legend},mandatory,published',
'range' => '{question_legend},type,question,description;{settings_legend},mandatory,published,rangeMin,rangeMax,rangeStep',
'choice' => '{question_legend},type,question,description;{settings_legend},mandatory,published,allowMultiple,answerOption1,answerOption2,answerOption3,answerOption4,answerOption5,answerOption6,answerOption7,answerOption8,answerOption9,answerOption10',
],
'fields' => [
'id' => ['sql' => 'int(10) unsigned NOT NULL auto_increment'],
'tstamp' => ['sql' => 'int(10) unsigned NOT NULL default 0'],
'pid' => ['sql' => 'int(10) unsigned NOT NULL default 0'],
'sorting' => [
'sql' => 'int(10) unsigned NOT NULL default 0',
],
'type' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['type'],
'inputType' => 'select',
'options' => ['yes_no_maybe', 'text', 'range', 'choice'],
'reference' => &$GLOBALS['TL_LANG']['tl_survey_content']['types'],
'eval' => ['mandatory' => true, 'includeBlankOption' => true, 'submitOnChange' => true, 'chosen' => true, 'tl_class' => 'w50'],
'save_callback' => [$guardCallback],
'sql' => "varchar(32) NOT NULL default ''",
],
'question' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['question'],
'inputType' => 'text',
'eval' => ['mandatory' => true, 'maxlength' => 255, 'tl_class' => 'clr'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'description' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['description'],
'inputType' => 'textarea',
'eval' => ['tl_class' => 'clr'],
'save_callback' => [$guardCallback],
'sql' => 'text NULL',
],
'mandatory' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['mandatory'],
'inputType' => 'checkbox',
'default' => '1',
'eval' => ['tl_class' => 'w50 m12'],
'save_callback' => [$guardCallback],
'sql' => "char(1) NOT NULL default ''",
],
'published' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['published'],
'inputType' => 'checkbox',
'default' => '1',
'eval' => ['tl_class' => 'w50 m12'],
'save_callback' => [$guardCallback],
'sql' => "char(1) NOT NULL default ''",
],
'allowMaybe' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['allowMaybe'],
'inputType' => 'checkbox',
'eval' => ['tl_class' => 'w50 m12 clr'],
'save_callback' => [$guardCallback],
'sql' => "char(1) NOT NULL default ''",
],
'jumpOnYes' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['jumpOnYes'],
'inputType' => 'select',
'options_callback' => [SurveyDcaListener::class, 'getQuestionOptionsForContent'],
'eval' => ['includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50 clr'],
'save_callback' => [$guardCallback],
'sql' => 'int(10) unsigned NOT NULL default 0',
],
'jumpOnNo' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['jumpOnNo'],
'inputType' => 'select',
'options_callback' => [SurveyDcaListener::class, 'getQuestionOptionsForContent'],
'eval' => ['includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'],
'save_callback' => [$guardCallback],
'sql' => 'int(10) unsigned NOT NULL default 0',
],
'allowMultiple' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['allowMultiple'],
'inputType' => 'checkbox',
'eval' => ['tl_class' => 'w50 m12 clr'],
'save_callback' => [$guardCallback],
'sql' => "char(1) NOT NULL default ''",
],
'answerOption1' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['answerOption1'],
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'tl_class' => 'w50 clr'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'answerOption2' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['answerOption2'],
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'tl_class' => 'w50'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'answerOption3' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['answerOption3'],
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'tl_class' => 'w50 clr'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'answerOption4' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['answerOption4'],
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'tl_class' => 'w50'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'answerOption5' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['answerOption5'],
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'tl_class' => 'w50 clr'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'answerOption6' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['answerOption6'],
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'tl_class' => 'w50'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'answerOption7' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['answerOption7'],
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'tl_class' => 'w50 clr'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'answerOption8' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['answerOption8'],
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'tl_class' => 'w50'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'answerOption9' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['answerOption9'],
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'tl_class' => 'w50 clr'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'answerOption10' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['answerOption10'],
'inputType' => 'text',
'eval' => ['maxlength' => 255, 'tl_class' => 'w50'],
'save_callback' => [$guardCallback],
'sql' => "varchar(255) NOT NULL default ''",
],
'rangeMin' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['rangeMin'],
'inputType' => 'text',
'eval' => ['rgxp' => 'digit', 'tl_class' => 'w50'],
'save_callback' => [$guardCallback],
'sql' => 'int(10) NOT NULL default 0',
],
'rangeMax' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['rangeMax'],
'inputType' => 'text',
'eval' => ['rgxp' => 'digit', 'tl_class' => 'w50'],
'save_callback' => [$guardCallback],
'sql' => 'int(10) NOT NULL default 10',
],
'rangeStep' => [
'label' => &$GLOBALS['TL_LANG']['tl_survey_content']['rangeStep'],
'inputType' => 'text',
'eval' => ['rgxp' => 'digit', 'tl_class' => 'w50'],
'save_callback' => [$guardCallback],
'sql' => 'int(10) unsigned NOT NULL default 1',
],
],
];