ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjAssessmentFolderGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
28  protected \ILIAS\TestQuestionPool\QuestionInfoService $questioninfo;
29  protected \ILIAS\Test\InternalRequestService $testrequest;
30 
31  public function __construct($a_data, int $a_id = 0, bool $a_call_by_reference = true, bool $a_prepare_output = true)
32  {
33  global $DIC;
34  $rbacsystem = $DIC['rbacsystem'];
35  $this->testrequest = $DIC->test()->internal()->request();
36  $this->questioninfo = $DIC->testQuestionPool()->questionInfo();
37  $this->type = "assf";
38  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
39 
40  if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) {
41  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read_assf"), $this->ilias->error_obj->WARNING);
42  }
43 
44  $this->lng->loadLanguageModule('assessment');
45  }
46 
48  {
50  return $this->object;
51  }
52 
53  public function executeCommand(): void
54  {
55  $next_class = $this->ctrl->getNextClass($this);
56  $cmd = $this->ctrl->getCmd();
57  $this->prepareOutput();
58 
59  switch ($next_class) {
60  case 'ilpermissiongui':
61  $this->tabs_gui->activateTab('perm_settings');
62  $perm_gui = new ilPermissionGUI($this);
63  $this->ctrl->forwardCommand($perm_gui);
64  break;
65  case 'ilglobalunitconfigurationgui':
66  if (!$this->rbac_system->checkAccess('visible,read', $this->getAssessmentFolder()->getRefId())) {
67  $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->WARNING);
68  }
69 
70  $this->tabs_gui->setTabActive('units');
71 
74  );
75  $this->ctrl->forwardCommand($gui);
76  break;
77 
78  default:
79  if ($cmd === null || $cmd === "" || $cmd === "view") {
80  $cmd = "settings";
81  }
82  $cmd .= "Object";
83  $this->$cmd();
84 
85  break;
86  }
87  }
88 
89  public function settingsObject(ilPropertyFormGUI $form = null): void
90  {
91  $this->tabs_gui->setTabActive('settings');
92 
93  if ($form === null) {
94  $form = $this->buildSettingsForm();
95  }
96 
97  $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
98  }
99 
101  {
102  $form = new ilPropertyFormGUI();
103  $form->setFormAction($this->ctrl->getFormAction($this));
104  $form->setTableWidth("100%");
105  $form->setId("settings");
106 
107  $header = new ilFormSectionHeaderGUI();
108  $header->setTitle($this->lng->txt('settings'));
109  $form->addItem($header);
110 
111  // question process locking behaviour (e.g. on saving users working data)
112  $chb = new ilCheckboxInputGUI($this->lng->txt('ass_process_lock'), 'ass_process_lock');
113  $chb->setChecked($this->getAssessmentFolder()->getAssessmentProcessLockMode() !== ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
114  $chb->setInfo($this->lng->txt('ass_process_lock_desc'));
115  $form->addItem($chb);
116  $rg = new ilRadioGroupInputGUI($this->lng->txt('ass_process_lock_mode'), 'ass_process_lock_mode');
117  $rg->setRequired(true);
118  $opt = new ilRadioOption(
119  $this->lng->txt('ass_process_lock_mode_file'),
121  );
122  $opt->setInfo($this->lng->txt('ass_process_lock_mode_file_desc'));
123  $rg->addOption($opt);
124  $opt = new ilRadioOption(
125  $this->lng->txt('ass_process_lock_mode_db'),
127  );
128  $opt->setInfo($this->lng->txt('ass_process_lock_mode_db_desc'));
129  $rg->addOption($opt);
130  if ($this->getAssessmentFolder()->getAssessmentProcessLockMode() !== ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE) {
131  $rg->setValue($this->getAssessmentFolder()->getAssessmentProcessLockMode());
132  }
133  $chb->addSubItem($rg);
134 
135  $assessmentSetting = new ilSetting('assessment');
136  $imap_line_color = $assessmentSetting->get('imap_line_color');
137  if ($this->testrequest->isset('imap_line_color')) {
138  $imap_line_color = $this->testrequest->strVal('imap_line_color');
139  }
140  if ($imap_line_color == '') {
141  $imap_line_color = 'FF0000';
142  }
143 
144  $linepicker = new ilColorPickerInputGUI($this->lng->txt('assessment_imap_line_color'), 'imap_line_color');
145  $linepicker->setValue($imap_line_color);
146  $form->addItem($linepicker);
147 
148  $user_criteria = $assessmentSetting->get('user_criteria');
149  if ($this->testrequest->isset('user_criteria')) {
150  $user_criteria = $this->testrequest->strVal('user_criteria');
151  }
152  $userCriteria = new ilSelectInputGUI($this->lng->txt('user_criteria'), 'user_criteria');
153  $userCriteria->setInfo($this->lng->txt('user_criteria_desc'));
154  $userCriteria->setRequired(true);
155 
156  $fields = ['usr_id', 'login', 'email', 'matriculation', 'ext_account'];
157  $usr_fields = [];
158  foreach ($fields as $field) {
159  $usr_fields[$field] = $field;
160  }
161  $userCriteria->setOptions($usr_fields);
162  $userCriteria->setValue($user_criteria);
163  $form->addItem($userCriteria);
164 
165  $numRequiredAnswers = new ilNumberInputGUI(
166  $this->lng->txt('tst_skill_triggerings_num_req_answers'),
167  'num_req_answers'
168  );
169  $numRequiredAnswers->setInfo($this->lng->txt('tst_skill_triggerings_num_req_answers_desc'));
170  $numRequiredAnswers->setSize(4);
171  $numRequiredAnswers->allowDecimals(false);
172  $numRequiredAnswers->setMinValue(1);
173  $numRequiredAnswers->setMinvalueShouldBeGreater(false);
174  $numRequiredAnswers->setValue($this->getAssessmentFolder()->getSkillTriggeringNumAnswersBarrier());
175  $form->addItem($numRequiredAnswers);
176 
177  $ceeqwh = new ilCheckboxInputGUI($this->lng->txt('export_essay_qst_with_html'), 'export_essay_qst_with_html');
178  $ceeqwh->setChecked($this->getAssessmentFolder()->getExportEssayQuestionsWithHtml());
179  $ceeqwh->setInfo($this->lng->txt('export_essay_qst_with_html_desc'));
180  $form->addItem($ceeqwh);
181 
182  // question settings
183  $header = new ilFormSectionHeaderGUI();
184  $header->setTitle($this->lng->txt("assf_questiontypes"));
185  $form->addItem($header);
186 
187  // available question types
188  $allowed = new ilCheckboxGroupInputGUI(
189  $this->lng->txt('assf_allowed_questiontypes'),
190  "chb_allowed_questiontypes"
191  );
192  $questiontypes = ilObjQuestionPool::_getQuestionTypes(true);
194  $allowedtypes = [];
195  foreach ($questiontypes as $qt) {
196  if (!in_array($qt['question_type_id'], $forbidden_types)) {
197  $allowedtypes[] = $qt['question_type_id'];
198  }
199  }
200  $allowed->setValue($allowedtypes);
201  foreach ($questiontypes as $type_name => $qtype) {
202  $allowed->addOption(new ilCheckboxOption($type_name, (string) $qtype["question_type_id"]));
203  }
204  $allowed->setInfo($this->lng->txt('assf_allowed_questiontypes_desc'));
205  $form->addItem($allowed);
206 
207  // manual scoring
208  $manual = new ilCheckboxGroupInputGUI(
209  $this->lng->txt('assessment_log_manual_scoring_activate'),
210  "chb_manual_scoring"
211  );
213  $manual->setValue($manscoring);
214  foreach ($questiontypes as $type_name => $qtype) {
215  $manual->addOption(new ilCheckboxOption($type_name, (string) $qtype["question_type_id"]));
216  }
217  $manual->setInfo($this->lng->txt('assessment_log_manual_scoring_desc'));
218  $form->addItem($manual);
219 
220  // scoring adjustment active
221  $scoring_activation = new ilCheckboxInputGUI(
222  $this->lng->txt('assessment_scoring_adjust'),
223  'chb_scoring_adjust'
224  );
225  $scoring_activation->setChecked($this->getAssessmentFolder()->getScoringAdjustmentEnabled());
226  $scoring_activation->setInfo($this->lng->txt('assessment_scoring_adjust_desc'));
227  $form->addItem($scoring_activation);
228 
229  // scoring adjustment
230  $scoring = new ilCheckboxGroupInputGUI(
231  $this->lng->txt('assessment_log_scoring_adjustment_activate'),
232  "chb_scoring_adjustment"
233  );
234  $scoring_active = $this->getAssessmentFolder()->getScoringAdjustableQuestions();
235  $scoring->setValue($scoring_active);
236 
237  foreach ($this->getAssessmentFolder()->fetchScoringAdjustableTypes($questiontypes) as $type_name => $qtype) {
238  $scoring->addOption(
239  new ilCheckboxOption($type_name, (string) $qtype["question_type_id"])
240  );
241  }
242  $scoring->setInfo($this->lng->txt('assessment_log_scoring_adjustment_desc'));
243  $form->addItem($scoring);
244 
245  if ($this->access->checkAccess("write", "", $this->getAssessmentFolder()->getRefId())) {
246  $form->addCommandButton("saveSettings", $this->lng->txt("save"));
247  }
248 
249  return $form;
250  }
251 
255  public function saveSettingsObject(): void
256  {
257  if (!$this->access->checkAccess("write", "", $this->getAssessmentFolder()->getRefId())) {
258  $this->ctrl->redirect($this, 'settings');
259  }
260 
261  $form = $this->buildSettingsForm();
262  if (!$form->checkInput()) {
263  $form->setValuesByPost();
264  $this->settingsObject($form);
265  return;
266  }
267 
268  $this->getAssessmentFolder()->setSkillTriggeringNumAnswersBarrier((int) $form->getInput('num_req_answers'));
269  $this->getAssessmentFolder()->setExportEssayQuestionsWithHtml(
270  (bool) ($form->getInput('export_essay_qst_with_html') ?? '0')
271  );
272  $this->getAssessmentFolder()->_setManualScoring($form->getInput('chb_manual_scoring') ?? []);
273  $question_types = ilObjQuestionPool::_getQuestionTypes(true);
274  $forbidden_types = [];
275  foreach ($question_types as $name => $row) {
276  if (!$form->getItemByPostVar('chb_allowed_questiontypes') ||
277  !in_array($row["question_type_id"], $form->getInput('chb_allowed_questiontypes'))) {
278  $forbidden_types[] = (int) $row["question_type_id"];
279  }
280  }
281  $this->getAssessmentFolder()->_setForbiddenQuestionTypes($forbidden_types);
282  $this->getAssessmentFolder()->setScoringAdjustmentEnabled(
283  (bool) ($form->getInput('chb_scoring_adjust') ?? '0')
284  );
285  $scoring_types = [];
286  foreach ($question_types as $name => $row) {
287  if ($form->getItemByPostVar('chb_scoring_adjustment') &&
288  in_array($row["question_type_id"], $form->getInput('chb_scoring_adjustment'))) {
289  $scoring_types[] = $row["question_type_id"];
290  }
291  }
292  $this->getAssessmentFolder()->setScoringAdjustableQuestions($scoring_types);
293  if (!$form->getInput('ass_process_lock')) {
294  $this->getAssessmentFolder()->setAssessmentProcessLockMode(ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
295  } elseif (in_array(
296  $form->getInput('ass_process_lock_mode'),
298  true
299  )) {
300  $this->getAssessmentFolder()->setAssessmentProcessLockMode($form->getInput('ass_process_lock_mode'));
301  }
302 
303  $assessmentSetting = new ilSetting('assessment');
304  $assessmentSetting->set('use_javascript', '1');
305  if (strlen($form->getInput('imap_line_color') ?? '') === 6) {
306  $assessmentSetting->set('imap_line_color', ilUtil::stripSlashes($form->getInput('imap_line_color')));
307  }
308  $assessmentSetting->set('user_criteria', ilUtil::stripSlashes($form->getInput('user_criteria')));
309 
310  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
311 
312  $this->ctrl->redirect($this, 'settings');
313  }
314 
318  public function showLogObject(): void
319  {
320  $form = $this->getLogDataOutputForm();
321  $form->checkInput();
322 
323  $form->setValuesByPost();
324  $this->logsObject($form);
325  }
326 
330  public function exportLogObject(): void
331  {
332  $form = $this->getLogDataOutputForm();
333  if (!$form->checkInput()) {
334  $form->setValuesByPost();
335  $this->logsObject($form);
336  return;
337  }
338 
339  $test = (int) $form->getInput('sel_test');
340  $from = $form->getItemByPostVar('log_from')->getDate()->get(IL_CAL_UNIX);
341  $until = $form->getItemByPostVar('log_until')->getDate()->get(IL_CAL_UNIX);
342 
343  $csv = [];
344  $separator = ";";
345  $row = [
346  $this->lng->txt("assessment_log_datetime"),
347  $this->lng->txt("user"),
348  $this->lng->txt("assessment_log_text"),
349  $this->lng->txt("question")
350  ];
351 
352  $available_tests = ilObjTest::_getAvailableTests(1);
353  $csv[] = ilCSVUtil::processCSVRow($row, true, $separator);
354  $log_output = ilObjAssessmentFolder::getLog($from, $until, $test);
355  $users = [];
356  foreach ($log_output as $key => $log) {
357  if (!array_key_exists($log["user_fi"], $users)) {
358  $users[$log["user_fi"]] = ilObjUser::_lookupName((int) $log["user_fi"]);
359  }
360  $title = "";
361  if ($log["question_fi"] || $log["original_fi"]) {
362  $title = $this->questioninfo->getQuestionTitle((int) $log["question_fi"]);
363  if ($title === '') {
364  $title = $this->questioninfo->getQuestionTitle((int) $log["original_fi"]);
365  }
366  $title = $this->lng->txt("assessment_log_question") . ": " . $title;
367  }
368  $csvrow = [];
369  $date = new ilDateTime((int) $log['tstamp'], IL_CAL_UNIX);
370  $csvrow[] = $date->get(IL_CAL_FKT_DATE, 'Y-m-d H:i');
371  $csvrow[] = trim($users[$log["user_fi"]]["title"] . " " . $users[$log["user_fi"]]["firstname"] . " " . $users[$log["user_fi"]]["lastname"]);
372  $csvrow[] = trim($log["logtext"]);
373  $csvrow[] = $title;
374  $csv[] = ilCSVUtil::processCSVRow($csvrow, true, $separator);
375  }
376  $csvoutput = "";
377  foreach ($csv as $row) {
378  $csvoutput .= implode($separator, $row) . "\n";
379  }
381  $csvoutput,
382  str_replace(" ", "_", "log_" . $from . "_" . $until . "_" . $available_tests[$test]) . ".csv"
383  );
384  }
385 
390  {
391  $form = new ilPropertyFormGUI();
392  $form->setPreventDoubleSubmission(false);
393  $form->setFormAction($this->ctrl->getFormAction($this));
394  $form->setTableWidth("100%");
395  $form->setId("logs");
396 
397  $header = new ilFormSectionHeaderGUI();
398  $header->setTitle($this->lng->txt("assessment_log"));
399  $form->addItem($header);
400 
401  // from
402  $from = new ilDateTimeInputGUI($this->lng->txt('cal_from'), "log_from");
403  $from->setShowTime(true);
404  $from->setRequired(true);
405  $form->addItem($from);
406 
407  // until
408  $until = new ilDateTimeInputGUI($this->lng->txt('cal_until'), "log_until");
409  $until->setShowTime(true);
410  $until->setRequired(true);
411  $form->addItem($until);
412 
413  $available_tests = ilObjTest::_getAvailableTests(1);
414 
415  // tests
416  $fortest = new ilSelectInputGUI($this->lng->txt('assessment_log_for_test'), "sel_test");
417  $fortest->setRequired(true);
418  $sorted_options = [];
419  foreach ($available_tests as $key => $value) {
420  $sorted_options[] = [
421  'title' => ilLegacyFormElementsUtil::prepareFormOutput($value) . " [" . $this->getAssessmentFolder()->getNrOfLogEntries((int) $key) . " " . $this->lng->txt("assessment_log_log_entries") . "]",
422  'key' => $key
423  ];
424  }
425  $sorted_options = ilArrayUtil::sortArray($sorted_options, 'title', 'asc');
426  $options = ['' => $this->lng->txt('please_choose')];
427  foreach ($sorted_options as $option) {
428  $options[$option['key']] = $option['title'];
429  }
430  $fortest->setOptions($options);
431  $form->addItem($fortest);
432 
433  $form->addCommandButton('showLog', $this->lng->txt('show'));
434  $form->addCommandButton('exportLog', $this->lng->txt('export'));
435 
436  return $form;
437  }
438 
442  public function logsObject(ilPropertyFormGUI $form = null): void
443  {
444  $this->tabs_gui->activateTab('logs');
445 
446  $template = new ilTemplate("tpl.assessment_logs.html", true, true, "Modules/Test");
447 
448  $p_test = 0;
449  $fromdate = 0;
450  $untildate = 0;
451 
452  if (!($form instanceof ilPropertyFormGUI)) {
453  $form = $this->getLogDataOutputForm();
454 
455  $values = [];
456  if ($this->testrequest->isset('sel_test')) {
457  $p_test = $values['sel_test'] = $this->testrequest->int('sel_test');
458  }
459 
460  if ($this->testrequest->isset('log_from')) {
461  $fromdate = $this->testrequest->int('log_from');
462  } else {
463  $fromdate = mktime(0, 0, 0, 1, 1, (int) date('Y'));
464  }
465 
466  if ($this->testrequest->isset('log_until')) {
467  $untildate = $this->testrequest->int('log_until');
468  } else {
469  $untildate = time();
470  }
471 
472  $values['log_from'] = (new ilDateTime($fromdate, IL_CAL_UNIX))->get(IL_CAL_DATETIME);
473  $values['log_until'] = (new ilDateTime($untildate, IL_CAL_UNIX))->get(IL_CAL_DATETIME);
474 
475  $form->setValuesByArray($values);
476  } else {
477  $fromdate_input = $form->getItemByPostVar('log_from')->getDate();
478  $untildate_input = $form->getItemByPostVar('log_until')->getDate();
479  if ($fromdate_input instanceof ilDateTime && $untildate_input instanceof ilDateTime) {
480  $p_test = (int) $form->getInput('sel_test');
481 
482  $fromdate = $fromdate_input->get(IL_CAL_UNIX);
483  $untildate = $untildate_input->get(IL_CAL_UNIX);
484  }
485  }
486 
487  $this->ctrl->setParameter($this, 'sel_test', (int) $p_test);
488  $this->ctrl->setParameter($this, 'log_until', (int) $untildate);
489  $this->ctrl->setParameter($this, 'log_from', (int) $fromdate);
490 
491  $template->setVariable("FORM", $form->getHTML());
492 
493  if ($p_test) {
494  $table_gui = new ilAssessmentFolderLogTableGUI($this, 'logs');
495  $log_output = ilObjAssessmentFolder::getLog($fromdate, $untildate, $p_test);
496 
497  $self = $this;
498  array_walk($log_output, static function (&$row) use ($self) {
499  $row['location_href'] = '';
500  $row['location_txt'] = '';
501  if (is_numeric($row['ref_id']) && $row['ref_id'] > 0) {
502  $row['location_href'] = ilLink::_getLink((int) $row['ref_id'], 'tst');
503  $row['location_txt'] = $self->lng->txt("perma_link");
504  }
505  });
506 
507  $table_gui->setData($log_output);
508  $template->setVariable('LOG', $table_gui->getHTML());
509  }
510  $this->tpl->setVariable("ADM_CONTENT", $template->get());
511  }
512 
516  public function deleteLogObject(): void
517  {
518  $test_ids = $this->post_wrapper->retrieve(
519  'chb_test',
520  $this->refinery->byTrying([
521  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
522  $this->refinery->always([])
523  ])
524  );
525 
526  if ($test_ids !== []) {
527  $this->getAssessmentFolder()->deleteLogEntries($test_ids);
528  $this->tpl->setOnScreenMessage('success', $this->lng->txt("ass_log_deleted"));
529  } else {
530  $this->tpl->setOnScreenMessage('info', $this->lng->txt("ass_log_delete_no_selection"));
531  }
532 
533  $this->logAdminObject();
534  }
535 
539  public function logAdminObject(): void
540  {
541  $this->tabs_gui->activateTab('logs');
542 
543  $a_write_access = ($this->access->checkAccess("write", "", $this->getAssessmentFolder()->getRefId())) ? true : false;
544 
545  $table_gui = new ilAssessmentFolderLogAdministrationTableGUI($this, 'logAdmin', $a_write_access);
546 
547  $available_tests = ilObjTest::_getAvailableTests(false);
548  $data = [];
549  foreach ($available_tests as $ref_id => $title) {
551  $data[] = [
552  "title" => $title,
553  "nr" => $this->getAssessmentFolder()->getNrOfLogEntries((int) $obj_id),
554  "id" => $obj_id,
555  "location_href" => ilLink::_getLink($ref_id, 'tst'),
556  "location_txt" => $this->lng->txt("perma_link")
557  ];
558  }
559  $table_gui->setData($data);
560  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
561  }
562 
563  public function getAdminTabs(): void
564  {
565  $this->getTabs();
566  }
567 
568  public function getLogdataSubtabs(): void
569  {
570  $this->tabs_gui->addSubTabTarget(
571  "settings",
572  $this->ctrl->getLinkTarget($this, "showLogSettings"),
573  ["saveLogSettings", "showLogSettings"],
574  ""
575  );
576 
577  // log output
578  $this->tabs_gui->addSubTabTarget(
579  "ass_log_output",
580  $this->ctrl->getLinkTarget($this, "logs"),
581  ["logs", "showLog", "exportLog"],
582  ""
583  );
584 
585  // log administration
586  $this->tabs_gui->addSubTabTarget(
587  "ass_log_admin",
588  $this->ctrl->getLinkTarget($this, "logAdmin"),
589  ["logAdmin", "deleteLog"],
590  "",
591  ""
592  );
593  }
594 
595  protected function getTabs(): void
596  {
597  switch ($this->ctrl->getCmd()) {
598  case "saveLogSettings":
599  case "showLogSettings":
600  case "logs":
601  case "showLog":
602  case "exportLog":
603  case "logAdmin":
604  case "deleteLog":
605  $this->getLogdataSubtabs();
606  break;
607  }
608 
609  if ($this->rbac_system->checkAccess("visible,read", $this->getAssessmentFolder()->getRefId())) {
610  $this->tabs_gui->addTarget(
611  "settings",
612  $this->ctrl->getLinkTarget($this, "settings"),
613  ["settings", "", "view"],
614  "",
615  ""
616  );
617 
618  $this->tabs_gui->addTarget(
619  "logs",
620  $this->ctrl->getLinkTarget($this, "showLogSettings"),
621  ['saveLogSettings', 'showLogSettings', "logs", "showLog", "exportLog", "logAdmin", "deleteLog"],
622  "",
623  ""
624  );
625 
626  $this->tabs_gui->addTarget(
627  'units',
628  $this->ctrl->getLinkTargetByClass('ilGlobalUnitConfigurationGUI', ''),
629  '',
630  'ilglobalunitconfigurationgui'
631  );
632  }
633 
634  if ($this->rbac_system->checkAccess('edit_permission', $this->getAssessmentFolder()->getRefId())) {
635  $this->tabs_gui->addTarget(
636  "perm_settings",
637  $this->ctrl->getLinkTargetByClass([get_class($this), 'ilpermissiongui'], "perm"),
638  ["perm", "info", "owner"],
639  'ilpermissiongui'
640  );
641  }
642  }
643 
647  protected function showLogSettingsObject(ilPropertyFormGUI $form = null): void
648  {
649  $this->tabs_gui->activateTab('logs');
650 
651  if (!($form instanceof ilPropertyFormGUI)) {
652  $form = $this->getLogSettingsForm();
653  $form->setValuesByArray([
654  'chb_assessment_logging' => ilObjAssessmentFolder::_enabledAssessmentLogging(),
655  'reporting_language' => ilObjAssessmentFolder::_getLogLanguage()
656  ]);
657  }
658 
659  $this->tpl->setContent($form->getHTML());
660  }
661 
665  protected function saveLogSettingsObject(): void
666  {
667  if (!$this->access->checkAccess('write', '', $this->getAssessmentFolder()->getRefId())) {
668  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->WARNING);
669  }
670 
671  $form = $this->getLogSettingsForm();
672  if ($form->checkInput()) {
673  $this->getAssessmentFolder()->_enableAssessmentLogging((bool) $form->getInput('chb_assessment_logging'));
674  $this->getAssessmentFolder()->_setLogLanguage((string) $form->getInput('reporting_language'));
675  $this->getAssessmentFolder()->update();
676  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
677  }
678 
679  $form->setValuesByPost();
680  $this->showLogSettingsObject($form);
681  }
682 
686  protected function getLogSettingsForm(): ilPropertyFormGUI
687  {
688  $form = new ilPropertyFormGUI();
689  $form->setFormAction($this->ctrl->getFormAction($this, 'saveLogSettings'));
690  $form->setTitle($this->lng->txt('assessment_log_logging'));
691 
692  $logging = new ilCheckboxInputGUI('', 'chb_assessment_logging');
693  $logging->setValue('1');
694  $logging->setOptionTitle($this->lng->txt('activate_assessment_logging'));
695  $form->addItem($logging);
696 
697  $reporting = new ilSelectInputGUI(
698  $this->lng->txt('assessment_settings_reporting_language'),
699  'reporting_language'
700  );
701  $languages = $this->lng->getInstalledLanguages();
702  $this->lng->loadLanguageModule('meta');
703  $options = [];
704  foreach ($languages as $lang) {
705  $options[$lang] = $this->lng->txt('meta_l_' . $lang);
706  }
707  $reporting->setOptions($options);
708  $form->addItem($reporting);
709 
710  if ($this->access->checkAccess('write', '', $this->getAssessmentFolder()->getRefId())) {
711  $form->addCommandButton('saveLogSettings', $this->lng->txt('save'));
712  }
713 
714  return $form;
715  }
716 }
static & processCSVRow(array &$row, bool $quoteAll=false, string $separator=';', bool $outUTF8=false, bool $compatibleWithMSExcel=true)
Convertes an array for CSV usage.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_DATETIME
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct($a_data, int $a_id=0, bool $a_call_by_reference=true, bool $a_prepare_output=true)
This class represents a selection list property in a property form.
settingsObject(ilPropertyFormGUI $form=null)
static getLog(int $ts_from, int $ts_to, int $test_id, bool $test_only=false)
Retrieve assessment log datasets from the database.
prepareOutput(bool $show_sub_objects=true)
setInfo(string $a_info)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
Class ilObjAssessmentFolderGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupName(int $a_user_id)
lookup user name
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Test InternalRequestService $testrequest
setShowTime(bool $a_showtime)
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
static prepareFormOutput($a_str, bool $a_strip=false)
const IL_CAL_UNIX
This class represents a date/time property in a property form.
global $DIC
Definition: feed.php:28
logAdminObject()
Administration output for assessment log files.
This class represents a property in a property form.
__construct(VocabulariesInterface $vocabularies)
$log
Definition: result.php:33
saveSettingsObject()
Save Assessment settings.
Class ilObjectGUI Basic methods of all Output classes.
Class ilObjAssessmentFolder.
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
const IL_CAL_FKT_DATE
string $key
Consumer key/client ID value.
Definition: System.php:193
static _lookupObjectId(int $ref_id)
header include for all ilias files.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRequired(bool $a_required)
showLogSettingsObject(ilPropertyFormGUI $form=null)
$lang
Definition: xapiexit.php:26
ILIAS TestQuestionPool QuestionInfoService $questioninfo
logsObject(ilPropertyFormGUI $form=null)
static _getManualScoring()
Retrieve the manual scoring settings.
static _getAvailableTests($use_object_id=false)
Returns the available tests for the active user.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
showLogObject()
Called when the a log should be shown.
exportLogObject()
Called when the a log should be exported.
deleteLogObject()
Deletes the log entries for one or more tests.
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)