19 declare(strict_types=1);
60 protected int $test_id,
69 $template_id = $this->test_object->getTemplate();
72 $this->settingsTemplate =
new ilSettingsTemplate(
74 ilObjAssessmentFolderGUI::getSettingsTemplateConfig()
81 return $this->score_settings_repo->getFor($this->test_id);
85 $this->score_settings_repo->store($score_settings);
93 if (!$this->
access->checkAccess(
'write',
'', $this->test_gui->getRefId())) {
94 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'cannot_edit_test'),
true);
95 $this->
ctrl->redirect($this->test_gui,
'infoScreen');
100 $nextClass = $this->
ctrl->getNextClass();
101 switch ($nextClass) {
103 $cmd = $this->
ctrl->getCmd(self::CMD_SHOW_FORM);
106 case self::CMD_SHOW_FORM:
109 case self::CMD_SAVE_FORM:
112 case self::CMD_CONFIRMED_RECALC:
118 $this->test_object->recalculateScores(
true);
119 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_score_settings_modified_and_recalc"),
true);
120 $this->
ctrl->redirect($this, self::CMD_SHOW_FORM);
122 case self::CMD_CANCEL_RECALC:
123 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"msg_score_settings_not_modified"),
true);
128 throw new Exception(
'unknown command: ' . $cmd);
135 if ($form === null) {
139 $this->tpl->setContent($this->ui_renderer->render($form));
145 ->withRequest($this->request);
150 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'form_input_not_valid'));
164 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
165 $this->
ctrl->redirect($this, self::CMD_SHOW_FORM);
172 $this->request->getParsedBody()[self::F_CONFIRM_SETTINGS]
181 $this->ui_factory->input()->field(),
187 $environment[
'user_date_format'] = (new \ILIAS\Data\Factory())->dateFormat()->withTime24(
188 $this->active_user->getDateFormat()
190 $environment[
'user_time_zone'] = $this->active_user->getTimeZone();
192 $anonymity_flag = (bool) $this->test_object->getAnonymity();
197 'scoring' =>
$settings->getScoringSettings()->toForm(...$ui_pack)
198 ->withDisabled($disabled_flag),
199 'summary' =>
$settings->getResultSummarySettings()->toForm(...array_merge($ui_pack, [$environment])),
200 'details' =>
$settings->getResultDetailsSettings()->toForm(
203 'gameification' =>
$settings->getGamificationSettings()->toForm(...$ui_pack)
206 $action = $this->
ctrl->getFormAction($this, self::CMD_SAVE_FORM);
207 $form = $this->ui_factory->input()->container()->form()
208 ->standard($action, $sections)
209 ->withAdditionalTransformation(
210 $this->
refinery->custom()->transformation(
213 ->withScoringSettings($v[
'scoring'])
214 ->withResultSummarySettings($v[
'summary'])
215 ->withResultDetailsSettings($v[
'details'])
216 ->withGamificationSettings($v[
'gameification'])
226 if (!$this->test_object->getScoreReporting()) {
231 $reporting_date = $this->test_object->getScoreSettings()->getResultSummarySettings()->getReportingDate();
240 if (!$this->test_object->participantDataExist()) {
255 $taxononmy_translator->loadLabelsFromTaxonomyIds($available_taxonomy_ids);
257 $taxonomy_options = [];
258 foreach ($available_taxonomy_ids as $tax_id) {
259 $taxonomy_options[$tax_id] = $taxononmy_translator->getTaxonomyTreeLabel($tax_id);
261 return $taxonomy_options;
268 $settings_changed = (
275 $this->test_object->participantDataExist() &&
284 $confirmation->setHeaderText($this->
lng->txt(
'tst_trigger_result_refreshing'));
285 $confirmation->setFormAction($this->
ctrl->getFormAction($this));
286 $confirmation->setCancel($this->
lng->txt(
'cancel'), self::CMD_CANCEL_RECALC);
287 $confirmation->setConfirm($this->
lng->txt(
'confirm'), self::CMD_CONFIRMED_RECALC);
288 $confirmation->addHiddenItem(self::F_CONFIRM_SETTINGS, base64_encode(serialize($request)));
289 $this->tpl->setContent($this->
ctrl->getHTML($confirmation));
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
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
isScoreReportingAvailable()
executeCommand()
Command Execution.
areScoringSettingsWritable()
const SCORE_REPORTING_DATE
showForm(Form $form=null)
storeScoreSettings(ilObjTestScoreSettings $score_settings)
showConfirmation(Request $request)
__construct(protected ilCtrlInterface $ctrl, protected ilAccessHandler $access, protected ilLanguage $lng, protected ilTree $tree, protected ilDBInterface $db, protected ilComponentRepository $component_repository, protected ilObjTestGUI $test_gui, protected \ilGlobalTemplateInterface $tpl, protected ilTabsGUI $tabs, protected ScoreSettingsRepository $score_settings_repo, protected int $test_id, protected UIFactory $ui_factory, protected UIRenderer $ui_renderer, protected Refinery $refinery, protected Request $request, protected ilObjUser $active_user)
isScoreRecalculationRequired(ilObjTestSettingsScoring $new_settings, ilObjTestSettingsScoring $old_settings)
const CMD_CONFIRMED_RECALC
Refinery Factory $refinery