19declare(strict_types=1);
51 array $environment =
null
55 list($mode, $date) = $v;
56 if (count($date) < 1) {
59 $date = array_shift($date);
61 return [(
int) $mode, $date];
66 if ($reporting_date !==
null) {
68 new DateTimeZone($environment[
'user_time_zone'])
69 )->format($environment[
'user_date_format']->toString() .
' H:i');
72 $results_time_group =
$f->switchableGroup(
74 self::SCORE_REPORTING_IMMIDIATLY =>
$f->group([],
$lng->txt(
'tst_results_access_always'),
$lng->txt(
'tst_results_access_always_desc')),
75 self::SCORE_REPORTING_FINISHED =>
$f->group([],
$lng->txt(
'tst_results_access_finished'),
$lng->txt(
'tst_results_access_finished_desc')),
76 self::SCORE_REPORTING_AFTER_PASSED =>
$f->group([],
$lng->txt(
'tst_results_access_passed'),
$lng->txt(
'tst_results_access_passed_desc')),
77 self::SCORE_REPORTING_DATE =>
$f->group(
79 $f->dateTime(
$lng->txt(
'tst_reporting_date'),
"")
80 ->withTimezone($environment[
'user_time_zone'])
82 ->withFormat($environment[
'user_date_format'])
88 $lng->txt(
'tst_results_access_date'),
89 $lng->txt(
'tst_results_access_date_desc')
92 $lng->txt(
'tst_results_access_setting'),
96 ->withAdditionalTransformation($trafo);
102 $optional_group =
$f->optionalGroup(
104 'score_reporting_mode' => $results_time_group,
105 'show_grading_status' =>
$f->checkbox(
106 $lng->txt(
'tst_results_grading_opt_show_status'),
107 $lng->txt(
'tst_results_grading_opt_show_status_desc')
109 'show_grading_mark' =>
$f->checkbox(
110 $lng->txt(
'tst_results_grading_opt_show_mark'),
111 $lng->txt(
'tst_results_grading_opt_show_mark_desc')
113 'show_pass_details' =>
$f->checkbox(
114 $lng->txt(
'tst_results_grading_opt_show_details'),
115 $lng->txt(
'tst_results_grading_opt_show_details_desc')
117 'pass_deletion_allowed' =>
$f->checkbox(
118 $lng->txt(
'tst_pass_deletion'),
119 $lng->txt(
'tst_pass_deletion_allowed')
122 $lng->txt(
'tst_results_access_enabled'),
123 $lng->txt(
'tst_results_access_enabled_desc')
127 $optional_group = $optional_group->withValue(
137 $optional_group = $optional_group->withValue(
null);
140 $fields = [
'score_reporting' => $optional_group];
141 return $f->section($fields,
$lng->txt(
'test_results'))
142 ->withAdditionalTransformation(
148 if ($v[
'score_reporting']) {
149 list($mode, $date) = $v[
'score_reporting'][
'score_reporting_mode'];
151 ->withShowGradingStatusEnabled($v[
'score_reporting'][
'show_grading_status'])
152 ->withShowGradingMarkEnabled($v[
'score_reporting'][
'show_grading_mark'])
153 ->withShowPassDetails($v[
'score_reporting'][
'show_pass_details'])
154 ->withPassDeletionAllowed($v[
'score_reporting'][
'pass_deletion_allowed'])
158 ->withScoreReporting((
int) $mode)
159 ->withReportingDate($date);
167 $dat = $this->getReportingDate();
169 $dat = $dat->setTimezone(
new DateTimeZone(
'UTC'))
173 'pass_deletion_allowed' => [
'integer', (
int) $this->getPassDeletionAllowed()],
174 'score_reporting' => [
'integer', $this->getScoreReporting()],
175 'reporting_date' => [
'text', (string) $dat],
176 'show_grading_status' => [
'integer', (
int) $this->getShowGradingStatusEnabled()],
177 'show_grading_mark' => [
'integer', (
int) $this->getShowGradingMarkEnabled()]
185 return $this->score_reporting;
189 $clone = clone $this;
190 $clone->score_reporting = $score_reporting;
196 return $this->score_reporting !== self::SCORE_REPORTING_DISABLED;
201 return $this->reporting_date;
205 $clone = clone $this;
206 $clone->reporting_date = $reporting_date;
212 return $this->show_grading_status;
216 $clone = clone $this;
217 $clone->show_grading_status = $show_grading_status;
223 return $this->show_grading_mark;
227 $clone = clone $this;
228 $clone->show_grading_mark = $show_grading_mark;
234 return $this->pass_deletion_allowed;
238 $clone = clone $this;
239 $clone->pass_deletion_allowed = $pass_deletion_allowed;
245 return $this->show_pass_details;
249 $clone = clone $this;
250 $clone->show_pass_details = $flag;
static return function(ContainerConfigurator $containerConfigurator)
const STORAGE_DATE_FORMAT
withShowGradingStatusEnabled(bool $show_grading_status)
__construct(int $test_id)
getShowGradingStatusEnabled()
const SCORE_REPORTING_IMMIDIATLY
getScoreReportingEnabled()
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
const SCORE_REPORTING_DISABLED
bool $pass_deletion_allowed
withPassDeletionAllowed(bool $pass_deletion_allowed)
withShowGradingMarkEnabled(bool $show_grading_mark)
const SCORE_REPORTING_FINISHED
const SCORE_REPORTING_DATE
withReportingDate(?\DateTimeImmutable $reporting_date)
withShowPassDetails(bool $flag)
getShowGradingMarkEnabled()
DateTimeImmutable $reporting_date
bool $show_pass_details
this is derived from results_presentation with RESULTPRES_BIT_PASS_DETAILS; see ilObjTestSettingsResu...
const SCORE_REPORTING_AFTER_PASSED
withScoreReporting(int $score_reporting)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Refinery Factory $refinery