'label' => 'Quiz title',
'type' => 'Text',
'column' => true,
- 'tab' => 'Settings']);
+ 'tab' => 'Contents']);
+
+ $this->addField(['name' => 'translation',
+ 'label' => 'Quiz language',
+ 'type' => 'SelectFromModel',
+ 'optionsmodel' => QuizTranslation::class,
+ 'attribute' => 'locale',
+ 'column' => true,
+ 'tab' => 'Contents']);
+
+ $messages = ['defaultMessage' => 'Message displayed at the end of the quiz',
+ 'passedMessage' => 'Message displayed when passing the quiz',
+ 'failedMessage' => 'Message displayed when failing the quiz'];
+
+ foreach ($messages as $name => $label) {
+ $this->addField(['name' => $name,
+ 'label' => $label,
+ 'hint' => 'Let this field empty to use the default message',
+ 'type' => 'Text',
+ 'tab' => 'Contents']);
+ }
+
+ $this->addField([
+ 'name' => 'questions',
+ 'type' => 'BunchOfFieldsMultiple',
+ 'bunch' => 'App\SubForms\Question',
+ 'label' => '',
+ 'add_label' => 'Add question',
+ 'tab' => 'Questions / Answers',
+ ]);
$this->addField(['name' => 'scorm',
'label' => 'SCORM enabled',
'column' => true,
'tab' => 'Settings']);
+ $this->addField(['name' => 'threshold',
+ 'label' => 'Passed threshold',
+ 'type' => 'Integer',
+ 'min' => 0,
+ 'max' => 100,
+ 'hint' => 'Over this score (out of 100), the quiz is passed. Set 0 to disable',
+ 'tab' => 'Settings']);
+
$this->addField(['name' => 'review',
'label' => 'Enable answer review',
'hint' => 'Let the user review his answers and the correct ones at the end of the quiz',
'type' => 'Checkbox',
'tab' => 'Settings']);
- $this->addField(['name' => 'locale',
- 'label' => 'Quiz language',
- 'type' => 'Locale',
- 'column' => true,
+ $this->addField(['name' => 'passedAction',
+ 'label' => 'Run code when passing the quiz',
+ 'hint' => 'JavaScript code',
+ 'type' => 'Textarea',
'tab' => 'Settings']);
- $this->addField([
- 'name' => 'questions',
- 'type' => 'BunchOfFieldsMultiple',
- 'bunch' => 'App\SubForms\Question',
- 'label' => '',
- 'add_label' => 'Add question',
- 'tab' => 'Questions / Answers',
- ]);
+ $this->addField(['name' => 'failedAction',
+ 'label' => 'Run code when failing the quiz',
+ 'hint' => 'JavaScript code',
+ 'type' => 'Textarea',
+ 'tab' => 'Settings']);
$colors = [
- 'mainColor' => ['label' => 'Main color', 'hint' => 'Buttons and rollovers color'],
- 'overlay' => ['label' => 'Overlay', 'hint' => 'Overlay set on the banner'],
- 'okColor' => ['label' => 'OK color', 'hint' => 'Color of the ok badge (usually green)'],
- 'nokColor' => ['label' => 'NOK color', 'hint' => 'Color of the not ok badge (usually red)'],
- 'reviewBackground' => ['label' => 'Review panel background color'],
+ 'mainColor' => ['label' => 'Main color', 'hint' => 'Buttons and rollovers color', 'value' => '#e7007a'],
+ 'overlay' => ['label' => 'Overlay', 'hint' => 'Overlay set on the banner', 'value' => 'rgba(0,0,0,0.75)'],
+ 'reviewBackground' => ['label' => 'Review panel background color', 'value' => '#262626'],
+ 'okColor' => ['label' => 'OK color', 'hint' => 'Color of the ok badge (usually green)', 'value' => '#66c924'],
+ 'nokColor' => ['label' => 'NOK color', 'hint' => 'Color of the not ok badge (usually red)', 'value' => '#c61e35'],
];
$default = ['tab' => 'Theme', 'type' => 'Color'];