'default' => true,
'tab' => 'Settings']);
+ $this->addField(['name' => 'logattempts',
+ 'label' => 'Enable logging of users attempts',
+ 'hint' => 'All users attempts will be sent to the toolbox server',
+ 'type' => 'Checkbox',
+ 'default' => false,
+ 'tab' => 'Settings']);
+
foreach (self::$_actions as $action => $label) {
$this->addField(['name' => $action,
'label' => $label,
$xml->addChild('threshold', $this->getAttribute('threshold') ?: '0');
$xml->addChild('instantReview', $this->getAttribute('instantReview') ? '1' : '0');
$xml->addChild('review', $this->getAttribute('review') ? '1' : '0');
+ $xml->addChild('logattempts', $this->getAttribute('logattempts') ? '1' : '0');
$xt = $xml->addChild('translations');
/** @var QuizTranslation $translation */
$tid = $this->getAttribute('translation') ?? 1;
if (!isset($question['type'])) {
$question['type'] = 'multiple';
}
+ if (!isset($question['count_for_score'])) {
+ $question['count_for_score'] = true;
+ }
$xq = $xqs->addChild('question');
if ($question['multiple']) {
$xq->addAttribute('multiple', '1');
}
+ $xq->addAttribute('count', $question['count_for_score'] ? '1' : '0');
$xq->addAttribute('type', $question['type']);
$xq->addChild('label', $question['question']);
if ($question['type'] === 'multiple') {
'textarea' => 'Long text',
'email' => 'E-mail']]);
+ $this->addField(['name' => 'count_for_score',
+ 'label' => 'Count for score calculation',
+ 'type' => 'Checkbox',
+ 'default' => true]);
+
$this->addField(['name' => 'placeholder',
'type' => 'Text',
'label' => 'Placeholder',
'when' => ['type' => 'multiple']
]);
+ $this->addField([
+ 'name' => 'min_score',
+ 'type' => 'Integer',
+ 'label' => 'Minimum score to pass',
+ 'hint' => '0 means that all correct answers and only correct answers must be checked in order the user passes the question.',
+ 'default' => 0,
+ 'when' => ['type' => 'multiple', 'multiple' => 1]
+ ]);
+
$this->addField([
'name' => 'answers',
'type' => 'BunchOfFieldsMultiple',
'label' => 'Answers',
'when' => ['type' => 'multiple']
]);
+
+
}
}