19declare(strict_types=1);
30 public function __construct($a_data,
int $a_id = 0,
bool $a_call_by_reference =
true,
bool $a_prepare_output =
true)
33 $rbacsystem =
$DIC[
'rbacsystem'];
34 $this->testrequest =
$DIC->test()->internal()->request();
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);
42 $this->
lng->loadLanguageModule(
'assessment');
58 $rbacsystem =
$DIC[
'rbacsystem'];
59 $ilTabs =
$DIC[
'ilTabs'];
61 $next_class = $this->
ctrl->getNextClass($this);
62 $cmd = $this->
ctrl->getCmd();
65 switch ($next_class) {
66 case 'ilpermissiongui':
67 $ilTabs->activateTab(
'perm_settings');
69 $ret = $this->
ctrl->forwardCommand($perm_gui);
72 case 'ilsettingstemplategui':
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);
81 $ilTabs->setTabActive(
'units');
86 $this->
ctrl->forwardCommand($gui);
90 if ($cmd ===
null || $cmd ===
"" || $cmd ===
"view") {
103 $ilTabs =
$DIC[
'ilTabs'];
105 $ilTabs->setTabActive(
'settings');
107 if ($form ===
null) {
108 $form = $this->buildSettingsForm();
111 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
120 $ilAccess =
$DIC[
'ilAccess'];
123 $form->setFormAction($this->
ctrl->getFormAction($this));
124 $form->setTableWidth(
"100%");
125 $form->setId(
"settings");
128 $header->setTitle($this->
lng->txt(
'settings'));
129 $form->addItem($header);
134 $chb->setInfo($this->
lng->txt(
'ass_process_lock_desc'));
135 $form->addItem($chb);
137 $rg->setRequired(
true);
139 $this->
lng->txt(
'ass_process_lock_mode_file'),
142 $opt->setInfo($this->
lng->txt(
'ass_process_lock_mode_file_desc'));
143 $rg->addOption($opt);
145 $this->
lng->txt(
'ass_process_lock_mode_db'),
148 $opt->setInfo($this->
lng->txt(
'ass_process_lock_mode_db_desc'));
149 $rg->addOption($opt);
153 $chb->addSubItem($rg);
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');
160 if ($imap_line_color ==
'') {
161 $imap_line_color =
'FF0000';
165 $linepicker->setValue($imap_line_color);
166 $form->addItem($linepicker);
168 $user_criteria = $assessmentSetting->get(
'user_criteria');
169 if ($this->testrequest->isset(
'user_criteria')) {
170 $user_criteria = $this->testrequest->strVal(
'user_criteria');
173 $userCriteria->setInfo($this->
lng->txt(
'user_criteria_desc'));
174 $userCriteria->setRequired(
true);
176 $fields = [
'usr_id',
'login',
'email',
'matriculation',
'ext_account'];
178 foreach ($fields as $field) {
179 $usr_fields[$field] = $field;
181 $userCriteria->setOptions($usr_fields);
182 $userCriteria->setValue($user_criteria);
183 $form->addItem($userCriteria);
186 $this->
lng->txt(
'tst_skill_triggerings_num_req_answers'),
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);
197 $ceeqwh =
new ilCheckboxInputGUI($this->
lng->txt(
'export_essay_qst_with_html'),
'export_essay_qst_with_html');
199 $ceeqwh->setInfo($this->
lng->txt(
'export_essay_qst_with_html_desc'));
200 $form->addItem($ceeqwh);
204 $header->setTitle($this->
lng->txt(
"assf_questiontypes"));
205 $form->addItem($header);
209 $this->
lng->txt(
'assf_allowed_questiontypes'),
210 "chb_allowed_questiontypes"
215 foreach ($questiontypes as $qt) {
216 if (!in_array($qt[
'question_type_id'], $forbidden_types)) {
217 $allowedtypes[] = $qt[
'question_type_id'];
220 $allowed->setValue($allowedtypes);
221 foreach ($questiontypes as $type_name => $qtype) {
222 $allowed->addOption(
new ilCheckboxOption($type_name, (
string) $qtype[
"question_type_id"]));
224 $allowed->setInfo($this->
lng->txt(
'assf_allowed_questiontypes_desc'));
225 $form->addItem($allowed);
229 $this->
lng->txt(
'assessment_log_manual_scoring_activate'),
233 $manual->setValue($manscoring);
234 foreach ($questiontypes as $type_name => $qtype) {
235 $manual->addOption(
new ilCheckboxOption($type_name, (
string) $qtype[
"question_type_id"]));
237 $manual->setInfo($this->
lng->txt(
'assessment_log_manual_scoring_desc'));
238 $form->addItem($manual);
242 $this->
lng->txt(
'assessment_scoring_adjust'),
245 $scoring_activation->setChecked($this->
getAssessmentFolder()->getScoringAdjustmentEnabled());
246 $scoring_activation->setInfo($this->
lng->txt(
'assessment_scoring_adjust_desc'));
247 $form->addItem($scoring_activation);
251 $this->
lng->txt(
'assessment_log_scoring_adjustment_activate'),
252 "chb_scoring_adjustment"
255 $scoring->setValue($scoring_active);
257 foreach ($this->
getAssessmentFolder()->fetchScoringAdjustableTypes($questiontypes) as $type_name => $qtype) {
262 $scoring->setInfo($this->
lng->txt(
'assessment_log_scoring_adjustment_desc'));
263 $form->addItem($scoring);
265 if ($ilAccess->checkAccess(
"write",
"", $this->getAssessmentFolder()->getRefId())) {
266 $form->addCommandButton(
"saveSettings", $this->
lng->txt(
"save"));
278 $ilAccess =
$DIC[
'ilAccess'];
279 if (!$ilAccess->checkAccess(
"write",
"", $this->getAssessmentFolder()->getRefId())) {
280 $this->
ctrl->redirect($this,
'settings');
283 $form = $this->buildSettingsForm();
284 if (!$form->checkInput()) {
285 $form->setValuesByPost();
290 $this->
getAssessmentFolder()->setSkillTriggeringNumAnswersBarrier((
int) $form->getInput(
'num_req_answers'));
292 (
bool) ($form->getInput(
'export_essay_qst_with_html') ??
'0')
294 $this->
getAssessmentFolder()->_setManualScoring($form->getInput(
'chb_manual_scoring') ?? []);
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"];
305 (
bool) ($form->getInput(
'chb_scoring_adjust') ??
'0')
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"];
315 if (!$form->getInput(
'ass_process_lock')) {
318 $form->getInput(
'ass_process_lock_mode'),
322 $this->
getAssessmentFolder()->setAssessmentProcessLockMode($form->getInput(
'ass_process_lock_mode'));
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')));
330 $assessmentSetting->set(
'user_criteria',
ilUtil::stripSlashes($form->getInput(
'user_criteria')));
332 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
334 $this->
ctrl->redirect($this,
'settings');
345 $form->setValuesByPost();
346 $this->logsObject($form);
355 if (!$form->checkInput()) {
356 $form->setValuesByPost();
357 $this->logsObject($form);
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);
368 $this->
lng->txt(
"assessment_log_datetime"),
369 $this->
lng->txt(
"user"),
370 $this->
lng->txt(
"assessment_log_text"),
371 $this->
lng->txt(
"question")
378 foreach ($log_output as
$key =>
$log) {
379 if (!array_key_exists(
$log[
"user_fi"], $users)) {
383 if (
$log[
"question_fi"] ||
$log[
"original_fi"]) {
388 $title = $this->
lng->txt(
"assessment_log_question") .
": " . $title;
393 $csvrow[] = trim($users[
$log[
"user_fi"]][
"title"] .
" " . $users[
$log[
"user_fi"]][
"firstname"] .
" " . $users[
$log[
"user_fi"]][
"lastname"]);
394 $csvrow[] = trim(
$log[
"logtext"]);
399 foreach ($csv as $row) {
400 $csvoutput .= implode($separator, $row) .
"\n";
404 str_replace(
" ",
"_",
"log_" . $from .
"_" . $until .
"_" . $available_tests[$test]) .
".csv"
414 $form->setPreventDoubleSubmission(
false);
415 $form->setFormAction($this->
ctrl->getFormAction($this));
416 $form->setTableWidth(
"100%");
417 $form->setId(
"logs");
420 $header->setTitle($this->
lng->txt(
"assessment_log"));
421 $form->addItem($header);
425 $from->setShowTime(
true);
426 $from->setRequired(
true);
427 $form->addItem($from);
431 $until->setShowTime(
true);
432 $until->setRequired(
true);
433 $form->addItem($until);
439 $fortest->setRequired(
true);
440 $sorted_options = [];
441 foreach ($available_tests as
$key => $value) {
442 $sorted_options[] = [
448 $options = [
'' => $this->
lng->txt(
'please_choose')];
449 foreach ($sorted_options as $option) {
450 $options[$option[
'key']] = $option[
'title'];
452 $fortest->setOptions($options);
453 $form->addItem($fortest);
455 $form->addCommandButton(
'showLog', $this->
lng->txt(
'show'));
456 $form->addCommandButton(
'exportLog', $this->
lng->txt(
'export'));
470 $ilTabs =
$DIC[
'ilTabs'];
472 $ilTabs->activateTab(
'logs');
474 $template =
new ilTemplate(
"tpl.assessment_logs.html",
true,
true,
"Modules/Test");
484 if ($this->testrequest->isset(
'sel_test')) {
485 $p_test = $values[
'sel_test'] = $this->testrequest->int(
'sel_test');
488 if ($this->testrequest->isset(
'log_from')) {
489 $fromdate = $this->testrequest->int(
'log_from');
491 $fromdate = mktime(0, 0, 0, 1, 1, (
int) date(
'Y'));
494 if ($this->testrequest->isset(
'log_until')) {
495 $untildate = $this->testrequest->int(
'log_until');
503 $form->setValuesByArray($values);
505 $fromdate_input = $form->getItemByPostVar(
'log_from')->getDate();
506 $untildate_input = $form->getItemByPostVar(
'log_until')->getDate();
508 $p_test = (
int) $form->getInput(
'sel_test');
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);
519 $template->setVariable(
"FORM", $form->getHTML());
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) {
531 $row[
'location_txt'] = $self->lng->txt(
"perma_link");
535 $table_gui->setData($log_output);
536 $template->setVariable(
'LOG', $table_gui->getHTML());
538 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
546 $test_ids = $this->post_wrapper->retrieve(
549 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
550 $this->refinery->always([])
554 if ($test_ids !== []) {
556 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"ass_log_deleted"));
558 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"ass_log_delete_no_selection"));
570 $ilAccess =
$DIC[
'ilAccess'];
571 $ilTabs =
$DIC[
'ilTabs'];
573 $ilTabs->activateTab(
'logs');
581 foreach ($available_tests as
$ref_id => $title) {
588 "location_txt" => $this->
lng->txt(
"perma_link")
591 $table_gui->setData(
$data);
592 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
603 $ilTabs =
$DIC[
'ilTabs'];
606 $ilTabs->addSubTabTarget(
608 $this->
ctrl->getLinkTarget($this,
"showLogSettings"),
609 [
"saveLogSettings",
"showLogSettings"],
614 $ilTabs->addSubTabTarget(
616 $this->
ctrl->getLinkTarget($this,
"logs"),
617 [
"logs",
"showLog",
"exportLog"],
622 $ilTabs->addSubTabTarget(
624 $this->
ctrl->getLinkTarget($this,
"logAdmin"),
625 [
"logAdmin",
"deleteLog"],
634 $rbacsystem =
$DIC[
'rbacsystem'];
637 switch ($this->
ctrl->getCmd()) {
638 case "saveLogSettings":
639 case "showLogSettings":
649 if ($rbacsystem->checkAccess(
"visible,read", $this->getAssessmentFolder()->getRefId())) {
650 $this->tabs_gui->addTarget(
652 $this->
ctrl->getLinkTarget($this,
"settings"),
653 [
"settings",
"",
"view"],
658 $this->tabs_gui->addTarget(
660 $this->
ctrl->getLinkTarget($this,
"showLogSettings"),
661 [
'saveLogSettings',
'showLogSettings',
"logs",
"showLog",
"exportLog",
"logAdmin",
"deleteLog"],
666 $this->tabs_gui->addTab(
668 $lng->
txt(
"adm_settings_templates"),
669 $this->ctrl->getLinkTargetByClass(
"ilsettingstemplategui",
"")
672 $this->tabs_gui->addTarget(
674 $this->
ctrl->getLinkTargetByClass(
'ilGlobalUnitConfigurationGUI',
''),
676 'ilglobalunitconfigurationgui'
680 if ($rbacsystem->checkAccess(
'edit_permission', $this->getAssessmentFolder()->getRefId())) {
681 $this->tabs_gui->addTarget(
683 $this->
ctrl->getLinkTargetByClass([get_class($this),
'ilpermissiongui'],
"perm"),
684 [
"perm",
"info",
"owner"],
695 $this->tabs_gui->activateTab(
'logs');
698 $form = $this->getLogSettingsForm();
699 $form->setValuesByArray([
705 $this->tpl->setContent($form->getHTML());
711 protected function saveLogSettingsObject(): void
717 $ilAccess =
$DIC[
'ilAccess'];
719 if (!$ilAccess->checkAccess(
'write',
'', $this->getAssessmentFolder()->getRefId())) {
720 $this->
ilias->raiseError($this->
lng->txt(
"permission_denied"), $this->ilias->error_obj->WARNING);
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'));
728 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'));
731 $form->setValuesByPost();
744 $ilAccess =
$DIC[
'ilAccess'];
747 $form->setFormAction($this->
ctrl->getFormAction($this,
'saveLogSettings'));
748 $form->setTitle($this->
lng->txt(
'assessment_log_logging'));
751 $logging->setValue(
'1');
752 $logging->setOptionTitle($this->
lng->txt(
'activate_assessment_logging'));
753 $form->addItem($logging);
756 $this->
lng->txt(
'assessment_settings_reporting_language'),
759 $languages = $this->
lng->getInstalledLanguages();
760 $this->
lng->loadLanguageModule(
'meta');
762 foreach ($languages as
$lang) {
763 $options[
$lang] = $this->
lng->txt(
'meta_l_' . $lang);
765 $reporting->setOptions($options);
766 $form->addItem($reporting);
768 if ($ilAccess->checkAccess(
'write',
'', $this->getAssessmentFolder()->getRefId())) {
769 $form->addCommandButton(
'saveLogSettings', $this->
lng->txt(
'save'));
778 $ilTabs =
$DIC[
'ilTabs'];
780 $ilTabs->setTabActive(
'templates');
784 $this->
ctrl->forwardCommand($gui);
static _getQuestionTitle(int $question_id)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
Class ilObjAssessmentFolderGUI.
__construct($a_data, int $a_id=0, bool $a_call_by_reference=true, bool $a_prepare_output=true)
settingsObject(ilPropertyFormGUI $form=null)
logAdminObject()
Administration output for assessment log files.
getAdminTabs()
administration tabs show only permissions and trash folder
saveSettingsObject()
Save Assessment settings.
deleteLogObject()
Deletes the log entries for one or more tests.
forwardToSettingsTemplateGUI()
showLogSettingsObject(ilPropertyFormGUI $form=null)
exportLogObject()
Called when the a log should be exported.
showLogObject()
Called when the a log should be shown.
static getSettingsTemplateConfig()
ILIAS Test InternalRequestService $testrequest
getTabs()
@abstract overwrite in derived GUI class of your object type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ASS_PROC_LOCK_MODE_FILE
static getLog(int $ts_from, int $ts_to, int $test_id, bool $test_only=false)
Retrieve assessment log datasets from the database.
static _getManualScoring()
Retrieve the manual scoring settings.
const ASS_PROC_LOCK_MODE_NONE
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
static getValidAssessmentProcessLockModes()
static _enabledAssessmentLogging()
const ASS_PROC_LOCK_MODE_DB
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
static _getAvailableTests($use_object_id=false)
Returns the available tests for the active user.
static _lookupName(int $a_user_id)
lookup user name
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput(bool $show_sub_objects=true)
static _lookupObjectId(int $ref_id)
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
header include for all ilias files.