ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjTestSettingsResultSummary Class Reference
+ Inheritance diagram for ilObjTestSettingsResultSummary:
+ Collaboration diagram for ilObjTestSettingsResultSummary:

Public Member Functions

 __construct (int $test_id)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
 
 toStorage ()
 
 getScoreReporting ()
 
 withScoreReporting (int $score_reporting)
 
 getScoreReportingEnabled ()
 
 getReportingDate ()
 
 withReportingDate (?\DateTimeImmutable $reporting_date)
 
 getShowGradingStatusEnabled ()
 
 withShowGradingStatusEnabled (bool $show_grading_status)
 
 getShowGradingMarkEnabled ()
 
 withShowGradingMarkEnabled (bool $show_grading_mark)
 
 getPassDeletionAllowed ()
 
 withPassDeletionAllowed (bool $pass_deletion_allowed)
 
 getShowPassDetails ()
 
 withShowPassDetails (bool $flag)
 
- Public Member Functions inherited from TestSettings
 __construct (int $test_id)
 
 getTestId ()
 
 withTestId (int $test_id)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
 
 toStorage ()
 

Data Fields

const SCORE_REPORTING_DISABLED = 0
 
const SCORE_REPORTING_FINISHED = 1
 
const SCORE_REPORTING_IMMIDIATLY = 2
 
const SCORE_REPORTING_DATE = 3
 
const SCORE_REPORTING_AFTER_PASSED = 4
 

Protected Attributes

int $score_reporting = 0
 
DateTimeImmutable $reporting_date = null
 
bool $pass_deletion_allowed = false
 
bool $show_pass_details = false
 this is derived from results_presentation with RESULTPRES_BIT_PASS_DETAILS; see ilObjTestSettingsResultDetails More...
 
bool $show_grading_status = false
 
bool $show_grading_mark = false
 
- Protected Attributes inherited from TestSettings
int $test_id
 

Detailed Description

Definition at line 25 of file ilObjTestSettingsResultSummary.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjTestSettingsResultSummary::__construct ( int  $test_id)

Definition at line 44 of file ilObjTestSettingsResultSummary.php.

References ILIAS\MetaData\Repository\Validation\Data\__construct().

45  {
47  }
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ getPassDeletionAllowed()

ilObjTestSettingsResultSummary::getPassDeletionAllowed ( )

Definition at line 230 of file ilObjTestSettingsResultSummary.php.

References $pass_deletion_allowed.

Referenced by toForm(), and toStorage().

230  : bool
231  {
233  }
+ Here is the caller graph for this function:

◆ getReportingDate()

ilObjTestSettingsResultSummary::getReportingDate ( )

Definition at line 197 of file ilObjTestSettingsResultSummary.php.

References $reporting_date.

Referenced by toForm(), and toStorage().

197  : ?\DateTimeImmutable
198  {
199  return $this->reporting_date;
200  }
+ Here is the caller graph for this function:

◆ getScoreReporting()

ilObjTestSettingsResultSummary::getScoreReporting ( )

Definition at line 181 of file ilObjTestSettingsResultSummary.php.

References $score_reporting.

Referenced by toForm(), and toStorage().

181  : int
182  {
183  return $this->score_reporting;
184  }
+ Here is the caller graph for this function:

◆ getScoreReportingEnabled()

ilObjTestSettingsResultSummary::getScoreReportingEnabled ( )

Definition at line 192 of file ilObjTestSettingsResultSummary.php.

Referenced by toForm().

192  : bool
193  {
194  return $this->score_reporting !== self::SCORE_REPORTING_DISABLED;
195  }
+ Here is the caller graph for this function:

◆ getShowGradingMarkEnabled()

ilObjTestSettingsResultSummary::getShowGradingMarkEnabled ( )

Definition at line 219 of file ilObjTestSettingsResultSummary.php.

References $show_grading_mark.

Referenced by toForm(), and toStorage().

219  : bool
220  {
222  }
+ Here is the caller graph for this function:

◆ getShowGradingStatusEnabled()

ilObjTestSettingsResultSummary::getShowGradingStatusEnabled ( )

Definition at line 208 of file ilObjTestSettingsResultSummary.php.

References $show_grading_status.

Referenced by toForm(), and toStorage().

208  : bool
209  {
211  }
+ Here is the caller graph for this function:

◆ getShowPassDetails()

ilObjTestSettingsResultSummary::getShowPassDetails ( )

Definition at line 241 of file ilObjTestSettingsResultSummary.php.

References $show_pass_details.

Referenced by toForm().

241  : bool
242  {
244  }
bool $show_pass_details
this is derived from results_presentation with RESULTPRES_BIT_PASS_DETAILS; see ilObjTestSettingsResu...
+ Here is the caller graph for this function:

◆ toForm()

ilObjTestSettingsResultSummary::toForm ( \ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery,
array  $environment = null 
)

Definition at line 49 of file ilObjTestSettingsResultSummary.php.

References ILIAS\LTI\ToolProvider\$settings, getPassDeletionAllowed(), getReportingDate(), getScoreReporting(), getScoreReportingEnabled(), getShowGradingMarkEnabled(), getShowGradingStatusEnabled(), getShowPassDetails(), ILIAS\Repository\int(), ilLanguage\txt(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Component\Input\Input\withAdditionalTransformation().

54  : FormInput {
55  $trafo = $refinery->custom()->transformation(
56  function ($v) {
57  list($mode, $date) = $v;
58  if (count($date) < 1) {
59  $date = null;
60  } else {
61  $date = array_shift($date);
62  }
63  return [(int) $mode, $date];
64  }
65  );
66 
67  $results_time_group = $f->switchableGroup(
68  [
69  self::SCORE_REPORTING_IMMIDIATLY => $f->group([], $lng->txt('tst_results_access_always'), $lng->txt('tst_results_access_always_desc')),
70  self::SCORE_REPORTING_FINISHED => $f->group([], $lng->txt('tst_results_access_finished'), $lng->txt('tst_results_access_finished_desc')),
71  self::SCORE_REPORTING_AFTER_PASSED => $f->group([], $lng->txt('tst_results_access_passed'), $lng->txt('tst_results_access_passed_desc')),
72  self::SCORE_REPORTING_DATE => $f->group(
73  [
74  $f->dateTime($lng->txt('tst_reporting_date'), "")
75  ->withTimezone($environment['user_time_zone'])
76  ->withFormat($environment['user_date_format'])
77  ->withUseTime(true)
78  ->withValue(
79  $this->getReportingDate()?->setTimezone(
80  new DateTimeZone($environment['user_time_zone'])
81  )
82  )
83  ->withRequired(true)
84  ],
85  $lng->txt('tst_results_access_date'),
86  $lng->txt('tst_results_access_date_desc')
87  )
88  ],
89  $lng->txt('tst_results_access_setting'),
90  ""
91  )
92  ->withRequired(true)
93  ->withAdditionalTransformation($trafo);
94 
95  if ($this->getScoreReporting() > 0) {
96  $results_time_group = $results_time_group->withValue($this->getScoreReporting());
97  }
98 
99 
100  $optional_group = $f->optionalGroup(
101  [
102  'score_reporting_mode' => $results_time_group,
103  'show_grading_status' => $f->checkbox(
104  $lng->txt('tst_results_grading_opt_show_status'),
105  $lng->txt('tst_results_grading_opt_show_status_desc')
106  ),
107  'show_grading_mark' => $f->checkbox(
108  $lng->txt('tst_results_grading_opt_show_mark'),
109  $lng->txt('tst_results_grading_opt_show_mark_desc')
110  ),
111  'show_pass_details' => $f->checkbox(
112  $lng->txt('tst_results_grading_opt_show_details'),
113  $lng->txt('tst_results_grading_opt_show_details_desc')
114  ),
115  'pass_deletion_allowed' => $f->checkbox(
116  $lng->txt('tst_pass_deletion'),
117  $lng->txt('tst_pass_deletion_allowed')
118  )
119  ],
120  $lng->txt('tst_results_access_enabled'),
121  $lng->txt('tst_results_access_enabled_desc')
122  );
123 
124  if ($this->getScoreReportingEnabled()) {
125  $optional_group = $optional_group->withValue(
126  [
127  "score_reporting_mode" => $this->getScoreReporting(),
128  "show_grading_status" => $this->getShowGradingStatusEnabled(),
129  "show_grading_mark" => $this->getShowGradingMarkEnabled(),
130  "show_pass_details" => $this->getShowPassDetails(),
131  "pass_deletion_allowed" => $this->getPassDeletionAllowed()
132  ]
133  );
134  } else {
135  $optional_group = $optional_group->withValue(null);
136  }
137 
138  $fields = ['score_reporting' => $optional_group];
139  return $f->section($fields, $lng->txt('test_results'))
141  $refinery->custom()->transformation(
142  function ($v) {
143  $settings = clone $this;
144  $mode = 0;
145  $date = null;
146  if ($v['score_reporting']) {
147  list($mode, $date) = $v['score_reporting']['score_reporting_mode'];
149  ->withShowGradingStatusEnabled($v['score_reporting']['show_grading_status'])
150  ->withShowGradingMarkEnabled($v['score_reporting']['show_grading_mark'])
151  ->withShowPassDetails($v['score_reporting']['show_pass_details'])
152  ->withPassDeletionAllowed($v['score_reporting']['pass_deletion_allowed'])
153  ;
154  }
155  return $settings
156  ->withScoreReporting((int) $mode)
157  ->withReportingDate($date);
158  }
159  )
160  );
161  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
$lng
This describes inputs that can be used in forms.
Definition: FormInput.php:31
Refinery Factory $refinery
+ Here is the call graph for this function:

◆ toStorage()

ilObjTestSettingsResultSummary::toStorage ( )

Definition at line 163 of file ilObjTestSettingsResultSummary.php.

References getPassDeletionAllowed(), getReportingDate(), getScoreReporting(), getShowGradingMarkEnabled(), getShowGradingStatusEnabled(), ILIAS\Repository\int(), and ilObjTestScoreSettingsDatabaseRepository\STORAGE_DATE_FORMAT.

163  : array
164  {
165  $dat = $this->getReportingDate();
166  if ($dat) {
167  $dat = $dat->setTimezone(new DateTimeZone('UTC'))
169  }
170  return [
171  'pass_deletion_allowed' => ['integer', (int) $this->getPassDeletionAllowed()],
172  'score_reporting' => ['integer', $this->getScoreReporting()],
173  'reporting_date' => ['text', (string) $dat],
174  'show_grading_status' => ['integer', (int) $this->getShowGradingStatusEnabled()],
175  'show_grading_mark' => ['integer', (int) $this->getShowGradingMarkEnabled()]
176  //show_pass_details
177  ];
178  }
+ Here is the call graph for this function:

◆ withPassDeletionAllowed()

ilObjTestSettingsResultSummary::withPassDeletionAllowed ( bool  $pass_deletion_allowed)

Definition at line 234 of file ilObjTestSettingsResultSummary.php.

References $pass_deletion_allowed.

234  : self
235  {
236  $clone = clone $this;
237  $clone->pass_deletion_allowed = $pass_deletion_allowed;
238  return $clone;
239  }

◆ withReportingDate()

ilObjTestSettingsResultSummary::withReportingDate ( ?\DateTimeImmutable  $reporting_date)

Definition at line 201 of file ilObjTestSettingsResultSummary.php.

References $reporting_date.

201  : self
202  {
203  $clone = clone $this;
204  $clone->reporting_date = $reporting_date;
205  return $clone;
206  }

◆ withScoreReporting()

ilObjTestSettingsResultSummary::withScoreReporting ( int  $score_reporting)

Definition at line 185 of file ilObjTestSettingsResultSummary.php.

References $score_reporting.

185  : self
186  {
187  $clone = clone $this;
188  $clone->score_reporting = $score_reporting;
189  return $clone;
190  }

◆ withShowGradingMarkEnabled()

ilObjTestSettingsResultSummary::withShowGradingMarkEnabled ( bool  $show_grading_mark)

Definition at line 223 of file ilObjTestSettingsResultSummary.php.

References $show_grading_mark.

223  : self
224  {
225  $clone = clone $this;
226  $clone->show_grading_mark = $show_grading_mark;
227  return $clone;
228  }

◆ withShowGradingStatusEnabled()

ilObjTestSettingsResultSummary::withShowGradingStatusEnabled ( bool  $show_grading_status)

Definition at line 212 of file ilObjTestSettingsResultSummary.php.

References $show_grading_status.

212  : self
213  {
214  $clone = clone $this;
215  $clone->show_grading_status = $show_grading_status;
216  return $clone;
217  }

◆ withShowPassDetails()

ilObjTestSettingsResultSummary::withShowPassDetails ( bool  $flag)

Definition at line 245 of file ilObjTestSettingsResultSummary.php.

Referenced by ilObjTestScoreSettings\__construct().

245  : self
246  {
247  $clone = clone $this;
248  $clone->show_pass_details = $flag;
249  return $clone;
250  }
+ Here is the caller graph for this function:

Field Documentation

◆ $pass_deletion_allowed

bool ilObjTestSettingsResultSummary::$pass_deletion_allowed = false
protected

◆ $reporting_date

DateTimeImmutable ilObjTestSettingsResultSummary::$reporting_date = null
protected

Definition at line 34 of file ilObjTestSettingsResultSummary.php.

Referenced by getReportingDate(), and withReportingDate().

◆ $score_reporting

int ilObjTestSettingsResultSummary::$score_reporting = 0
protected

Definition at line 33 of file ilObjTestSettingsResultSummary.php.

Referenced by getScoreReporting(), and withScoreReporting().

◆ $show_grading_mark

bool ilObjTestSettingsResultSummary::$show_grading_mark = false
protected

◆ $show_grading_status

bool ilObjTestSettingsResultSummary::$show_grading_status = false
protected

◆ $show_pass_details

bool ilObjTestSettingsResultSummary::$show_pass_details = false
protected

this is derived from results_presentation with RESULTPRES_BIT_PASS_DETAILS; see ilObjTestSettingsResultDetails

Definition at line 40 of file ilObjTestSettingsResultSummary.php.

Referenced by getShowPassDetails().

◆ SCORE_REPORTING_AFTER_PASSED

const ilObjTestSettingsResultSummary::SCORE_REPORTING_AFTER_PASSED = 4

◆ SCORE_REPORTING_DATE

◆ SCORE_REPORTING_DISABLED

const ilObjTestSettingsResultSummary::SCORE_REPORTING_DISABLED = 0

◆ SCORE_REPORTING_FINISHED

const ilObjTestSettingsResultSummary::SCORE_REPORTING_FINISHED = 1

◆ SCORE_REPORTING_IMMIDIATLY

const ilObjTestSettingsResultSummary::SCORE_REPORTING_IMMIDIATLY = 2

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