19declare(strict_types=1);
47 ?array $environment =
null
51 list($mode, $date) = $v;
52 if (count($date) < 1) {
55 $date = array_shift($date);
57 return [(
int) $mode, $date];
61 $results_time_group =
$f->switchableGroup(
63 ScoreReportingTypes::SCORE_REPORTING_IMMIDIATLY->value =>
$f->group([],
$lng->txt(
'tst_results_access_always'),
$lng->txt(
'tst_results_access_always_desc')),
64 ScoreReportingTypes::SCORE_REPORTING_FINISHED->value =>
$f->group([],
$lng->txt(
'tst_results_access_finished'),
$lng->txt(
'tst_results_access_finished_desc')),
65 ScoreReportingTypes::SCORE_REPORTING_AFTER_PASSED->value =>
$f->group([],
$lng->txt(
'tst_results_access_passed'),
$lng->txt(
'tst_results_access_passed_desc')),
66 ScoreReportingTypes::SCORE_REPORTING_DATE->value =>
$f->group(
68 $f->dateTime(
$lng->txt(
'tst_reporting_date'),
"")
69 ->withTimezone($environment[
'user_time_zone'])
70 ->withFormat($environment[
'user_date_format'])
74 new \DateTimeZone($environment[
'user_time_zone'])
79 $lng->txt(
'tst_results_access_date'),
80 $lng->txt(
'tst_results_access_date_desc')
83 $lng->txt(
'tst_results_access_setting'),
87 ->withAdditionalTransformation($trafo);
89 if ($this->
getScoreReporting() !== ScoreReportingTypes::SCORE_REPORTING_DISABLED) {
90 $results_time_group = $results_time_group->withValue($this->
getScoreReporting()->value);
94 $optional_group =
$f->optionalGroup(
96 'score_reporting_mode' => $results_time_group,
97 'show_grading_status' =>
$f->checkbox(
98 $lng->txt(
'tst_results_grading_opt_show_status'),
99 $lng->txt(
'tst_results_grading_opt_show_status_desc')
101 'show_grading_mark' =>
$f->checkbox(
102 $lng->txt(
'tst_results_grading_opt_show_mark'),
103 $lng->txt(
'tst_results_grading_opt_show_mark_desc')
105 'show_pass_details' =>
$f->checkbox(
106 $lng->txt(
'tst_results_grading_opt_show_details'),
107 $lng->txt(
'tst_results_grading_opt_show_details_desc')
109 'pass_deletion_allowed' =>
$f->checkbox(
110 $lng->txt(
'tst_pass_deletion'),
111 $lng->txt(
'tst_pass_deletion_allowed')
114 $lng->txt(
'tst_results_access_enabled'),
115 $lng->txt(
'tst_results_access_enabled_desc')
119 $optional_group = $optional_group->withValue(
129 $optional_group = $optional_group->withValue(
null);
132 $fields = [
'score_reporting' => $optional_group];
133 return $f->section($fields,
$lng->txt(
'test_results'))
137 $settings = clone $this;
140 if ($v[
'score_reporting']) {
141 list($mode, $date) = $v[
'score_reporting'][
'score_reporting_mode'];
142 $settings = $settings
143 ->withShowGradingStatusEnabled($v[
'score_reporting'][
'show_grading_status'])
144 ->withShowGradingMarkEnabled($v[
'score_reporting'][
'show_grading_mark'])
145 ->withShowPassDetails($v[
'score_reporting'][
'show_pass_details'])
146 ->withPassDeletionAllowed($v[
'score_reporting'][
'pass_deletion_allowed'])
151 ->withReportingDate($date);
162 'reporting_date' => [
\ilDBConstants::T_INTEGER, $this->getReportingDate() !==
null ? $this->getReportingDate()->getTimestamp() : 0],
170 switch ($this->getScoreReporting()) {
171 case ScoreReportingTypes::SCORE_REPORTING_DISABLED:
175 case ScoreReportingTypes::SCORE_REPORTING_FINISHED:
178 $log_array += $this->getLogEntriesForScoreReportingEnabled($additional_info);
180 case ScoreReportingTypes::SCORE_REPORTING_IMMIDIATLY:
183 $log_array += $this->getLogEntriesForScoreReportingEnabled($additional_info);
185 case ScoreReportingTypes::SCORE_REPORTING_DATE:
188 $log_array += $this->getLogEntriesForScoreReportingEnabled($additional_info);
190 case ScoreReportingTypes::SCORE_REPORTING_AFTER_PASSED:
193 $log_array += $this->getLogEntriesForScoreReportingEnabled($additional_info);
204 ->getEnabledDisabledTagForBool($this->getShowGradingStatusEnabled()),
206 ->getEnabledDisabledTagForBool($this->getShowGradingMarkEnabled()),
208 ->getEnabledDisabledTagForBool($this->getShowPassDetails()),
210 ->getEnabledDisabledTagForBool($this->getPassDeletionAllowed())
216 return $this->score_reporting;
220 $clone = clone $this;
221 $clone->score_reporting = $score_reporting;
227 return $this->reporting_date;
231 $clone = clone $this;
232 $clone->reporting_date = $reporting_date;
238 return $this->show_grading_status;
242 $clone = clone $this;
243 $clone->show_grading_status = $show_grading_status;
249 return $this->show_grading_mark;
253 $clone = clone $this;
254 $clone->show_grading_mark = $show_grading_mark;
260 return $this->pass_deletion_allowed;
264 $clone = clone $this;
265 $clone->pass_deletion_allowed = $pass_deletion_allowed;
271 return $this->show_pass_details;
275 $clone = clone $this;
276 $clone->show_pass_details = $flag;
283 'score_reporting' => $this->getScoreReporting()->value,
284 'reporting_date' => $this->getReportingDate()?->format(\DateTimeInterface::ATOM),
285 'show_grading_status' => $this->getShowGradingStatusEnabled(),
286 'show_grading_mark' => $this->getShowGradingMarkEnabled(),
287 'show_pass_details' => $this->getShowPassDetails(),
288 'pass_deletion_allowed' => $this->getPassDeletionAllowed()
296 ->withReportingDate(
$data[
'reporting_date'] !== 0 ?
new \DateTimeImmutable(
$data[
'reporting_date']) :
null)
297 ->withShowGradingStatusEnabled((
bool)
$data[
'show_grading_status'])
298 ->withShowGradingMarkEnabled((
bool)
$data[
'show_grading_mark'])
299 ->withShowPassDetails((
bool)
$data[
'show_pass_details'])
300 ->withPassDeletionAllowed((
bool)
$data[
'pass_deletion_allowed']);
bool $show_grading_status
bool $show_pass_details
this is derived from results_presentation with RESULTPRES_BIT_PASS_DETAILS; see ilObjTestSettingsResu...
withPassDeletionAllowed(bool $pass_deletion_allowed)
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, ?array $environment=null)
ScoreReportingTypes $score_reporting
bool $pass_deletion_allowed
withShowPassDetails(bool $flag)
toLog(AdditionalInformationGenerator $additional_info)
getShowGradingStatusEnabled()
DateTimeImmutable $reporting_date
withReportingDate(?\DateTimeImmutable $reporting_date)
withScoreReporting(ScoreReportingTypes $score_reporting)
toExport()
Transform the object into a simple, associative array.
static fromExport(array $data)
Creates an instance of the object from an array.
withShowGradingMarkEnabled(bool $show_grading_mark)
withShowGradingStatusEnabled(bool $show_grading_status)
getShowGradingMarkEnabled()
getLogEntriesForScoreReportingEnabled(AdditionalInformationGenerator $additional_info)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This interface allows an object to define its own transformation into a language-neutral,...