ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Test\Settings\MainSettings\SettingsGeneral Class Reference
+ Inheritance diagram for ILIAS\Test\Settings\MainSettings\SettingsGeneral:
+ Collaboration diagram for ILIAS\Test\Settings\MainSettings\SettingsGeneral:

Public Member Functions

 __construct (int $test_id, protected string $question_set_type=\ilObjTest::QUESTION_SET_TYPE_FIXED, protected bool $anonymous_test=false)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, ?array $environment=null)
 
 toStorage ()
 
 toLog (AdditionalInformationGenerator $additional_info)
 
 getQuestionSetType ()
 
 withQuestionSetType (string $question_set_type)
 
 getAnonymity ()
 
 withAnonymity (bool $anonymous_test)
 
- Public Member Functions inherited from ILIAS\Test\Settings\TestSettings
 __construct (int $test_id)
 
 getTestId ()
 
 withTestId (int $test_id)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, ?array $environment=null)
 
 toStorage ()
 
 toLog (AdditionalInformationGenerator $additional_info)
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\Test\Settings\TestSettings
int $test_id
 

Detailed Description

Definition at line 30 of file SettingsGeneral.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Settings\MainSettings\SettingsGeneral::__construct ( int  $test_id,
protected string  $question_set_type = \ilObjTest::QUESTION_SET_TYPE_FIXED,
protected bool  $anonymous_test = false 
)

Definition at line 32 of file SettingsGeneral.php.

36 {
38 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\Test\Settings\TestSettings\$test_id, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAnonymity()

ILIAS\Test\Settings\MainSettings\SettingsGeneral::getAnonymity ( )

Definition at line 129 of file SettingsGeneral.php.

129 : bool
130 {
131 return $this->anonymous_test;
132 }

◆ getQuestionSetType()

ILIAS\Test\Settings\MainSettings\SettingsGeneral::getQuestionSetType ( )

Definition at line 117 of file SettingsGeneral.php.

117 : string
118 {
119 return $this->question_set_type;
120 }

◆ toForm()

ILIAS\Test\Settings\MainSettings\SettingsGeneral::toForm ( \ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery,
?array  $environment = null 
)
Returns
array<ILIAS\UI\Component\Input\Field\Input>

Reimplemented from ILIAS\Test\Settings\TestSettings.

Definition at line 44 of file SettingsGeneral.php.

49 : FormInput | array {
50 $inputs['question_set_type'] = $f->radio(
51 $lng->txt('test_question_set_type')
52 )->withOption(
54 $lng->txt('test_question_set_type_fixed'),
55 $lng->txt('test_question_set_type_fixed_info')
56 )->withOption(
58 $lng->txt('test_question_set_type_random'),
59 $lng->txt('test_question_set_type_random_info')
60 )->withValue($this->getQuestionSetType());
61
62 $trafo = $refinery->custom()->transformation(
63 static function (string $v): bool {
64 if ($v === '1') {
65 return true;
66 }
67
68 return false;
69 }
70 );
71
72 $inputs['anonymity'] = $f->radio(
73 $lng->txt('tst_anonymity')
74 )->withOption(
75 '0',
76 $lng->txt('tst_anonymity_no_anonymization')
77 )->withOption(
78 '1',
79 $lng->txt('tst_anonymity_anonymous_test')
80 )->withValue($this->getAnonymity() ? '1' : '0')
81 ->withAdditionalTransformation($trafo);
82
83 if ($environment['participant_data_exists']) {
84 $inputs['question_set_type'] = $inputs['question_set_type']->withDisabled(true);
85 $inputs['anonymity'] = $inputs['anonymity']->withDisabled(true);
86 }
87
88 return $inputs;
89 }
const QUESTION_SET_TYPE_RANDOM
const QUESTION_SET_TYPE_FIXED
global $lng
Definition: privfeed.php:31

◆ toLog()

ILIAS\Test\Settings\MainSettings\SettingsGeneral::toLog ( AdditionalInformationGenerator  $additional_info)

Reimplemented from ILIAS\Test\Settings\TestSettings.

Definition at line 99 of file SettingsGeneral.php.

99 : array
100 {
101 switch ($this->getQuestionSetType()) {
102 case \ilObjTest::QUESTION_SET_TYPE_FIXED:
104 ->getTagForLangVar('test_question_set_type_fixed');
105 break;
106 case \ilObjTest::QUESTION_SET_TYPE_RANDOM:
108 ->getTagForLangVar('test_question_set_type_random') ;
109 break;
110 }
111
112 $log_array[AdditionalInformationGenerator::KEY_TEST_ANONYMITY] = $additional_info
114 return $log_array;
115 }

References ILIAS\Test\Logging\AdditionalInformationGenerator\getEnabledDisabledTagForBool(), ILIAS\Test\Logging\AdditionalInformationGenerator\getTagForLangVar(), ILIAS\Test\Logging\AdditionalInformationGenerator\KEY_TEST_ANONYMITY, and ILIAS\Test\Logging\AdditionalInformationGenerator\KEY_TEST_QUESTION_SET_TYPE.

+ Here is the call graph for this function:

◆ toStorage()

ILIAS\Test\Settings\MainSettings\SettingsGeneral::toStorage ( )

Reimplemented from ILIAS\Test\Settings\TestSettings.

Definition at line 91 of file SettingsGeneral.php.

91 : array
92 {
93 return [
94 'question_set_type' => ['text', $this->getQuestionSetType()],
95 'anonymity' => ['integer', (int) $this->getAnonymity()]
96 ];
97 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ withAnonymity()

ILIAS\Test\Settings\MainSettings\SettingsGeneral::withAnonymity ( bool  $anonymous_test)

Definition at line 134 of file SettingsGeneral.php.

134 : self
135 {
136 $clone = clone $this;
137 $clone->anonymous_test = $anonymous_test;
138 return $clone;
139 }

◆ withQuestionSetType()

ILIAS\Test\Settings\MainSettings\SettingsGeneral::withQuestionSetType ( string  $question_set_type)

Definition at line 122 of file SettingsGeneral.php.

122 : self
123 {
124 $clone = clone $this;
125 $clone->question_set_type = $question_set_type;
126 return $clone;
127 }

Referenced by ILIAS\Test\Settings\MainSettings\SettingsMainGUI\getGeneralSettingsForStorage().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: