ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjAssessmentFolderGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
28  protected \ILIAS\Test\InternalRequestService $testrequest;
29 
30  public function __construct($a_data, int $a_id = 0, bool $a_call_by_reference = true, bool $a_prepare_output = true)
31  {
32  global $DIC;
33  $rbacsystem = $DIC['rbacsystem'];
34  $this->testrequest = $DIC->test()->internal()->request();
35  $this->type = "assf";
36  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
37 
38  if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) {
39  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read_assf"), $this->ilias->error_obj->WARNING);
40  }
41 
42  $this->lng->loadLanguageModule('assessment');
43  }
44 
46  {
48  return $this->object;
49  }
50 
51  public function executeCommand(): void
52  {
57  global $DIC;
58  $rbacsystem = $DIC['rbacsystem'];
59  $ilTabs = $DIC['ilTabs'];
60 
61  $next_class = $this->ctrl->getNextClass($this);
62  $cmd = $this->ctrl->getCmd();
63  $this->prepareOutput();
64 
65  switch ($next_class) {
66  case 'ilpermissiongui':
67  $ilTabs->activateTab('perm_settings');
68  $perm_gui = new ilPermissionGUI($this);
69  $ret = $this->ctrl->forwardCommand($perm_gui);
70  break;
71 
72  case 'ilsettingstemplategui':
74  break;
75 
76  case 'ilglobalunitconfigurationgui':
77  if (!$rbacsystem->checkAccess('visible,read', $this->getAssessmentFolder()->getRefId())) {
78  $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->WARNING);
79  }
80 
81  $ilTabs->setTabActive('units');
82 
85  );
86  $this->ctrl->forwardCommand($gui);
87  break;
88 
89  default:
90  if ($cmd === null || $cmd === "" || $cmd === "view") {
91  $cmd = "settings";
92  }
93  $cmd .= "Object";
94  $this->$cmd();
95 
96  break;
97  }
98  }
99 
100  public function settingsObject(ilPropertyFormGUI $form = null): void
101  {
102  global $DIC;
103  $ilTabs = $DIC['ilTabs'];
104 
105  $ilTabs->setTabActive('settings');
106 
107  if ($form === null) {
108  $form = $this->buildSettingsForm();
109  }
110 
111  $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
112  }
113 
114  private function buildSettingsForm(): ilPropertyFormGUI
115  {
119  global $DIC;
120  $ilAccess = $DIC['ilAccess'];
121 
122  $form = new ilPropertyFormGUI();
123  $form->setFormAction($this->ctrl->getFormAction($this));
124  $form->setTableWidth("100%");
125  $form->setId("settings");
126 
127  $header = new ilFormSectionHeaderGUI();
128  $header->setTitle($this->lng->txt('settings'));
129  $form->addItem($header);
130 
131  // question process locking behaviour (e.g. on saving users working data)
132  $chb = new ilCheckboxInputGUI($this->lng->txt('ass_process_lock'), 'ass_process_lock');
133  $chb->setChecked($this->getAssessmentFolder()->getAssessmentProcessLockMode() !== ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
134  $chb->setInfo($this->lng->txt('ass_process_lock_desc'));
135  $form->addItem($chb);
136  $rg = new ilRadioGroupInputGUI($this->lng->txt('ass_process_lock_mode'), 'ass_process_lock_mode');
137  $rg->setRequired(true);
138  $opt = new ilRadioOption(
139  $this->lng->txt('ass_process_lock_mode_file'),
141  );
142  $opt->setInfo($this->lng->txt('ass_process_lock_mode_file_desc'));
143  $rg->addOption($opt);
144  $opt = new ilRadioOption(
145  $this->lng->txt('ass_process_lock_mode_db'),
147  );
148  $opt->setInfo($this->lng->txt('ass_process_lock_mode_db_desc'));
149  $rg->addOption($opt);
150  if ($this->getAssessmentFolder()->getAssessmentProcessLockMode() !== ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE) {
151  $rg->setValue($this->getAssessmentFolder()->getAssessmentProcessLockMode());
152  }
153  $chb->addSubItem($rg);
154 
155  $assessmentSetting = new ilSetting('assessment');
156  $imap_line_color = $assessmentSetting->get('imap_line_color');
157  if ($this->testrequest->isset('imap_line_color')) {
158  $imap_line_color = $this->testrequest->strVal('imap_line_color');
159  }
160  if ($imap_line_color == '') {
161  $imap_line_color = 'FF0000';
162  }
163 
164  $linepicker = new ilColorPickerInputGUI($this->lng->txt('assessment_imap_line_color'), 'imap_line_color');
165  $linepicker->setValue($imap_line_color);
166  $form->addItem($linepicker);
167 
168  $user_criteria = $assessmentSetting->get('user_criteria');
169  if ($this->testrequest->isset('user_criteria')) {
170  $user_criteria = $this->testrequest->strVal('user_criteria');
171  }
172  $userCriteria = new ilSelectInputGUI($this->lng->txt('user_criteria'), 'user_criteria');
173  $userCriteria->setInfo($this->lng->txt('user_criteria_desc'));
174  $userCriteria->setRequired(true);
175 
176  $fields = ['usr_id', 'login', 'email', 'matriculation', 'ext_account'];
177  $usr_fields = [];
178  foreach ($fields as $field) {
179  $usr_fields[$field] = $field;
180  }
181  $userCriteria->setOptions($usr_fields);
182  $userCriteria->setValue($user_criteria);
183  $form->addItem($userCriteria);
184 
185  $numRequiredAnswers = new ilNumberInputGUI(
186  $this->lng->txt('tst_skill_triggerings_num_req_answers'),
187  'num_req_answers'
188  );
189  $numRequiredAnswers->setInfo($this->lng->txt('tst_skill_triggerings_num_req_answers_desc'));
190  $numRequiredAnswers->setSize(4);
191  $numRequiredAnswers->allowDecimals(false);
192  $numRequiredAnswers->setMinValue(1);
193  $numRequiredAnswers->setMinvalueShouldBeGreater(false);
194  $numRequiredAnswers->setValue((string) $this->getAssessmentFolder()->getSkillTriggeringNumAnswersBarrier());
195  $form->addItem($numRequiredAnswers);
196 
197  $ceeqwh = new ilCheckboxInputGUI($this->lng->txt('export_essay_qst_with_html'), 'export_essay_qst_with_html');
198  $ceeqwh->setChecked($this->getAssessmentFolder()->getExportEssayQuestionsWithHtml());
199  $ceeqwh->setInfo($this->lng->txt('export_essay_qst_with_html_desc'));
200  $form->addItem($ceeqwh);
201 
202  // question settings
203  $header = new ilFormSectionHeaderGUI();
204  $header->setTitle($this->lng->txt("assf_questiontypes"));
205  $form->addItem($header);
206 
207  // available question types
208  $allowed = new ilCheckboxGroupInputGUI(
209  $this->lng->txt('assf_allowed_questiontypes'),
210  "chb_allowed_questiontypes"
211  );
212  $questiontypes = ilObjQuestionPool::_getQuestionTypes(true);
214  $allowedtypes = [];
215  foreach ($questiontypes as $qt) {
216  if (!in_array($qt['question_type_id'], $forbidden_types)) {
217  $allowedtypes[] = $qt['question_type_id'];
218  }
219  }
220  $allowed->setValue($allowedtypes);
221  foreach ($questiontypes as $type_name => $qtype) {
222  $allowed->addOption(new ilCheckboxOption($type_name, (string) $qtype["question_type_id"]));
223  }
224  $allowed->setInfo($this->lng->txt('assf_allowed_questiontypes_desc'));
225  $form->addItem($allowed);
226 
227  // manual scoring
228  $manual = new ilCheckboxGroupInputGUI(
229  $this->lng->txt('assessment_log_manual_scoring_activate'),
230  "chb_manual_scoring"
231  );
233  $manual->setValue($manscoring);
234  foreach ($questiontypes as $type_name => $qtype) {
235  $manual->addOption(new ilCheckboxOption($type_name, (string) $qtype["question_type_id"]));
236  }
237  $manual->setInfo($this->lng->txt('assessment_log_manual_scoring_desc'));
238  $form->addItem($manual);
239 
240  // scoring adjustment active
241  $scoring_activation = new ilCheckboxInputGUI(
242  $this->lng->txt('assessment_scoring_adjust'),
243  'chb_scoring_adjust'
244  );
245  $scoring_activation->setChecked($this->getAssessmentFolder()->getScoringAdjustmentEnabled());
246  $scoring_activation->setInfo($this->lng->txt('assessment_scoring_adjust_desc'));
247  $form->addItem($scoring_activation);
248 
249  // scoring adjustment
250  $scoring = new ilCheckboxGroupInputGUI(
251  $this->lng->txt('assessment_log_scoring_adjustment_activate'),
252  "chb_scoring_adjustment"
253  );
254  $scoring_active = $this->getAssessmentFolder()->getScoringAdjustableQuestions();
255  $scoring->setValue($scoring_active);
256 
257  foreach ($this->getAssessmentFolder()->fetchScoringAdjustableTypes($questiontypes) as $type_name => $qtype) {
258  $scoring->addOption(
259  new ilCheckboxOption($type_name, (string) $qtype["question_type_id"])
260  );
261  }
262  $scoring->setInfo($this->lng->txt('assessment_log_scoring_adjustment_desc'));
263  $form->addItem($scoring);
264 
265  if ($ilAccess->checkAccess("write", "", $this->getAssessmentFolder()->getRefId())) {
266  $form->addCommandButton("saveSettings", $this->lng->txt("save"));
267  }
268 
269  return $form;
270  }
271 
275  public function saveSettingsObject(): void
276  {
277  global $DIC;
278  $ilAccess = $DIC['ilAccess'];
279  if (!$ilAccess->checkAccess("write", "", $this->getAssessmentFolder()->getRefId())) {
280  $this->ctrl->redirect($this, 'settings');
281  }
282 
283  $form = $this->buildSettingsForm();
284  if (!$form->checkInput()) {
285  $form->setValuesByPost();
286  $this->settingsObject($form);
287  return;
288  }
289 
290  $this->getAssessmentFolder()->setSkillTriggeringNumAnswersBarrier((int) $form->getInput('num_req_answers'));
291  $this->getAssessmentFolder()->setExportEssayQuestionsWithHtml(
292  (bool) ($form->getInput('export_essay_qst_with_html') ?? '0')
293  );
294  $this->getAssessmentFolder()->_setManualScoring($form->getInput('chb_manual_scoring') ?? []);
295  $question_types = ilObjQuestionPool::_getQuestionTypes(true);
296  $forbidden_types = [];
297  foreach ($question_types as $name => $row) {
298  if (!$form->getItemByPostVar('chb_allowed_questiontypes') ||
299  !in_array($row["question_type_id"], $form->getInput('chb_allowed_questiontypes'))) {
300  $forbidden_types[] = (int) $row["question_type_id"];
301  }
302  }
303  $this->getAssessmentFolder()->_setForbiddenQuestionTypes($forbidden_types);
304  $this->getAssessmentFolder()->setScoringAdjustmentEnabled(
305  (bool) ($form->getInput('chb_scoring_adjust') ?? '0')
306  );
307  $scoring_types = [];
308  foreach ($question_types as $name => $row) {
309  if ($form->getItemByPostVar('chb_scoring_adjustment') &&
310  in_array($row["question_type_id"], $form->getInput('chb_scoring_adjustment'))) {
311  $scoring_types[] = $row["question_type_id"];
312  }
313  }
314  $this->getAssessmentFolder()->setScoringAdjustableQuestions($scoring_types);
315  if (!$form->getInput('ass_process_lock')) {
316  $this->getAssessmentFolder()->setAssessmentProcessLockMode(ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
317  } elseif (in_array(
318  $form->getInput('ass_process_lock_mode'),
320  true
321  )) {
322  $this->getAssessmentFolder()->setAssessmentProcessLockMode($form->getInput('ass_process_lock_mode'));
323  }
324 
325  $assessmentSetting = new ilSetting('assessment');
326  $assessmentSetting->set('use_javascript', '1');
327  if (strlen($form->getInput('imap_line_color') ?? '') === 6) {
328  $assessmentSetting->set('imap_line_color', ilUtil::stripSlashes($form->getInput('imap_line_color')));
329  }
330  $assessmentSetting->set('user_criteria', ilUtil::stripSlashes($form->getInput('user_criteria')));
331 
332  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
333 
334  $this->ctrl->redirect($this, 'settings');
335  }
336 
340  public function showLogObject(): void
341  {
342  $form = $this->getLogDataOutputForm();
343  $form->checkInput();
344 
345  $form->setValuesByPost();
346  $this->logsObject($form);
347  }
348 
352  public function exportLogObject(): void
353  {
354  $form = $this->getLogDataOutputForm();
355  if (!$form->checkInput()) {
356  $form->setValuesByPost();
357  $this->logsObject($form);
358  return;
359  }
360 
361  $test = (int) $form->getInput('sel_test');
362  $from = $form->getItemByPostVar('log_from')->getDate()->get(IL_CAL_UNIX);
363  $until = $form->getItemByPostVar('log_until')->getDate()->get(IL_CAL_UNIX);
364 
365  $csv = [];
366  $separator = ";";
367  $row = [
368  $this->lng->txt("assessment_log_datetime"),
369  $this->lng->txt("user"),
370  $this->lng->txt("assessment_log_text"),
371  $this->lng->txt("question")
372  ];
373 
374  $available_tests = ilObjTest::_getAvailableTests(1);
375  $csv[] = ilCSVUtil::processCSVRow($row, true, $separator);
376  $log_output = ilObjAssessmentFolder::getLog($from, $until, $test);
377  $users = [];
378  foreach ($log_output as $key => $log) {
379  if (!array_key_exists($log["user_fi"], $users)) {
380  $users[$log["user_fi"]] = ilObjUser::_lookupName((int) $log["user_fi"]);
381  }
382  $title = "";
383  if ($log["question_fi"] || $log["original_fi"]) {
384  $title = assQuestion::_getQuestionTitle((int) $log["question_fi"]);
385  if ($title === '') {
386  $title = assQuestion::_getQuestionTitle((int) $log["original_fi"]);
387  }
388  $title = $this->lng->txt("assessment_log_question") . ": " . $title;
389  }
390  $csvrow = [];
391  $date = new ilDateTime((int) $log['tstamp'], IL_CAL_UNIX);
392  $csvrow[] = $date->get(IL_CAL_FKT_DATE, 'Y-m-d H:i');
393  $csvrow[] = trim($users[$log["user_fi"]]["title"] . " " . $users[$log["user_fi"]]["firstname"] . " " . $users[$log["user_fi"]]["lastname"]);
394  $csvrow[] = trim($log["logtext"]);
395  $csvrow[] = $title;
396  $csv[] = ilCSVUtil::processCSVRow($csvrow, true, $separator);
397  }
398  $csvoutput = "";
399  foreach ($csv as $row) {
400  $csvoutput .= implode($separator, $row) . "\n";
401  }
403  $csvoutput,
404  str_replace(" ", "_", "log_" . $from . "_" . $until . "_" . $available_tests[$test]) . ".csv"
405  );
406  }
407 
412  {
413  $form = new ilPropertyFormGUI();
414  $form->setPreventDoubleSubmission(false);
415  $form->setFormAction($this->ctrl->getFormAction($this));
416  $form->setTableWidth("100%");
417  $form->setId("logs");
418 
419  $header = new ilFormSectionHeaderGUI();
420  $header->setTitle($this->lng->txt("assessment_log"));
421  $form->addItem($header);
422 
423  // from
424  $from = new ilDateTimeInputGUI($this->lng->txt('cal_from'), "log_from");
425  $from->setShowTime(true);
426  $from->setRequired(true);
427  $form->addItem($from);
428 
429  // until
430  $until = new ilDateTimeInputGUI($this->lng->txt('cal_until'), "log_until");
431  $until->setShowTime(true);
432  $until->setRequired(true);
433  $form->addItem($until);
434 
435  $available_tests = ilObjTest::_getAvailableTests(1);
436 
437  // tests
438  $fortest = new ilSelectInputGUI($this->lng->txt('assessment_log_for_test'), "sel_test");
439  $fortest->setRequired(true);
440  $sorted_options = [];
441  foreach ($available_tests as $key => $value) {
442  $sorted_options[] = [
443  'title' => ilLegacyFormElementsUtil::prepareFormOutput($value) . " [" . $this->getAssessmentFolder()->getNrOfLogEntries((int) $key) . " " . $this->lng->txt("assessment_log_log_entries") . "]",
444  'key' => $key
445  ];
446  }
447  $sorted_options = ilArrayUtil::sortArray($sorted_options, 'title', 'asc');
448  $options = ['' => $this->lng->txt('please_choose')];
449  foreach ($sorted_options as $option) {
450  $options[$option['key']] = $option['title'];
451  }
452  $fortest->setOptions($options);
453  $form->addItem($fortest);
454 
455  $form->addCommandButton('showLog', $this->lng->txt('show'));
456  $form->addCommandButton('exportLog', $this->lng->txt('export'));
457 
458  return $form;
459  }
460 
464  public function logsObject(ilPropertyFormGUI $form = null): void
465  {
469  global $DIC;
470  $ilTabs = $DIC['ilTabs'];
471 
472  $ilTabs->activateTab('logs');
473 
474  $template = new ilTemplate("tpl.assessment_logs.html", true, true, "Modules/Test");
475 
476  $p_test = 0;
477  $fromdate = 0;
478  $untildate = 0;
479 
480  if (!($form instanceof ilPropertyFormGUI)) {
481  $form = $this->getLogDataOutputForm();
482 
483  $values = [];
484  if ($this->testrequest->isset('sel_test')) {
485  $p_test = $values['sel_test'] = $this->testrequest->int('sel_test');
486  }
487 
488  if ($this->testrequest->isset('log_from')) {
489  $fromdate = $this->testrequest->int('log_from');
490  } else {
491  $fromdate = mktime(0, 0, 0, 1, 1, (int) date('Y'));
492  }
493 
494  if ($this->testrequest->isset('log_until')) {
495  $untildate = $this->testrequest->int('log_until');
496  } else {
497  $untildate = time();
498  }
499 
500  $values['log_from'] = (new ilDateTime($fromdate, IL_CAL_UNIX))->get(IL_CAL_DATETIME);
501  $values['log_until'] = (new ilDateTime($untildate, IL_CAL_UNIX))->get(IL_CAL_DATETIME);
502 
503  $form->setValuesByArray($values);
504  } else {
505  $fromdate_input = $form->getItemByPostVar('log_from')->getDate();
506  $untildate_input = $form->getItemByPostVar('log_until')->getDate();
507  if ($fromdate_input instanceof ilDateTime && $untildate_input instanceof ilDateTime) {
508  $p_test = (int) $form->getInput('sel_test');
509 
510  $fromdate = $fromdate_input->get(IL_CAL_UNIX);
511  $untildate = $untildate_input->get(IL_CAL_UNIX);
512  }
513  }
514 
515  $this->ctrl->setParameter($this, 'sel_test', (int) $p_test);
516  $this->ctrl->setParameter($this, 'log_until', (int) $untildate);
517  $this->ctrl->setParameter($this, 'log_from', (int) $fromdate);
518 
519  $template->setVariable("FORM", $form->getHTML());
520 
521  if ($p_test) {
522  $table_gui = new ilAssessmentFolderLogTableGUI($this, 'logs');
523  $log_output = ilObjAssessmentFolder::getLog($fromdate, $untildate, $p_test);
524 
525  $self = $this;
526  array_walk($log_output, static function (&$row) use ($self) {
527  $row['location_href'] = '';
528  $row['location_txt'] = '';
529  if (is_numeric($row['ref_id']) && $row['ref_id'] > 0) {
530  $row['location_href'] = ilLink::_getLink((int) $row['ref_id'], 'tst');
531  $row['location_txt'] = $self->lng->txt("perma_link");
532  }
533  });
534 
535  $table_gui->setData($log_output);
536  $template->setVariable('LOG', $table_gui->getHTML());
537  }
538  $this->tpl->setVariable("ADM_CONTENT", $template->get());
539  }
540 
544  public function deleteLogObject(): void
545  {
546  $test_ids = $this->post_wrapper->retrieve(
547  'chb_test',
548  $this->refinery->byTrying([
549  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
550  $this->refinery->always([])
551  ])
552  );
553 
554  if ($test_ids !== []) {
555  $this->getAssessmentFolder()->deleteLogEntries($test_ids);
556  $this->tpl->setOnScreenMessage('success', $this->lng->txt("ass_log_deleted"));
557  } else {
558  $this->tpl->setOnScreenMessage('info', $this->lng->txt("ass_log_delete_no_selection"));
559  }
560 
561  $this->logAdminObject();
562  }
563 
567  public function logAdminObject(): void
568  {
569  global $DIC;
570  $ilAccess = $DIC['ilAccess'];
571  $ilTabs = $DIC['ilTabs'];
572 
573  $ilTabs->activateTab('logs');
574 
575  $a_write_access = ($ilAccess->checkAccess("write", "", $this->getAssessmentFolder()->getRefId())) ? true : false;
576 
577  $table_gui = new ilAssessmentFolderLogAdministrationTableGUI($this, 'logAdmin', $a_write_access);
578 
579  $available_tests = ilObjTest::_getAvailableTests(false);
580  $data = [];
581  foreach ($available_tests as $ref_id => $title) {
583  $data[] = [
584  "title" => $title,
585  "nr" => $this->getAssessmentFolder()->getNrOfLogEntries((int) $obj_id),
586  "id" => $obj_id,
587  "location_href" => ilLink::_getLink($ref_id, 'tst'),
588  "location_txt" => $this->lng->txt("perma_link")
589  ];
590  }
591  $table_gui->setData($data);
592  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
593  }
594 
595  public function getAdminTabs(): void
596  {
597  $this->getTabs();
598  }
599 
600  public function getLogdataSubtabs(): void
601  {
602  global $DIC;
603  $ilTabs = $DIC['ilTabs'];
604 
605  // log settings
606  $ilTabs->addSubTabTarget(
607  "settings",
608  $this->ctrl->getLinkTarget($this, "showLogSettings"),
609  ["saveLogSettings", "showLogSettings"],
610  ""
611  );
612 
613  // log output
614  $ilTabs->addSubTabTarget(
615  "ass_log_output",
616  $this->ctrl->getLinkTarget($this, "logs"),
617  ["logs", "showLog", "exportLog"],
618  ""
619  );
620 
621  // log administration
622  $ilTabs->addSubTabTarget(
623  "ass_log_admin",
624  $this->ctrl->getLinkTarget($this, "logAdmin"),
625  ["logAdmin", "deleteLog"],
626  "",
627  ""
628  );
629  }
630 
631  protected function getTabs(): void
632  {
633  global $DIC;
634  $rbacsystem = $DIC['rbacsystem'];
635  $lng = $DIC['lng'];
636 
637  switch ($this->ctrl->getCmd()) {
638  case "saveLogSettings":
639  case "showLogSettings":
640  case "logs":
641  case "showLog":
642  case "exportLog":
643  case "logAdmin":
644  case "deleteLog":
645  $this->getLogdataSubtabs();
646  break;
647  }
648 
649  if ($rbacsystem->checkAccess("visible,read", $this->getAssessmentFolder()->getRefId())) {
650  $this->tabs_gui->addTarget(
651  "settings",
652  $this->ctrl->getLinkTarget($this, "settings"),
653  ["settings", "", "view"],
654  "",
655  ""
656  );
657 
658  $this->tabs_gui->addTarget(
659  "logs",
660  $this->ctrl->getLinkTarget($this, "showLogSettings"),
661  ['saveLogSettings', 'showLogSettings', "logs", "showLog", "exportLog", "logAdmin", "deleteLog"],
662  "",
663  ""
664  );
665 
666  $this->tabs_gui->addTab(
667  "templates",
668  $lng->txt("adm_settings_templates"),
669  $this->ctrl->getLinkTargetByClass("ilsettingstemplategui", "")
670  );
671 
672  $this->tabs_gui->addTarget(
673  'units',
674  $this->ctrl->getLinkTargetByClass('ilGlobalUnitConfigurationGUI', ''),
675  '',
676  'ilglobalunitconfigurationgui'
677  );
678  }
679 
680  if ($rbacsystem->checkAccess('edit_permission', $this->getAssessmentFolder()->getRefId())) {
681  $this->tabs_gui->addTarget(
682  "perm_settings",
683  $this->ctrl->getLinkTargetByClass([get_class($this), 'ilpermissiongui'], "perm"),
684  ["perm", "info", "owner"],
685  'ilpermissiongui'
686  );
687  }
688  }
689 
693  protected function showLogSettingsObject(ilPropertyFormGUI $form = null): void
694  {
695  $this->tabs_gui->activateTab('logs');
696 
697  if (!($form instanceof ilPropertyFormGUI)) {
698  $form = $this->getLogSettingsForm();
699  $form->setValuesByArray([
700  'chb_assessment_logging' => ilObjAssessmentFolder::_enabledAssessmentLogging(),
701  'reporting_language' => ilObjAssessmentFolder::_getLogLanguage()
702  ]);
703  }
704 
705  $this->tpl->setContent($form->getHTML());
706  }
707 
711  protected function saveLogSettingsObject(): void
712  {
716  global $DIC;
717  $ilAccess = $DIC['ilAccess'];
718 
719  if (!$ilAccess->checkAccess('write', '', $this->getAssessmentFolder()->getRefId())) {
720  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->WARNING);
721  }
722 
723  $form = $this->getLogSettingsForm();
724  if ($form->checkInput()) {
725  $this->getAssessmentFolder()->_enableAssessmentLogging((bool) $form->getInput('chb_assessment_logging'));
726  $this->getAssessmentFolder()->_setLogLanguage((string) $form->getInput('reporting_language'));
727  $this->getAssessmentFolder()->update();
728  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
729  }
730 
731  $form->setValuesByPost();
732  $this->showLogSettingsObject($form);
733  }
734 
738  protected function getLogSettingsForm(): ilPropertyFormGUI
739  {
743  global $DIC;
744  $ilAccess = $DIC['ilAccess'];
745 
746  $form = new ilPropertyFormGUI();
747  $form->setFormAction($this->ctrl->getFormAction($this, 'saveLogSettings'));
748  $form->setTitle($this->lng->txt('assessment_log_logging'));
749 
750  $logging = new ilCheckboxInputGUI('', 'chb_assessment_logging');
751  $logging->setValue('1');
752  $logging->setOptionTitle($this->lng->txt('activate_assessment_logging'));
753  $form->addItem($logging);
754 
755  $reporting = new ilSelectInputGUI(
756  $this->lng->txt('assessment_settings_reporting_language'),
757  'reporting_language'
758  );
759  $languages = $this->lng->getInstalledLanguages();
760  $this->lng->loadLanguageModule('meta');
761  $options = [];
762  foreach ($languages as $lang) {
763  $options[$lang] = $this->lng->txt('meta_l_' . $lang);
764  }
765  $reporting->setOptions($options);
766  $form->addItem($reporting);
767 
768  if ($ilAccess->checkAccess('write', '', $this->getAssessmentFolder()->getRefId())) {
769  $form->addCommandButton('saveLogSettings', $this->lng->txt('save'));
770  }
771 
772  return $form;
773  }
774 
775  private function forwardToSettingsTemplateGUI(): void
776  {
777  global $DIC;
778  $ilTabs = $DIC['ilTabs'];
779 
780  $ilTabs->setTabActive('templates');
781 
782  $gui = new ilSettingsTemplateGUI(self::getSettingsTemplateConfig());
783 
784  $this->ctrl->forwardCommand($gui);
785  }
786 
791  {
792  global $DIC;
793  $lng = $DIC['lng'];
794 
796  $config->init();
797 
798  return $config;
799  }
800 }
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)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInfo(string $a_info)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
Class ilObjAssessmentFolderGUI.
static _getQuestionTitle(int $question_id)
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
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 & processCSVRow(array &$row, bool $quoteAll=false, string $separator=";", bool $outUTF8=false, bool $compatibleWithMSExcel=true)
Convertes an array for CSV usage.
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
This class represents a checkbox property in a property form.
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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
logAdminObject()
Administration output for assessment log files.
if($format !==null) $name
Definition: metadata.php:247
ilLanguage $lng
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$log
Definition: result.php:33
saveSettingsObject()
Save Assessment settings.
This class represents a number property in a property form.
Class ilObjectGUI Basic methods of all Output classes.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
static _getManualScoring()
Retrieve the manual scoring settings.
static _getAvailableTests($use_object_id=false)
Returns the available tests for the active user.
__construct(Container $dic, ilPlugin $plugin)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)