19declare(strict_types=1);
34 protected bool $anonymous_test =
false
47 ?array $environment =
null
50 $lng->txt(
'test_question_set_type')
53 $lng->txt(
'test_question_set_type_fixed'),
54 $lng->txt(
'test_question_set_type_fixed_info')
57 $lng->txt(
'test_question_set_type_random'),
58 $lng->txt(
'test_question_set_type_random_info')
61 $trafo =
$refinery->custom()->transformation(
62 static function (
string $v):
bool {
72 $lng->txt(
'tst_anonymity')
75 $lng->txt(
'tst_anonymity_no_anonymization')
78 $lng->txt(
'tst_anonymity_anonymous_test')
80 ->withAdditionalTransformation($trafo);
82 if ($environment[
'participant_data_exists']) {
83 $inputs[
'question_set_type'] =
$inputs[
'question_set_type']->withDisabled(
true);
93 'question_set_type' => [
'text', $this->getQuestionSetType()],
94 'anonymity' => [
'integer', (
int) $this->getAnonymity()]
100 switch ($this->getQuestionSetType()) {
101 case \ilObjTest::QUESTION_SET_TYPE_FIXED:
105 case \ilObjTest::QUESTION_SET_TYPE_RANDOM:
118 return $this->question_set_type;
123 $clone = clone $this;
124 $clone->question_set_type = $question_set_type;
130 return $this->anonymous_test;
135 $clone = clone $this;
136 $clone->anonymous_test = $anonymous_test;
143 'question_set_type' => $this->getQuestionSetType(),
144 'anonymity' => $this->getAnonymity()
151 (string)
$data[
'question_set_type'],
152 (
bool)
$data[
'anonymity']
static fromExport(array $data)
Creates an instance of the object from an array.
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, ?array $environment=null)
withQuestionSetType(string $question_set_type)
withAnonymity(bool $anonymous_test)
toExport()
Transform the object into a simple, associative array.
toLog(AdditionalInformationGenerator $additional_info)
__construct(protected string $question_set_type=\ilObjTest::QUESTION_SET_TYPE_FIXED, protected bool $anonymous_test=false)
const QUESTION_SET_TYPE_FIXED
This interface allows an object to define its own transformation into a language-neutral,...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...