19 declare(strict_types=1);
94 $this->tpl = $main_template;
101 $this->component_repository,
105 $templateId = $this->testOBJ->getTemplate();
119 $this->request = $request;
124 return $this->score_settings_repo->getFor($this->test_id);
128 $this->score_settings_repo->store($score_settings);
136 if (!$this->
access->checkAccess(
'write',
'', $this->testGUI->getRefId())) {
137 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'cannot_edit_test'),
true);
138 $this->
ctrl->redirect($this->testGUI,
'infoScreen');
143 $nextClass = $this->
ctrl->getNextClass();
144 switch ($nextClass) {
146 $cmd = $this->
ctrl->getCmd(self::CMD_SHOW_FORM);
149 case self::CMD_SHOW_FORM:
152 case self::CMD_SAVE_FORM:
155 case self::CMD_CONFIRMED_RECALC:
161 $this->testOBJ->recalculateScores(
true);
162 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_score_settings_modified_and_recalc"),
true);
163 $this->
ctrl->redirect($this, self::CMD_SHOW_FORM);
165 case self::CMD_CANCEL_RECALC:
166 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"msg_score_settings_not_modified"),
true);
171 throw new Exception(
'unknown command: ' . $cmd);
178 if ($form === null) {
182 $this->tpl->setContent($this->ui_renderer->render($form));
188 ->withRequest($this->request);
193 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'form_input_not_valid'));
207 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
208 $this->
ctrl->redirect($this, self::CMD_SHOW_FORM);
215 $this->request->getParsedBody()[self::F_CONFIRM_SETTINGS]
224 $this->ui_factory->input()->field(),
229 $df = (new \ILIAS\Data\Factory())->dateFormat();
230 switch ($this->active_user->getDateFormat()) {
232 $date_format = $df->germanShort();
236 $date_format = $df->custom()->month()->slash()->day()->slash()->year()->get();
240 $date_format = $df->standard();
242 $environment[
'user_date_format'] = $date_format;
243 $environment[
'user_time_zone'] = $this->active_user->getTimeZone();
249 'scoring' =>
$settings->getScoringSettings()->toForm(...$ui_pack)
250 ->withDisabled($disabled_flag),
251 'summary' =>
$settings->getResultSummarySettings()->toForm(...array_merge($ui_pack, [$environment])),
252 'details' =>
$settings->getResultDetailsSettings()->toForm(
255 'gameification' =>
$settings->getGamificationSettings()->toForm(...$ui_pack)
258 $action = $this->
ctrl->getFormAction($this, self::CMD_SAVE_FORM);
259 $form = $this->ui_factory->input()->container()->form()
260 ->standard($action, $sections)
261 ->withAdditionalTransformation(
262 $this->
refinery->custom()->transformation(
265 ->withScoringSettings($v[
'scoring'])
266 ->withResultSummarySettings($v[
'summary'])
267 ->withResultDetailsSettings($v[
'details'])
268 ->withGamificationSettings($v[
'gameification'])
276 private function isScoreReportingAvailable():
bool 278 if (!$this->testOBJ->getScoreReporting()) {
284 $reporting_date = $this->testOBJ->getScoreSettings()->getResultSummarySettings()->getReportingDate();
293 if (!$this->testOBJ->participantDataExist()) {
297 if (!$this->isScoreReportingAvailable()) {
308 $taxononmy_translator->loadLabelsFromTaxonomyIds($available_taxonomy_ids);
310 $taxonomy_options = [];
311 foreach ($available_taxonomy_ids as $tax_id) {
312 $taxonomy_options[$tax_id] = $taxononmy_translator->getTaxonomyTreeLabel($tax_id);
314 return $taxonomy_options;
321 $settings_changed = (
328 $this->testOBJ->participantDataExist() &&
337 $confirmation->setHeaderText($this->
lng->txt(
'tst_trigger_result_refreshing'));
338 $confirmation->setFormAction($this->
ctrl->getFormAction($this));
339 $confirmation->setCancel($this->
lng->txt(
'cancel'), self::CMD_CANCEL_RECALC);
340 $confirmation->setConfirm($this->
lng->txt(
'confirm'), self::CMD_CONFIRMED_RECALC);
341 $confirmation->addHiddenItem(self::F_CONFIRM_SETTINGS, base64_encode(serialize($request)));
342 $this->tpl->setContent($this->
ctrl->getHTML($confirmation));
static getSettingsTemplateConfig()
__construct(ilCtrlInterface $ctrl, ilAccessHandler $access, ilLanguage $lng, ilTree $tree, ilDBInterface $db, ilComponentRepository $component_repository, ilObjTestGUI $testGUI, \ilGlobalTemplateInterface $main_template, ilTabsGUI $tabs, ScoreSettingsRepository $score_settings_repo, int $test_id, UIFactory $ui_factory, UIRenderer $ui_renderer, Refinery $refinery, Request $request, ilObjUser $active_user)
ilTestQuestionSetConfigFactory $testQuestionSetConfigFactory
Readable part of repository interface to ilComponentDataDB.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CMD_SHOW_FORM
command constants
ScoreSettingsRepository $score_settings_repo
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
ilGlobalTemplateInterface $tpl
ilComponentRepository $component_repository
executeCommand()
Command Execution.
areScoringSettingsWritable()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
showForm(Form $form=null)
const SCORE_REPORTING_DATE
storeScoreSettings(ilObjTestScoreSettings $score_settings)
showConfirmation(Request $request)
isScoreRecalculationRequired(ilObjTestSettingsScoring $new_settings, ilObjTestSettingsScoring $old_settings)
const CMD_CONFIRMED_RECALC
Settings template application class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...