ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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.

References ILIAS\GlobalScreen\Provider\__construct().

36  {
38  }
__construct(Container $dic, ilPlugin $plugin)
+ 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.

Referenced by ILIAS\Test\Settings\MainSettings\SettingsGeneral\toForm(), ILIAS\Test\Settings\MainSettings\SettingsGeneral\toLog(), and ILIAS\Test\Settings\MainSettings\SettingsGeneral\toStorage().

129  : bool
130  {
131  return $this->anonymous_test;
132  }
+ Here is the caller graph for this function:

◆ getQuestionSetType()

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

Definition at line 117 of file SettingsGeneral.php.

Referenced by ILIAS\Test\Settings\MainSettings\SettingsGeneral\toForm(), ILIAS\Test\Settings\MainSettings\SettingsGeneral\toLog(), and ILIAS\Test\Settings\MainSettings\SettingsGeneral\toStorage().

117  : string
118  {
119  return $this->question_set_type;
120  }
+ Here is the caller graph for this function:

◆ toForm()

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

Definition at line 44 of file SettingsGeneral.php.

References ILIAS\UI\Implementation\Component\Input\$inputs, ILIAS\Test\Settings\MainSettings\SettingsGeneral\getAnonymity(), ILIAS\Test\Settings\MainSettings\SettingsGeneral\getQuestionSetType(), ilObjTest\QUESTION_SET_TYPE_FIXED, ilObjTest\QUESTION_SET_TYPE_RANDOM, ilLanguage\txt(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\withValue().

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')
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
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
global $lng
Definition: privfeed.php:31
const QUESTION_SET_TYPE_FIXED
+ Here is the call graph for this function:

◆ toLog()

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

Definition at line 99 of file SettingsGeneral.php.

References ILIAS\Test\Settings\MainSettings\SettingsGeneral\getAnonymity(), ILIAS\Test\Logging\AdditionalInformationGenerator\getEnabledDisabledTagForBool(), ILIAS\Test\Settings\MainSettings\SettingsGeneral\getQuestionSetType(), ILIAS\Test\Logging\AdditionalInformationGenerator\getTagForLangVar(), ILIAS\Test\Logging\AdditionalInformationGenerator\KEY_TEST_ANONYMITY, and ILIAS\Test\Logging\AdditionalInformationGenerator\KEY_TEST_QUESTION_SET_TYPE.

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
113  ->getEnabledDisabledTagForBool($this->getAnonymity());
114  return $log_array;
115  }
+ Here is the call graph for this function:

◆ toStorage()

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

Definition at line 91 of file SettingsGeneral.php.

References ILIAS\Test\Settings\MainSettings\SettingsGeneral\getAnonymity(), ILIAS\Test\Settings\MainSettings\SettingsGeneral\getQuestionSetType(), and ILIAS\Repository\int().

91  : array
92  {
93  return [
94  'question_set_type' => ['text', $this->getQuestionSetType()],
95  'anonymity' => ['integer', (int) $this->getAnonymity()]
96  ];
97  }
+ 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.

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

122  : self
123  {
124  $clone = clone $this;
125  $clone->question_set_type = $question_set_type;
126  return $clone;
127  }
+ Here is the caller graph for this function:

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