19 declare(strict_types=1);
31 public function __construct($a_data,
int $a_id = 0,
bool $a_call_by_reference =
true,
bool $a_prepare_output =
true)
34 $rbacsystem = $DIC[
'rbacsystem'];
35 $this->testrequest = $DIC->test()->internal()->request();
36 $this->questioninfo = $DIC->testQuestionPool()->questionInfo();
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);
44 $this->
lng->loadLanguageModule(
'assessment');
55 $next_class = $this->
ctrl->getNextClass($this);
56 $cmd = $this->
ctrl->getCmd();
59 switch ($next_class) {
60 case 'ilpermissiongui':
61 $this->tabs_gui->activateTab(
'perm_settings');
63 $this->
ctrl->forwardCommand($perm_gui);
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);
70 $this->tabs_gui->setTabActive(
'units');
75 $this->
ctrl->forwardCommand($gui);
79 if ($cmd === null || $cmd ===
"" || $cmd ===
"view") {
91 $this->tabs_gui->setTabActive(
'settings');
97 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
103 $form->setFormAction($this->
ctrl->getFormAction($this));
104 $form->setTableWidth(
"100%");
105 $form->setId(
"settings");
108 $header->setTitle($this->
lng->txt(
'settings'));
109 $form->addItem($header);
114 $chb->setInfo($this->
lng->txt(
'ass_process_lock_desc'));
115 $form->addItem($chb);
119 $this->
lng->txt(
'ass_process_lock_mode_file'),
122 $opt->
setInfo($this->
lng->txt(
'ass_process_lock_mode_file_desc'));
123 $rg->addOption($opt);
125 $this->
lng->txt(
'ass_process_lock_mode_db'),
128 $opt->
setInfo($this->
lng->txt(
'ass_process_lock_mode_db_desc'));
129 $rg->addOption($opt);
133 $chb->addSubItem($rg);
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');
140 if ($imap_line_color ==
'') {
141 $imap_line_color =
'FF0000';
145 $linepicker->
setValue($imap_line_color);
146 $form->addItem($linepicker);
148 $user_criteria = $assessmentSetting->get(
'user_criteria');
149 if ($this->testrequest->isset(
'user_criteria')) {
150 $user_criteria = $this->testrequest->strVal(
'user_criteria');
153 $userCriteria->
setInfo($this->
lng->txt(
'user_criteria_desc'));
154 $userCriteria->setRequired(
true);
156 $fields = [
'usr_id',
'login',
'email',
'matriculation',
'ext_account'];
158 foreach ($fields as $field) {
159 $usr_fields[$field] = $field;
161 $userCriteria->setOptions($usr_fields);
162 $userCriteria->setValue($user_criteria);
163 $form->addItem($userCriteria);
166 $this->
lng->txt(
'tst_skill_triggerings_num_req_answers'),
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);
177 $ceeqwh =
new ilCheckboxInputGUI($this->
lng->txt(
'export_essay_qst_with_html'),
'export_essay_qst_with_html');
179 $ceeqwh->setInfo($this->
lng->txt(
'export_essay_qst_with_html_desc'));
180 $form->addItem($ceeqwh);
184 $header->setTitle($this->
lng->txt(
"assf_questiontypes"));
185 $form->addItem($header);
189 $this->
lng->txt(
'assf_allowed_questiontypes'),
190 "chb_allowed_questiontypes" 195 foreach ($questiontypes as $qt) {
196 if (!in_array($qt[
'question_type_id'], $forbidden_types)) {
197 $allowedtypes[] = $qt[
'question_type_id'];
200 $allowed->setValue($allowedtypes);
201 foreach ($questiontypes as $type_name => $qtype) {
202 $allowed->addOption(
new ilCheckboxOption($type_name, (
string) $qtype[
"question_type_id"]));
204 $allowed->setInfo($this->
lng->txt(
'assf_allowed_questiontypes_desc'));
205 $form->addItem($allowed);
209 $this->
lng->txt(
'assessment_log_manual_scoring_activate'),
213 $manual->setValue($manscoring);
214 foreach ($questiontypes as $type_name => $qtype) {
215 $manual->addOption(
new ilCheckboxOption($type_name, (
string) $qtype[
"question_type_id"]));
217 $manual->setInfo($this->
lng->txt(
'assessment_log_manual_scoring_desc'));
218 $form->addItem($manual);
222 $this->
lng->txt(
'assessment_scoring_adjust'),
225 $scoring_activation->setChecked($this->
getAssessmentFolder()->getScoringAdjustmentEnabled());
226 $scoring_activation->setInfo($this->
lng->txt(
'assessment_scoring_adjust_desc'));
227 $form->addItem($scoring_activation);
231 $this->
lng->txt(
'assessment_log_scoring_adjustment_activate'),
232 "chb_scoring_adjustment" 235 $scoring->setValue($scoring_active);
237 foreach ($this->
getAssessmentFolder()->fetchScoringAdjustableTypes($questiontypes) as $type_name => $qtype) {
242 $scoring->setInfo($this->
lng->txt(
'assessment_log_scoring_adjustment_desc'));
243 $form->addItem($scoring);
245 if ($this->
access->checkAccess(
"write",
"", $this->getAssessmentFolder()->getRefId())) {
246 $form->addCommandButton(
"saveSettings", $this->
lng->txt(
"save"));
257 if (!$this->
access->checkAccess(
"write",
"", $this->getAssessmentFolder()->getRefId())) {
258 $this->
ctrl->redirect($this,
'settings');
262 if (!$form->checkInput()) {
263 $form->setValuesByPost();
268 $this->
getAssessmentFolder()->setSkillTriggeringNumAnswersBarrier((
int) $form->getInput(
'num_req_answers'));
270 (
bool) ($form->getInput(
'export_essay_qst_with_html') ??
'0')
272 $this->
getAssessmentFolder()->_setManualScoring($form->getInput(
'chb_manual_scoring') ?? []);
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"];
283 (
bool) ($form->getInput(
'chb_scoring_adjust') ??
'0')
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"];
293 if (!$form->getInput(
'ass_process_lock')) {
296 $form->getInput(
'ass_process_lock_mode'),
300 $this->
getAssessmentFolder()->setAssessmentProcessLockMode($form->getInput(
'ass_process_lock_mode'));
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')));
308 $assessmentSetting->set(
'user_criteria',
ilUtil::stripSlashes($form->getInput(
'user_criteria')));
310 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
312 $this->
ctrl->redirect($this,
'settings');
323 $form->setValuesByPost();
333 if (!$form->checkInput()) {
334 $form->setValuesByPost();
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);
346 $this->
lng->txt(
"assessment_log_datetime"),
347 $this->
lng->txt(
"user"),
348 $this->
lng->txt(
"assessment_log_text"),
349 $this->
lng->txt(
"question")
356 foreach ($log_output as
$key =>
$log) {
357 if (!array_key_exists(
$log[
"user_fi"], $users)) {
361 if (
$log[
"question_fi"] ||
$log[
"original_fi"]) {
362 $title = $this->questioninfo->getQuestionTitle((
int)
$log[
"question_fi"]);
364 $title = $this->questioninfo->getQuestionTitle((
int) $log[
"original_fi"]);
366 $title = $this->
lng->txt(
"assessment_log_question") .
": " . $title;
371 $csvrow[] = trim($users[$log[
"user_fi"]][
"title"] .
" " . $users[$log[
"user_fi"]][
"firstname"] .
" " . $users[$log[
"user_fi"]][
"lastname"]);
372 $csvrow[] = trim($log[
"logtext"]);
377 foreach ($csv as $row) {
378 $csvoutput .= implode($separator, $row) .
"\n";
382 str_replace(
" ",
"_",
"log_" . $from .
"_" . $until .
"_" . $available_tests[$test]) .
".csv" 392 $form->setPreventDoubleSubmission(
false);
393 $form->setFormAction($this->
ctrl->getFormAction($this));
394 $form->setTableWidth(
"100%");
395 $form->setId(
"logs");
398 $header->setTitle($this->
lng->txt(
"assessment_log"));
399 $form->addItem($header);
404 $from->setRequired(
true);
405 $form->addItem($from);
410 $until->setRequired(
true);
411 $form->addItem($until);
418 $sorted_options = [];
419 foreach ($available_tests as
$key => $value) {
420 $sorted_options[] = [
426 $options = [
'' => $this->
lng->txt(
'please_choose')];
427 foreach ($sorted_options as $option) {
428 $options[$option[
'key']] = $option[
'title'];
430 $fortest->setOptions($options);
431 $form->addItem($fortest);
433 $form->addCommandButton(
'showLog', $this->
lng->txt(
'show'));
434 $form->addCommandButton(
'exportLog', $this->
lng->txt(
'export'));
444 $this->tabs_gui->activateTab(
'logs');
446 $template =
new ilTemplate(
"tpl.assessment_logs.html",
true,
true,
"Modules/Test");
456 if ($this->testrequest->isset(
'sel_test')) {
457 $p_test = $values[
'sel_test'] = $this->testrequest->int(
'sel_test');
460 if ($this->testrequest->isset(
'log_from')) {
461 $fromdate = $this->testrequest->int(
'log_from');
463 $fromdate = mktime(0, 0, 0, 1, 1, (
int) date(
'Y'));
466 if ($this->testrequest->isset(
'log_until')) {
467 $untildate = $this->testrequest->int(
'log_until');
475 $form->setValuesByArray($values);
477 $fromdate_input = $form->getItemByPostVar(
'log_from')->getDate();
478 $untildate_input = $form->getItemByPostVar(
'log_until')->getDate();
480 $p_test = (
int) $form->getInput(
'sel_test');
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);
491 $template->setVariable(
"FORM", $form->getHTML());
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");
507 $table_gui->setData($log_output);
508 $template->setVariable(
'LOG', $table_gui->getHTML());
510 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
518 $test_ids = $this->post_wrapper->retrieve(
521 $this->refinery->kindlyTo()->listOf($this->
refinery->kindlyTo()->int()),
526 if ($test_ids !== []) {
528 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"ass_log_deleted"));
530 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"ass_log_delete_no_selection"));
541 $this->tabs_gui->activateTab(
'logs');
549 foreach ($available_tests as
$ref_id => $title) {
555 "location_href" => ilLink::_getLink(
$ref_id,
'tst'),
556 "location_txt" => $this->
lng->txt(
"perma_link")
559 $table_gui->setData(
$data);
560 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
570 $this->tabs_gui->addSubTabTarget(
572 $this->
ctrl->getLinkTarget($this,
"showLogSettings"),
573 [
"saveLogSettings",
"showLogSettings"],
578 $this->tabs_gui->addSubTabTarget(
580 $this->
ctrl->getLinkTarget($this,
"logs"),
581 [
"logs",
"showLog",
"exportLog"],
586 $this->tabs_gui->addSubTabTarget(
588 $this->
ctrl->getLinkTarget($this,
"logAdmin"),
589 [
"logAdmin",
"deleteLog"],
597 switch ($this->
ctrl->getCmd()) {
598 case "saveLogSettings":
599 case "showLogSettings":
609 if ($this->rbac_system->checkAccess(
"visible,read", $this->getAssessmentFolder()->getRefId())) {
610 $this->tabs_gui->addTarget(
612 $this->
ctrl->getLinkTarget($this,
"settings"),
613 [
"settings",
"",
"view"],
618 $this->tabs_gui->addTarget(
620 $this->
ctrl->getLinkTarget($this,
"showLogSettings"),
621 [
'saveLogSettings',
'showLogSettings',
"logs",
"showLog",
"exportLog",
"logAdmin",
"deleteLog"],
626 $this->tabs_gui->addTarget(
628 $this->
ctrl->getLinkTargetByClass(
'ilGlobalUnitConfigurationGUI',
''),
630 'ilglobalunitconfigurationgui' 634 if ($this->rbac_system->checkAccess(
'edit_permission', $this->getAssessmentFolder()->getRefId())) {
635 $this->tabs_gui->addTarget(
637 $this->
ctrl->getLinkTargetByClass([get_class($this),
'ilpermissiongui'],
"perm"),
638 [
"perm",
"info",
"owner"],
649 $this->tabs_gui->activateTab(
'logs');
653 $form->setValuesByArray([
659 $this->tpl->setContent($form->getHTML());
667 if (!$this->
access->checkAccess(
'write',
'', $this->getAssessmentFolder()->getRefId())) {
668 $this->
ilias->raiseError($this->
lng->txt(
"permission_denied"), $this->
ilias->error_obj->WARNING);
672 if ($form->checkInput()) {
673 $this->
getAssessmentFolder()->_enableAssessmentLogging((
bool) $form->getInput(
'chb_assessment_logging'));
674 $this->
getAssessmentFolder()->_setLogLanguage((
string) $form->getInput(
'reporting_language'));
676 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'));
679 $form->setValuesByPost();
689 $form->setFormAction($this->
ctrl->getFormAction($this,
'saveLogSettings'));
690 $form->setTitle($this->
lng->txt(
'assessment_log_logging'));
693 $logging->setValue(
'1');
694 $logging->setOptionTitle($this->
lng->txt(
'activate_assessment_logging'));
695 $form->addItem($logging);
698 $this->
lng->txt(
'assessment_settings_reporting_language'),
701 $languages = $this->
lng->getInstalledLanguages();
702 $this->
lng->loadLanguageModule(
'meta');
704 foreach ($languages as
$lang) {
705 $options[
$lang] = $this->
lng->txt(
'meta_l_' . $lang);
707 $reporting->setOptions($options);
708 $form->addItem($reporting);
710 if ($this->
access->checkAccess(
'write',
'', $this->getAssessmentFolder()->getRefId())) {
711 $form->addCommandButton(
'saveLogSettings', $this->
lng->txt(
'save'));
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...
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)
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)
const ASS_PROC_LOCK_MODE_DB
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...
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
static getValidAssessmentProcessLockModes()
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
const ASS_PROC_LOCK_MODE_NONE
logAdminObject()
Administration output for assessment log files.
const ASS_PROC_LOCK_MODE_FILE
static _enabledAssessmentLogging()
saveSettingsObject()
Save Assessment settings.
Class ilObjectGUI Basic methods of all Output classes.
Class ilObjAssessmentFolder.
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
static _lookupObjectId(int $ref_id)
header include for all ilias files.
showLogSettingsObject(ilPropertyFormGUI $form=null)
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)