From ca674a7e884f3e8e69bb6e213186bb9db215f53e Mon Sep 17 00:00:00 2001 From: Stephan Kergomard Date: Thu, 11 Apr 2024 16:41:43 +0200 Subject: [PATCH 01/35] Test: Fix Unnecessary Variable in Print-View See: https://mantis.ilias.de/view.php?id=40153 --- Modules/Test/classes/class.ilObjTestGUI.php | 5 +---- .../templates/default/tpl.il_as_tst_print_test_confirm.html | 4 ++-- Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php | 3 +-- .../classes/feedback/class.ilAssGenFeedbackPageGUI.php | 3 +-- .../classes/feedback/class.ilAssQuestionFeedback.php | 3 +-- .../classes/feedback/class.ilAssSpecFeedbackPageGUI.php | 3 +-- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Modules/Test/classes/class.ilObjTestGUI.php b/Modules/Test/classes/class.ilObjTestGUI.php index b8f22727f93d..0d8ce273415f 100755 --- a/Modules/Test/classes/class.ilObjTestGUI.php +++ b/Modules/Test/classes/class.ilObjTestGUI.php @@ -2316,7 +2316,7 @@ public function participantsActionObject() * * @access public */ - public function printobject() + public function printObject() { if (!$this->access->checkAccess("write", "", $this->ref_id)) { // allow only write access @@ -2360,18 +2360,15 @@ public function printobject() $template->setVariable("TITLE", ilLegacyFormElementsUtil::prepareFormOutput($this->object->getTitle())); $template->setVariable("PRINT_TEST", ilLegacyFormElementsUtil::prepareFormOutput($this->lng->txt("tst_print"))); $template->setVariable("TXT_PRINT_DATE", ilLegacyFormElementsUtil::prepareFormOutput($this->lng->txt("date"))); - $used_relative_dates = ilDatePresentation::useRelativeDates(); $template->setVariable( "VALUE_PRINT_DATE", ilDatePresentation::formatDate(new ilDateTime($print_date, IL_CAL_UNIX)) ); - $use = ilDatePresentation::setUseRelativeDates($used_relative_dates); $template->setVariable( "TXT_MAXIMUM_POINTS", ilLegacyFormElementsUtil::prepareFormOutput($this->lng->txt("tst_maximum_points")) ); $template->setVariable("VALUE_MAXIMUM_POINTS", ilLegacyFormElementsUtil::prepareFormOutput($max_points)); - $this->tpl->setVariable("PRINT_CONTENT", $template->get()); } diff --git a/Modules/Test/templates/default/tpl.il_as_tst_print_test_confirm.html b/Modules/Test/templates/default/tpl.il_as_tst_print_test_confirm.html index ed56e00836ef..bd9d9626c703 100644 --- a/Modules/Test/templates/default/tpl.il_as_tst_print_test_confirm.html +++ b/Modules/Test/templates/default/tpl.il_as_tst_print_test_confirm.html @@ -10,7 +10,7 @@

{TITLE}

{TXT_PRINT_DATE}: {VALUE_PRINT_DATE}  {TXT_MAXIMUM_POINTS}: {VALUE_MAXIMUM_POINTS}

-

{QUESTION_HEADER} [{TXT_QUESTION_ID}: {QUESTION_ID}]

-

{SOLUTION_OUTPUT}

+
{QUESTION_HEADER} [{TXT_QUESTION_ID}: {QUESTION_ID}]
+ {SOLUTION_OUTPUT}
diff --git a/Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php b/Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php index fb1740dd9708..44adacc70379 100755 --- a/Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php +++ b/Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php @@ -36,8 +36,7 @@ class ilAssHintPageGUI extends ilPageObjectGUI public function __construct($a_id = 0, $a_old_nr = 0) { parent::__construct("qht", $a_id, $a_old_nr); - $this->setTemplateTargetVar('ADM_CONTENT'); - $this->setTemplateOutput(true); + $this->setTemplateOutput(false); } public function preview(): string diff --git a/Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php b/Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php index fac8786d2932..dc02a5e77315 100755 --- a/Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php +++ b/Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php @@ -44,8 +44,7 @@ public function __construct($a_id = 0, $a_old_nr = 0) } parent::__construct("qfbg", $a_id, $a_old_nr); - $this->setTemplateTargetVar('ADM_CONTENT'); - $this->setTemplateOutput(true); + $this->setTemplateOutput(false); if (strtolower($cmd_class) === 'ilassquestionpreviewgui') { $this->setFileDownloadLink($this->ctrl->getLinkTargetByClass(ilObjQuestionPoolGUI::class, 'downloadFile')); } else { diff --git a/Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php b/Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php index f50f569f6806..67bac71cc15d 100644 --- a/Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php +++ b/Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php @@ -569,9 +569,8 @@ final protected function getPageObjectContent(string $page_object_type, int $pag $mode = ($this->ctrl->isAsynch()) ? "presentation" : $this->getPageObjectOutputMode(); + /** @var ilPageObjectGUI $pageObjectGUI */ $pageObjectGUI = new $cl($page_object_id); - $pageObjectGUI->setOutputMode($mode); - return $pageObjectGUI->presentation($mode); } diff --git a/Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php b/Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php index 6deda15a465b..ea22978bd371 100755 --- a/Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php +++ b/Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php @@ -45,8 +45,7 @@ public function __construct($a_id = 0, $a_old_nr = 0) } parent::__construct("qfbs", $a_id, $a_old_nr); - $this->setTemplateTargetVar('ADM_CONTENT'); - $this->setTemplateOutput(true); + $this->setTemplateOutput(false); if (strtolower($cmd_class) === 'ilassquestionpreviewgui') { $this->setFileDownloadLink($this->ctrl->getLinkTargetByClass(ilObjQuestionPoolGUI::class, 'downloadFile')); } else { From 107327f6a232754e35c08f2312b169f8d4c512e4 Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Thu, 11 Apr 2024 14:50:34 +0000 Subject: [PATCH 02/35] workaround Mantis #41112 for not correct stored session_max_idle --- Modules/Scorm2004/classes/class.ilSCORM13PlayerGUI.php | 4 +++- Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/Scorm2004/classes/class.ilSCORM13PlayerGUI.php b/Modules/Scorm2004/classes/class.ilSCORM13PlayerGUI.php index 46fa3afe9ea8..1a82c90ab095 100755 --- a/Modules/Scorm2004/classes/class.ilSCORM13PlayerGUI.php +++ b/Modules/Scorm2004/classes/class.ilSCORM13PlayerGUI.php @@ -383,7 +383,9 @@ public function getPlayer(): void if ($session_timeout > $min_idle) { $session_timeout = $min_idle; } - $session_timeout -= 10; //buffer + if ($session_timeout > 10) { //buffer + $session_timeout -= 10; + } } else { $session_timeout = 0; } diff --git a/Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php b/Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php index ad673da54bd0..bff1f9cd2fed 100644 --- a/Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php +++ b/Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php @@ -86,7 +86,9 @@ public static function getIliasScormVars(ilObjSCORMLearningModule $slm_obj): str if ($session_timeout > $min_idle) { $session_timeout = $min_idle; } - $session_timeout -= 10; //buffer + if ($session_timeout > 10) { //buffer + $session_timeout -= 10; + } } $b_autoReview = 'false'; if ($slm_obj->getAutoReview()) { From cfb167fdf4e889914ca70091e99782ecdaa9d44d Mon Sep 17 00:00:00 2001 From: Stephan Kergomard Date: Thu, 11 Apr 2024 17:35:22 +0200 Subject: [PATCH 03/35] User: Allow Empty Online Status Pref ...and clean-up brackets. See: https://mantis.ilias.de/view.php?id=41110 --- .../User/classes/class.ilUserImportParser.php | 796 +++++++++--------- 1 file changed, 398 insertions(+), 398 deletions(-) diff --git a/Services/User/classes/class.ilUserImportParser.php b/Services/User/classes/class.ilUserImportParser.php index 96ae3d8ed5ff..7c3cc1686bdc 100755 --- a/Services/User/classes/class.ilUserImportParser.php +++ b/Services/User/classes/class.ilUserImportParser.php @@ -270,13 +270,13 @@ public function __construct( if (!ilSystemStyleSettings::_lookupActivatedStyle($skin->getId(), $style->getId())) { continue; } - $this->userStyles [] = $skin->getId() . ":" . $style->getId(); + $this->userStyles [] = $skin->getId() . ':' . $style->getId(); } } } - $this->hideSkin = (!$this->user_settings_config->isVisible("skin_style")); - $this->disableSkin = (!$this->user_settings_config->isChangeable("skin_style")); + $this->hideSkin = (!$this->user_settings_config->isVisible('skin_style')); + $this->disableSkin = (!$this->user_settings_config->isChangeable('skin_style')); $this->acc_mail = new ilAccountMail(); $this->acc_mail->setAttachConfiguredFiles(true); @@ -336,21 +336,21 @@ public function setRoleAssignment(array $a_assign): void */ public function buildTag(string $type, string $name, array $attr = null): string // Missing array type. { - $tag = "<"; + $tag = '<'; - if ($type === "end") { - $tag .= "/"; + if ($type === 'end') { + $tag .= '/'; } $tag .= $name; if (is_array($attr)) { foreach ($attr as $k => $v) { - $tag .= " " . $k . "=\"$v\""; + $tag .= " {$k}='{$v}'"; } } - $tag .= ">"; + $tag .= '>'; return $tag; } @@ -372,7 +372,7 @@ public function handlerBeginTag( break; } - $this->cdata = ""; + $this->cdata = ''; } /** @@ -384,14 +384,14 @@ public function extractRolesBeginTag( array $a_attribs ): void { switch ($a_name) { - case "Role": + case 'Role': // detect numeric, ilias id (then extract role id) or alphanumeric - $current_role_id = $a_attribs["Id"]; + $current_role_id = $a_attribs['Id']; if (($internal_id = ilUtil::__extractId($current_role_id, (int) IL_INST_ID)) > 0) { $current_role_id = $internal_id; } $this->current_role_id = $this->refinery->kindlyTo()->string()->transform($current_role_id); - $this->current_role_type = $a_attribs["Type"]; + $this->current_role_type = $a_attribs['Type']; break; } } @@ -405,30 +405,30 @@ public function importBeginTag( array $a_attribs ): void { switch ($a_name) { - case "Role": - $current_role_id = $a_attribs["Id"]; + case 'Role': + $current_role_id = $a_attribs['Id']; if (($internal_id = ilUtil::__extractId($current_role_id, (int) IL_INST_ID)) > 0) { $current_role_id = $internal_id; } $this->current_role_id = (string) $current_role_id; - $this->current_role_type = $a_attribs["Type"]; - $this->current_role_action = (!isset($a_attribs["Action"])) ? "Assign" : $a_attribs["Action"]; + $this->current_role_type = $a_attribs['Type']; + $this->current_role_action = (!isset($a_attribs['Action'])) ? 'Assign' : $a_attribs['Action']; break; - case "PersonalPicture": + case 'PersonalPicture': $this->personalPicture = [ - "encoding" => $a_attribs["encoding"], - "imagetype" => $a_attribs["imagetype"], - "content" => "" + 'encoding' => $a_attribs['encoding'], + 'imagetype' => $a_attribs['imagetype'], + 'content' => '' ]; break; - case "Look": - $this->skin = $a_attribs["Skin"]; - $this->style = $a_attribs["Style"]; + case 'Look': + $this->skin = $a_attribs['Skin']; + $this->style = $a_attribs['Style']; break; - case "User": + case 'User': $this->containedTags = []; $this->acc_mail->reset(); @@ -439,8 +439,8 @@ public function importBeginTag( $this->time_limit_set = false; $this->time_limit_owner_set = false; $this->updateLookAndSkin = false; - $this->skin = ""; - $this->style = ""; + $this->skin = ''; + $this->style = ''; $this->personalPicture = null; $this->userCount++; $this->userObj = new ilObjUser(); @@ -450,29 +450,29 @@ public function importBeginTag( // if we have an object id, store it $this->user_id = -1; - if (isset($a_attribs["Id"]) && $this->getUserMappingMode() === self::IL_USER_MAPPING_ID) { - if (is_numeric($a_attribs["Id"])) { - $this->user_id = (int) $a_attribs["Id"]; - } elseif (($id = (int) ilUtil::__extractId($a_attribs["Id"], (int) IL_INST_ID)) > 0) { + if (isset($a_attribs['Id']) && $this->getUserMappingMode() === self::IL_USER_MAPPING_ID) { + if (is_numeric($a_attribs['Id'])) { + $this->user_id = (int) $a_attribs['Id']; + } elseif (($id = (int) ilUtil::__extractId($a_attribs['Id'], (int) IL_INST_ID)) > 0) { $this->user_id = $id; } } $this->userObj->setPref( - "skin", - $this->ilias->ini->readVariable("layout", "skin") + 'skin', + $this->ilias->ini->readVariable('layout', 'skin') ); $this->userObj->setPref( - "style", - $this->ilias->ini->readVariable("layout", "style") + 'style', + $this->ilias->ini->readVariable('layout', 'style') ); - if (isset($a_attribs["Language"])) { - $this->containedTags[] = "Language"; + if (isset($a_attribs['Language'])) { + $this->containedTags[] = 'Language'; } - $this->userObj->setLanguage($a_attribs["Language"] ?? ''); - $this->userObj->setImportId($a_attribs["Id"] ?? ''); - $this->action = (is_null($a_attribs["Action"])) ? "Insert" : $a_attribs["Action"]; + $this->userObj->setLanguage($a_attribs['Language'] ?? ''); + $this->userObj->setImportId($a_attribs['Id'] ?? ''); + $this->action = (is_null($a_attribs['Action'])) ? 'Insert' : $a_attribs['Action']; $this->currPassword = null; $this->currPasswordType = null; $this->currActive = null; @@ -482,11 +482,11 @@ public function importBeginTag( case 'Password': $this->currPasswordType = $a_attribs['Type']; break; - case "AuthMode": - if (array_key_exists("type", $a_attribs)) { - switch ($a_attribs["type"]) { - case "saml": - case "ldap": + case 'AuthMode': + if (array_key_exists('type', $a_attribs)) { + switch ($a_attribs['type']) { + case 'saml': + case 'ldap': if (strcmp('saml', $a_attribs['type']) === 0) { $list = ilSamlIdp::getActiveIdpList(); if (count($list) === 1) { @@ -507,23 +507,23 @@ public function importBeginTag( } break; - case "default": - case "local": - case "shibboleth": - case "script": - case "cas": - case "soap": - case "openid": + case 'default': + case 'local': + case 'shibboleth': + case 'script': + case 'cas': + case 'soap': + case 'openid': // begin-patch auth_plugin default: $this->auth_mode_set = true; - $this->userObj->setAuthMode($a_attribs["type"]); + $this->userObj->setAuthMode($a_attribs['type']); break; } } else { $this->logFailure( $this->userObj->getLogin(), - sprintf($this->lng->txt("usrimport_xml_element_inapplicable"), "AuthMode", $this->stripTags($a_attribs["type"])) + sprintf($this->lng->txt('usrimport_xml_element_inapplicable'), 'AuthMode', $this->stripTags($a_attribs['type'])) ); } break; @@ -534,15 +534,15 @@ public function importBeginTag( break; case 'AccountInfo': - $this->current_messenger_type = strtolower($a_attribs["Type"]); + $this->current_messenger_type = strtolower($a_attribs['Type']); break; case 'GMapInfo': - $this->userObj->setLatitude($a_attribs["latitude"]); - $this->userObj->setLongitude($a_attribs["longitude"]); - $this->userObj->setLocationZoom($a_attribs["zoom"]); + $this->userObj->setLatitude($a_attribs['latitude']); + $this->userObj->setLongitude($a_attribs['longitude']); + $this->userObj->setLocationZoom($a_attribs['zoom']); break; case 'Pref': - $this->currentPrefKey = $a_attribs["key"]; + $this->currentPrefKey = $a_attribs['key']; break; } } @@ -556,54 +556,54 @@ public function verifyBeginTag( array $a_attribs ): void { switch ($a_name) { - case "Role": - if ($a_attribs['Id'] == "") { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_attribute_missing"), "Role", "Id")); + case 'Role': + if ($a_attribs['Id'] == '') { + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_attribute_missing'), 'Role', 'Id')); } - $this->current_role_id = $a_attribs["Id"]; - $this->current_role_type = $a_attribs["Type"]; + $this->current_role_id = $a_attribs['Id']; + $this->current_role_type = $a_attribs['Type']; if ($this->current_role_type !== 'Global' && $this->current_role_type !== 'Local') { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_attribute_missing"), "Role", "Type")); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_attribute_missing'), 'Role', 'Type')); } - $this->current_role_action = (!isset($a_attribs["Action"])) ? "Assign" : $a_attribs["Action"]; - if ($this->current_role_action !== "Assign" - && $this->current_role_action !== "AssignWithParents" - && $this->current_role_action !== "Detach") { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_attribute_value_illegal"), "Role", "Action", $this->stripTags($a_attribs["Action"]))); + $this->current_role_action = (!isset($a_attribs['Action'])) ? 'Assign' : $a_attribs['Action']; + if ($this->current_role_action !== 'Assign' + && $this->current_role_action !== 'AssignWithParents' + && $this->current_role_action !== 'Detach') { + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_attribute_value_illegal'), 'Role', 'Action', $this->stripTags($a_attribs['Action']))); } - if ($this->action === "Insert" - && $this->current_role_action === "Detach") { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_attribute_value_inapplicable"), "Role", "Action", $this->stripTags($this->current_role_action), $this->stripTags($this->action))); + if ($this->action === 'Insert' + && $this->current_role_action === 'Detach') { + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_attribute_value_inapplicable'), 'Role', 'Action', $this->stripTags($this->current_role_action), $this->stripTags($this->action))); } - if ($this->action === "Delete") { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_inapplicable"), "Role", "Delete")); + if ($this->action === 'Delete') { + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_inapplicable'), 'Role', 'Delete')); } break; - case "User": + case 'User': $this->userCount++; $this->containedTags = []; $this->userObj = new ilObjUser(); - $this->userObj->setLanguage($a_attribs["Language"] ?? ''); - $this->userObj->setImportId($a_attribs["Id"]); + $this->userObj->setLanguage($a_attribs['Language'] ?? ''); + $this->userObj->setImportId($a_attribs['Id']); $this->currentPrefKey = null; // if we have an object id, store it $this->user_id = -1; - if (!is_null($a_attribs["Id"]) && $this->getUserMappingMode() === self::IL_USER_MAPPING_ID) { - if (is_numeric($a_attribs["Id"])) { - $this->user_id = (int) $a_attribs["Id"]; - } elseif (($id = (int) ilUtil::__extractId($a_attribs["Id"], (int) IL_INST_ID)) > 0) { + if (!is_null($a_attribs['Id']) && $this->getUserMappingMode() === self::IL_USER_MAPPING_ID) { + if (is_numeric($a_attribs['Id'])) { + $this->user_id = (int) $a_attribs['Id']; + } elseif (($id = (int) ilUtil::__extractId($a_attribs['Id'], (int) IL_INST_ID)) > 0) { $this->user_id = $id; } } - $this->action = (is_null($a_attribs["Action"])) ? "Insert" : $a_attribs["Action"]; - if ($this->action !== "Insert" - && $this->action !== "Update" - && $this->action !== "Delete") { - $this->logFailure($this->userObj->getImportId(), sprintf($this->lng->txt("usrimport_xml_attribute_value_illegal"), "User", "Action", $this->stripTags($a_attribs["Action"]))); + $this->action = (is_null($a_attribs['Action'])) ? 'Insert' : $a_attribs['Action']; + if ($this->action !== 'Insert' + && $this->action !== 'Update' + && $this->action !== 'Delete') { + $this->logFailure($this->userObj->getImportId(), sprintf($this->lng->txt('usrimport_xml_attribute_value_illegal'), 'User', 'Action', $this->stripTags($a_attribs['Action']))); } $this->currPassword = null; $this->currPasswordType = null; @@ -612,17 +612,17 @@ public function verifyBeginTag( case 'Password': $this->currPasswordType = $a_attribs['Type']; break; - case "AuthMode": - if (array_key_exists("type", $a_attribs)) { - switch ($a_attribs["type"]) { - case "saml": - case "ldap": + case 'AuthMode': + if (array_key_exists('type', $a_attribs)) { + switch ($a_attribs['type']) { + case 'saml': + case 'ldap': if (strcmp('saml', $a_attribs['type']) === 0) { $list = ilSamlIdp::getActiveIdpList(); if (count($list) !== 1) { $this->logFailure( $this->userObj->getImportId(), - sprintf($this->lng->txt("usrimport_xml_attribute_value_illegal"), "AuthMode", "type", $this->stripTags($a_attribs['type'])) + sprintf($this->lng->txt('usrimport_xml_attribute_value_illegal'), 'AuthMode', 'type', $this->stripTags($a_attribs['type'])) ); } break; @@ -633,30 +633,30 @@ public function verifyBeginTag( if (count($list) != 1) { $this->logFailure( $this->userObj->getImportId(), - sprintf($this->lng->txt("usrimport_xml_attribute_value_illegal"), "AuthMode", "type", $this->stripTags($a_attribs['type'])) + sprintf($this->lng->txt('usrimport_xml_attribute_value_illegal'), 'AuthMode', 'type', $this->stripTags($a_attribs['type'])) ); } } break; - case "default": - case "local": - case "shibboleth": - case "script": - case "cas": - case "soap": - case "openid": + case 'default': + case 'local': + case 'shibboleth': + case 'script': + case 'cas': + case 'soap': + case 'openid': // begin-patch auth_plugin default: - $this->userObj->setAuthMode($a_attribs["type"]); + $this->userObj->setAuthMode($a_attribs['type']); break; } } else { - $this->logFailure($this->userObj->getImportId(), sprintf($this->lng->txt("usrimport_xml_attribute_value_illegal"), "AuthMode", "type", "")); + $this->logFailure($this->userObj->getImportId(), sprintf($this->lng->txt('usrimport_xml_attribute_value_illegal'), 'AuthMode', 'type', '')); } break; case 'Pref': - $this->currentPrefKey = $a_attribs["key"]; + $this->currentPrefKey = $a_attribs['key']; break; } } @@ -686,9 +686,9 @@ public function extractRolesEndTag( string $a_name ): void { switch ($a_name) { - case "Role": - $this->roles[$this->current_role_id]["name"] = $this->cdata; - $this->roles[$this->current_role_id]["type"] = + case 'Role': + $this->roles[$this->current_role_id]['name'] = $this->cdata; + $this->roles[$this->current_role_id]['type'] = $this->current_role_type; break; } @@ -855,28 +855,28 @@ public function importEndTag( $this->containedTags[] = $a_name; switch ($a_name) { - case "Role": - $this->roles[$this->current_role_id]["name"] = $this->cdata; - $this->roles[$this->current_role_id]["type"] = $this->current_role_type; - $this->roles[$this->current_role_id]["action"] = $this->current_role_action; + case 'Role': + $this->roles[$this->current_role_id]['name'] = $this->cdata; + $this->roles[$this->current_role_id]['type'] = $this->current_role_type; + $this->roles[$this->current_role_id]['action'] = $this->current_role_action; break; - case "PersonalPicture": - switch ($this->personalPicture["encoding"]) { - case "Base64": - $this->personalPicture["content"] = base64_decode($this->cdata); + case 'PersonalPicture': + switch ($this->personalPicture['encoding']) { + case 'Base64': + $this->personalPicture['content'] = base64_decode($this->cdata); break; - case "UUEncode": - $this->personalPicture["content"] = convert_uudecode($this->cdata); + case 'UUEncode': + $this->personalPicture['content'] = convert_uudecode($this->cdata); break; } break; - case "User": + case 'User': $this->userObj->setFullname(); // Fetch the user_id from the database, if we didn't have it in xml file // fetch as well, if we are trying to insert -> recognize duplicates! - if ($this->user_id == -1 || $this->action === "Insert") { + if ($this->user_id == -1 || $this->action === 'Insert') { $user_id = ilObjUser::getUserIdByLogin($this->userObj->getLogin()); } else { $user_id = $this->user_id; @@ -893,44 +893,44 @@ public function importEndTag( break; case self::IL_UPDATE_ON_CONFLICT: switch ($this->action) { - case "Insert": + case 'Insert': if ($user_id) { - $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_action_replaced"), "Insert", "Update")); - $this->action = "Update"; + $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_action_replaced'), 'Insert', 'Update')); + $this->action = 'Update'; } break; - case "Update": + case 'Update': if (!$user_id) { - $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_action_replaced"), "Update", "Insert")); - $this->action = "Insert"; + $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_action_replaced'), 'Update', 'Insert')); + $this->action = 'Insert'; } break; - case "Delete": + case 'Delete': if (!$user_id) { - $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_action_ignored"), "Delete")); - $this->action = "Ignore"; + $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_action_ignored'), 'Delete')); + $this->action = 'Ignore'; } break; } break; case self::IL_IGNORE_ON_CONFLICT: switch ($this->action) { - case "Insert": + case 'Insert': if ($user_id) { - $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_action_ignored"), "Insert")); - $this->action = "Ignore"; + $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_action_ignored'), 'Insert')); + $this->action = 'Ignore'; } break; - case "Update": + case 'Update': if (!$user_id) { - $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_action_ignored"), "Update")); - $this->action = "Ignore"; + $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_action_ignored'), 'Update')); + $this->action = 'Ignore'; } break; - case "Delete": + case 'Delete': if (!$user_id) { - $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_action_ignored"), "Delete")); - $this->action = "Ignore"; + $this->logWarning($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_action_ignored'), 'Delete')); + $this->action = 'Ignore'; } break; } @@ -941,30 +941,30 @@ public function importEndTag( // note: we cannot apply conflict rules in the same manner as to logins here // so we ignore records with already existing external accounts. //echo $this->userObj->getAuthMode().'h'; - $am = ($this->userObj->getAuthMode() === "default" || $this->userObj->getAuthMode() == "") + $am = ($this->userObj->getAuthMode() === 'default' || $this->userObj->getAuthMode() == '') ? ilAuthUtils::_getAuthModeName($this->settings->get('auth_mode')) : $this->userObj->getAuthMode(); - $loginForExternalAccount = ($this->userObj->getExternalAccount() == "") - ? "" + $loginForExternalAccount = ($this->userObj->getExternalAccount() == '') + ? '' : ilObjUser::_checkExternalAuthAccount($am, $this->userObj->getExternalAccount()); switch ($this->action) { - case "Insert": - if ($loginForExternalAccount != "") { + case 'Insert': + if ($loginForExternalAccount != '') { $this->logWarning( $this->userObj->getLogin(), $this->lng->txt('usrimport_no_insert_ext_account_exists') . ' (' . $this->stripTags($this->userObj->getExternalAccount()) . ')' ); - $this->action = "Ignore"; + $this->action = 'Ignore'; } break; - case "Update": + case 'Update': // this variable describes the ILIAS login which belongs to the given external account!!! // it is NOT nescessarily the ILIAS login of the current user record !! // so if we found an ILIAS login according to the authentication method // check if the ILIAS login belongs to the current user record, otherwise somebody else is using it! - if ($loginForExternalAccount != "") { + if ($loginForExternalAccount != '') { // check if we changed the value! $externalAccountHasChanged = $this->userObj->getExternalAccount() != ilObjUser::_lookupExternalAccount($this->user_id); // if it has changed and the external login @@ -974,45 +974,45 @@ public function importEndTag( $this->lng->txt('usrimport_no_update_ext_account_exists') . ' (' . $this->stripTags($this->userObj->getExternalAccount()) . ')' ); - $this->action = "Ignore"; + $this->action = 'Ignore'; } } break; } if (count($this->multi_values)) { - if (isset($this->multi_values["GeneralInterest"])) { - $this->userObj->setGeneralInterests($this->multi_values["GeneralInterest"]); + if (isset($this->multi_values['GeneralInterest'])) { + $this->userObj->setGeneralInterests($this->multi_values['GeneralInterest']); } - if (isset($this->multi_values["OfferingHelp"])) { - $this->userObj->setOfferingHelp($this->multi_values["OfferingHelp"]); + if (isset($this->multi_values['OfferingHelp'])) { + $this->userObj->setOfferingHelp($this->multi_values['OfferingHelp']); } - if (isset($this->multi_values["LookingForHelp"])) { - $this->userObj->setLookingForHelp($this->multi_values["LookingForHelp"]); + if (isset($this->multi_values['LookingForHelp'])) { + $this->userObj->setLookingForHelp($this->multi_values['LookingForHelp']); } } // Perform the action switch ($this->action) { - case "Insert": + case 'Insert': if ($user_id) { - $this->logFailure($this->userObj->getLogin(), $this->lng->txt("usrimport_cant_insert")); + $this->logFailure($this->userObj->getLogin(), $this->lng->txt('usrimport_cant_insert')); } else { if ($this->currPassword !== null) { switch (strtoupper($this->currPasswordType)) { - case "BCRYPT": + case 'BCRYPT': $this->userObj->setPasswd($this->currPassword, ilObjUser::PASSWD_CRYPTED); $this->userObj->setPasswordEncodingType('bcryptphp'); $this->userObj->setPasswordSalt(null); break; - case "PLAIN": + case 'PLAIN': $this->userObj->setPasswd($this->currPassword, ilObjUser::PASSWD_PLAIN); $this->acc_mail->setUserPassword((string) $this->currPassword); break; default: - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_attribute_value_illegal"), "Type", "Password", $this->stripTags($this->currPasswordType))); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_attribute_value_illegal'), 'Type', 'Password', $this->stripTags($this->currPasswordType))); break; } } else { @@ -1020,7 +1020,7 @@ public function importEndTag( // since a MD5 string has always 32 characters, // no hashed password combination will ever equal to // an empty string - $this->userObj->setPasswd("", ilObjUser::PASSWD_CRYPTED); + $this->userObj->setPasswd('', ilObjUser::PASSWD_CRYPTED); } $this->userObj->setTitle($this->userObj->getFullname()); @@ -1036,7 +1036,7 @@ public function importEndTag( $this->userObj->setTimeLimitMessage(''); if (!$this->approve_date_set) { - $this->userObj->setApproveDate(date("Y-m-d H:i:s")); + $this->userObj->setApproveDate(date('Y-m-d H:i:s')); } } @@ -1066,9 +1066,9 @@ public function importEndTag( if (count($this->prefs)) { foreach ($this->prefs as $key => $value) { - if ($key !== "mail_incoming_type" && - $key !== "mail_signature" && - $key !== "mail_linebreak" + if ($key !== 'mail_incoming_type' && + $key !== 'mail_signature' && + $key !== 'mail_linebreak' ) { $this->userObj->setPref($key, $value); } @@ -1091,12 +1091,12 @@ public function importEndTag( $this->updateMailPreferences($this->userObj->getId()); if (is_array($this->personalPicture)) { - if (strlen($this->personalPicture["content"])) { - $extension = "jpg"; - if (preg_match("/.*(png|jpg|gif|jpeg)$/", $this->personalPicture["imagetype"], $matches)) { + if (strlen($this->personalPicture['content'])) { + $extension = 'jpg'; + if (preg_match('/.*(png|jpg|gif|jpeg)$/', $this->personalPicture['imagetype'], $matches)) { $extension = $matches[1]; } - $tmp_name = $this->saveTempImage($this->personalPicture["content"], ".$extension"); + $tmp_name = $this->saveTempImage($this->personalPicture['content'], ".{$extension}"); if (strlen($tmp_name)) { ilObjUser::_uploadPersonalPicture($tmp_name, $this->userObj->getId()); unlink($tmp_name); @@ -1114,143 +1114,143 @@ public function importEndTag( if (count($this->udf_data)) { $udd = new ilUserDefinedData($this->userObj->getId()); foreach ($this->udf_data as $field => $value) { - $udd->set("f_" . $field, $value); + $udd->set('f_' . $field, $value); } $udd->update(); } $this->sendAccountMail(); - $this->logSuccess($this->userObj->getLogin(), $this->userObj->getId(), "Insert"); + $this->logSuccess($this->userObj->getLogin(), $this->userObj->getId(), 'Insert'); // reset account mail object $this->acc_mail->reset(); } break; - case "Update": + case 'Update': if (!$user_id) { - $this->logFailure($this->userObj->getLogin(), $this->lng->txt("usrimport_cant_update")); + $this->logFailure($this->userObj->getLogin(), $this->lng->txt('usrimport_cant_update')); } else { $updateUser = new ilObjUser($user_id); $updateUser->read(); $updateUser->readPrefs(); if ($this->currPassword != null) { switch (strtoupper($this->currPasswordType)) { - case "BCRYPT": + case 'BCRYPT': $updateUser->setPasswd($this->currPassword, ilObjUser::PASSWD_CRYPTED); $updateUser->setPasswordEncodingType('bcryptphp'); $updateUser->setPasswordSalt(null); break; - case "PLAIN": + case 'PLAIN': $updateUser->setPasswd($this->currPassword, ilObjUser::PASSWD_PLAIN); $this->acc_mail->setUserPassword((string) $this->currPassword); break; default: - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_attribute_value_illegal"), "Type", "Password", $this->stripTags($this->currPasswordType))); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_attribute_value_illegal'), 'Type', 'Password', $this->stripTags($this->currPasswordType))); break; } } - if ($this->tagContained("Firstname")) { + if ($this->tagContained('Firstname')) { $updateUser->setFirstname($this->userObj->getFirstname()); } - if ($this->tagContained("Lastname")) { + if ($this->tagContained('Lastname')) { $updateUser->setLastname($this->userObj->getLastname()); } - if ($this->tagContained("Title")) { + if ($this->tagContained('Title')) { $updateUser->setUTitle($this->userObj->getUTitle()); } - if ($this->tagContained("Gender")) { + if ($this->tagContained('Gender')) { $updateUser->setGender($this->userObj->getGender()); } - if ($this->tagContained("Email")) { + if ($this->tagContained('Email')) { $updateUser->setEmail($this->userObj->getEmail()); } - if ($this->tagContained("SecondEmail")) { + if ($this->tagContained('SecondEmail')) { $updateUser->setSecondEmail($this->userObj->getSecondEmail()); } - if ($this->tagContained("Birthday")) { + if ($this->tagContained('Birthday')) { $updateUser->setBirthday($this->userObj->getBirthday()); } - if ($this->tagContained("Institution")) { + if ($this->tagContained('Institution')) { $updateUser->setInstitution($this->userObj->getInstitution()); } - if ($this->tagContained("Street")) { + if ($this->tagContained('Street')) { $updateUser->setStreet($this->userObj->getStreet()); } - if ($this->tagContained("City")) { + if ($this->tagContained('City')) { $updateUser->setCity($this->userObj->getCity()); } - if ($this->tagContained("PostalCode")) { + if ($this->tagContained('PostalCode')) { $updateUser->setZipcode($this->userObj->getZipcode()); } - if ($this->tagContained("Country")) { + if ($this->tagContained('Country')) { $updateUser->setCountry($this->userObj->getCountry()); } - if ($this->tagContained("SelCountry")) { + if ($this->tagContained('SelCountry')) { $updateUser->setSelectedCountry($this->userObj->getSelectedCountry()); } - if ($this->tagContained("PhoneOffice")) { + if ($this->tagContained('PhoneOffice')) { $updateUser->setPhoneOffice($this->userObj->getPhoneOffice()); } - if ($this->tagContained("PhoneHome")) { + if ($this->tagContained('PhoneHome')) { $updateUser->setPhoneHome($this->userObj->getPhoneHome()); } - if ($this->tagContained("PhoneMobile")) { + if ($this->tagContained('PhoneMobile')) { $updateUser->setPhoneMobile($this->userObj->getPhoneMobile()); } - if ($this->tagContained("Fax")) { + if ($this->tagContained('Fax')) { $updateUser->setFax($this->userObj->getFax()); } - if ($this->tagContained("Hobby")) { + if ($this->tagContained('Hobby')) { $updateUser->setHobby($this->userObj->getHobby()); } - if ($this->tagContained("GeneralInterest")) { + if ($this->tagContained('GeneralInterest')) { $updateUser->setGeneralInterests($this->userObj->getGeneralInterests()); } - if ($this->tagContained("OfferingHelp")) { + if ($this->tagContained('OfferingHelp')) { $updateUser->setOfferingHelp($this->userObj->getOfferingHelp()); } - if ($this->tagContained("LookingForHelp")) { + if ($this->tagContained('LookingForHelp')) { $updateUser->setLookingForHelp($this->userObj->getLookingForHelp()); } - if ($this->tagContained("Comment")) { + if ($this->tagContained('Comment')) { $updateUser->setComment($this->userObj->getComment()); } - if ($this->tagContained("Department")) { + if ($this->tagContained('Department')) { $updateUser->setDepartment($this->userObj->getDepartment()); } - if ($this->tagContained("Matriculation")) { + if ($this->tagContained('Matriculation')) { $updateUser->setMatriculation($this->userObj->getMatriculation()); } if (!is_null($this->currActive)) { - $updateUser->setActive($this->currActive === "true", is_object($this->user) ? $this->user->getId() : 0); + $updateUser->setActive($this->currActive === 'true', is_object($this->user) ? $this->user->getId() : 0); } - if ($this->tagContained("ClientIP")) { + if ($this->tagContained('ClientIP')) { $updateUser->setClientIP($this->userObj->getClientIP()); } if ($this->time_limit_set) { $updateUser->setTimeLimitUnlimited($this->userObj->getTimeLimitUnlimited()); } - if ($this->tagContained("TimeLimitFrom")) { + if ($this->tagContained('TimeLimitFrom')) { $updateUser->setTimeLimitFrom($this->userObj->getTimeLimitFrom()); } - if ($this->tagContained("TimeLimitUntil")) { + if ($this->tagContained('TimeLimitUntil')) { $updateUser->setTimeLimitUntil($this->userObj->getTimeLimitUntil()); } - if ($this->tagContained("TimeLimitMessage")) { + if ($this->tagContained('TimeLimitMessage')) { $updateUser->setTimeLimitMessage($this->userObj->getTimeLimitMessage()); } - if ($this->tagContained("ApproveDate")) { + if ($this->tagContained('ApproveDate')) { $updateUser->setApproveDate($this->userObj->getApproveDate()); } - if ($this->tagContained("AgreeDate")) { + if ($this->tagContained('AgreeDate')) { $updateUser->setAgreeDate($this->userObj->getAgreeDate()); } - if ($this->tagContained("Language")) { + if ($this->tagContained('Language')) { $updateUser->setLanguage($this->userObj->getLanguage()); } - if ($this->tagContained("ExternalAccount")) { + if ($this->tagContained('ExternalAccount')) { $updateUser->setExternalAccount($this->userObj->getExternalAccount()); } @@ -1267,9 +1267,9 @@ public function importEndTag( if (count($this->prefs)) { foreach ($this->prefs as $key => $value) { - if ($key !== "mail_incoming_type" && - $key !== "mail_signature" && - $key !== "mail_linebreak" + if ($key !== 'mail_incoming_type' && + $key !== 'mail_signature' && + $key !== 'mail_linebreak' ) { $updateUser->setPref($key, $value); } @@ -1278,8 +1278,8 @@ public function importEndTag( // save user preferences (skin and style) if ($this->updateLookAndSkin) { - $updateUser->setPref("skin", $this->userObj->getPref("skin")); - $updateUser->setPref("style", $this->userObj->getPref("style")); + $updateUser->setPref('skin', $this->userObj->getPref('skin')); + $updateUser->setPref('style', $this->userObj->getPref('style')); } @@ -1302,13 +1302,13 @@ public function importEndTag( if (count($this->udf_data)) { $udd = new ilUserDefinedData($updateUser->getId()); foreach ($this->udf_data as $field => $value) { - $udd->set("f_" . $field, $value); + $udd->set('f_' . $field, $value); } $udd->update(); } // update login - if ($this->tagContained("Login") && $this->user_id != -1) { + if ($this->tagContained('Login') && $this->user_id != -1) { try { $updateUser->updateLogin($this->userObj->getLogin()); } catch (ilUserException $e) { @@ -1319,12 +1319,12 @@ public function importEndTag( // if language has changed if (is_array($this->personalPicture)) { - if (strlen($this->personalPicture["content"])) { - $extension = "jpg"; - if (preg_match("/.*(png|jpg|gif|jpeg)$/", $this->personalPicture["imagetype"], $matches)) { + if (strlen($this->personalPicture['content'])) { + $extension = 'jpg'; + if (preg_match('/.*(png|jpg|gif|jpeg)$/', $this->personalPicture['imagetype'], $matches)) { $extension = $matches[1]; } - $tmp_name = $this->saveTempImage($this->personalPicture["content"], ".$extension"); + $tmp_name = $this->saveTempImage($this->personalPicture['content'], ".{$extension}"); if (strlen($tmp_name)) { ilObjUser::_uploadPersonalPicture($tmp_name, $updateUser->getId()); unlink($tmp_name); @@ -1337,30 +1337,30 @@ public function importEndTag( //------------------- foreach ($this->roles as $role_id => $role) { if (array_key_exists($role_id, $this->role_assign)) { - switch ($role["action"]) { - case "Assign": + switch ($role['action']) { + case 'Assign': $this->assignToRole($updateUser, (int) $this->role_assign[$role_id]); break; - case "AssignWithParents": + case 'AssignWithParents': $this->assignToRoleWithParents($updateUser, (int) $this->role_assign[$role_id]); break; - case "Detach": + case 'Detach': $this->detachFromRole($updateUser, (int) $this->role_assign[$role_id]); break; } } } - $this->logSuccess($updateUser->getLogin(), $user_id, "Update"); + $this->logSuccess($updateUser->getLogin(), $user_id, 'Update'); } break; - case "Delete": + case 'Delete': if (!$user_id) { - $this->logFailure($this->userObj->getLogin(), $this->lng->txt("usrimport_cant_delete")); + $this->logFailure($this->userObj->getLogin(), $this->lng->txt('usrimport_cant_delete')); } else { $deleteUser = new ilObjUser($user_id); $deleteUser->delete(); - $this->logSuccess($this->userObj->getLogin(), $user_id, "Delete"); + $this->logSuccess($this->userObj->getLogin(), $user_id, 'Delete'); } break; } @@ -1369,157 +1369,157 @@ public function importEndTag( $this->roles = []; break; - case "Login": + case 'Login': $this->userObj->setLogin($this->getCDataWithoutTags($this->cdata)); break; - case "Password": + case 'Password': $this->currPassword = $this->cdata; break; - case "Firstname": + case 'Firstname': $this->userObj->setFirstname($this->getCDataWithoutTags($this->cdata)); break; - case "Lastname": + case 'Lastname': $this->userObj->setLastname($this->getCDataWithoutTags($this->cdata)); break; - case "Title": + case 'Title': $this->userObj->setUTitle($this->getCDataWithoutTags($this->cdata)); break; - case "Gender": + case 'Gender': $this->userObj->setGender($this->cdata); break; - case "Email": + case 'Email': $this->userObj->setEmail($this->getCDataWithoutTags($this->cdata)); break; - case "SecondEmail": + case 'SecondEmail': $this->userObj->setSecondEmail($this->getCDataWithoutTags($this->cdata)); break; - case "Birthday": + case 'Birthday': $birthday = $this->getCDataWithoutTags($this->cdata); if (strtotime($birthday) !== false) { $this->userObj->setBirthday($birthday); } break; - case "Institution": + case 'Institution': $this->userObj->setInstitution($this->getCDataWithoutTags($this->cdata)); break; - case "Street": + case 'Street': $this->userObj->setStreet($this->getCDataWithoutTags($this->cdata)); break; - case "City": + case 'City': $this->userObj->setCity($this->getCDataWithoutTags($this->cdata)); break; - case "PostalCode": + case 'PostalCode': $this->userObj->setZipcode($this->getCDataWithoutTags($this->cdata)); break; - case "Country": + case 'Country': $this->userObj->setCountry($this->getCDataWithoutTags($this->cdata)); break; - case "SelCountry": + case 'SelCountry': $this->userObj->setSelectedCountry($this->getCDataWithoutTags($this->cdata)); break; - case "PhoneOffice": + case 'PhoneOffice': $this->userObj->setPhoneOffice($this->getCDataWithoutTags($this->cdata)); break; - case "PhoneHome": + case 'PhoneHome': $this->userObj->setPhoneHome($this->getCDataWithoutTags($this->cdata)); break; - case "PhoneMobile": + case 'PhoneMobile': $this->userObj->setPhoneMobile($this->getCDataWithoutTags($this->cdata)); break; - case "Fax": + case 'Fax': $this->userObj->setFax($this->getCDataWithoutTags($this->cdata)); break; - case "Hobby": + case 'Hobby': $this->userObj->setHobby($this->getCDataWithoutTags($this->cdata)); break; - case "GeneralInterest": - case "OfferingHelp": - case "LookingForHelp": + case 'GeneralInterest': + case 'OfferingHelp': + case 'LookingForHelp': $this->multi_values[$a_name][] = $this->getCDataWithoutTags($this->cdata); break; - case "Comment": + case 'Comment': $this->userObj->setComment($this->getCDataWithoutTags($this->cdata)); break; - case "Department": + case 'Department': $this->userObj->setDepartment($this->getCDataWithoutTags($this->cdata)); break; - case "Matriculation": + case 'Matriculation': $this->userObj->setMatriculation($this->getCDataWithoutTags($this->cdata)); break; - case "Active": + case 'Active': $this->currActive = $this->cdata; break; - case "ClientIP": + case 'ClientIP': $this->userObj->setClientIP($this->getCDataWithoutTags($this->cdata)); break; - case "TimeLimitOwner": + case 'TimeLimitOwner': $this->time_limit_owner_set = true; $this->userObj->setTimeLimitOwner((int) $this->cdata); break; - case "TimeLimitUnlimited": + case 'TimeLimitUnlimited': $this->time_limit_set = true; $this->userObj->setTimeLimitUnlimited((bool) $this->cdata); break; - case "TimeLimitFrom": + case 'TimeLimitFrom': if (is_numeric($this->cdata)) { // Treat cdata as a unix timestamp $this->userObj->setTimeLimitFrom((int) $this->cdata); } else { // Try to convert cdata into unix timestamp, or ignore it $timestamp = strtotime($this->cdata); - if ($timestamp !== false && trim($this->cdata) !== "0000-00-00 00:00:00") { + if ($timestamp !== false && trim($this->cdata) !== '0000-00-00 00:00:00') { $this->userObj->setTimeLimitFrom($timestamp); - } elseif ($this->cdata === "0000-00-00 00:00:00") { + } elseif ($this->cdata === '0000-00-00 00:00:00') { $this->userObj->setTimeLimitFrom(null); } } break; - case "TimeLimitUntil": + case 'TimeLimitUntil': if (is_numeric($this->cdata)) { // Treat cdata as a unix timestamp $this->userObj->setTimeLimitUntil((int)$this->cdata); } else { // Try to convert cdata into unix timestamp, or ignore it $timestamp = strtotime($this->cdata); - if ($timestamp !== false && trim($this->cdata) !== "0000-00-00 00:00:00") { + if ($timestamp !== false && trim($this->cdata) !== '0000-00-00 00:00:00') { $this->userObj->setTimeLimitUntil($timestamp); - } elseif ($this->cdata === "0000-00-00 00:00:00") { + } elseif ($this->cdata === '0000-00-00 00:00:00') { $this->userObj->setTimeLimitUntil(null); } } break; - case "TimeLimitMessage": + case 'TimeLimitMessage': $this->userObj->setTimeLimitMessage($this->cdata); break; - case "ApproveDate": + case 'ApproveDate': $this->approve_date_set = true; if (is_numeric($this->cdata)) { // Treat cdata as a unix timestamp @@ -1528,16 +1528,16 @@ public function importEndTag( } else { // Try to convert cdata into unix timestamp, or ignore it $timestamp = strtotime($this->cdata); - if ($timestamp !== false && trim($this->cdata) !== "0000-00-00 00:00:00") { + if ($timestamp !== false && trim($this->cdata) !== '0000-00-00 00:00:00') { $tmp_date = new ilDateTime($timestamp, IL_CAL_UNIX); $this->userObj->setApproveDate($tmp_date->get(IL_CAL_DATETIME)); - } elseif ($this->cdata === "0000-00-00 00:00:00") { + } elseif ($this->cdata === '0000-00-00 00:00:00') { $this->userObj->setApproveDate(null); } } break; - case "AgreeDate": + case 'AgreeDate': if (is_numeric($this->cdata)) { // Treat cdata as a unix timestamp $tmp_date = new ilDateTime($this->cdata, IL_CAL_UNIX); @@ -1545,28 +1545,28 @@ public function importEndTag( } else { // Try to convert cdata into unix timestamp, or ignore it $timestamp = strtotime($this->cdata); - if ($timestamp !== false && trim($this->cdata) !== "0000-00-00 00:00:00") { + if ($timestamp !== false && trim($this->cdata) !== '0000-00-00 00:00:00') { $tmp_date = new ilDateTime($timestamp, IL_CAL_UNIX); $this->userObj->setAgreeDate($tmp_date->get(IL_CAL_DATETIME)); - } elseif ($this->cdata === "0000-00-00 00:00:00") { + } elseif ($this->cdata === '0000-00-00 00:00:00') { $this->userObj->setAgreeDate(null); } } break; - case "ExternalAccount": + case 'ExternalAccount': $this->userObj->setExternalAccount($this->getCDataWithoutTags($this->cdata)); break; - case "Look": + case 'Look': $this->updateLookAndSkin = false; if (!$this->hideSkin) { // TODO: what to do with disabled skins? is it possible to change the skin via import? if ((strlen($this->skin) > 0) && (strlen($this->style) > 0)) { if (is_array($this->userStyles)) { - if (in_array($this->skin . ":" . $this->style, $this->userStyles)) { - $this->userObj->setPref("skin", $this->skin); - $this->userObj->setPref("style", $this->style); + if (in_array($this->skin . ':' . $this->style, $this->userStyles)) { + $this->userObj->setPref('skin', $this->skin); + $this->userObj->setPref('style', $this->style); $this->updateLookAndSkin = true; } } @@ -1591,7 +1591,7 @@ public function importEndTag( break; case 'AccountInfo': - if ($this->current_messenger_type === "external") { + if ($this->current_messenger_type === 'external') { $this->userObj->setExternalAccount($this->cdata); } break; @@ -1614,9 +1614,9 @@ public function saveTempImage( string $filename ): string { $tempname = ilFileUtils::ilTempnam() . $filename; - $fh = fopen($tempname, "wb"); + $fh = fopen($tempname, 'wb'); if ($fh == false) { - return ""; + return ''; } fwrite($fh, $image_data); fclose($fh); @@ -1633,15 +1633,15 @@ public function verifyEndTag( $externalAccountHasChanged = false; switch ($a_name) { - case "Role": - $this->roles[$this->current_role_id]["name"] = $this->cdata; - $this->roles[$this->current_role_id]["type"] = $this->current_role_type; - $this->roles[$this->current_role_id]["action"] = $this->current_role_action; + case 'Role': + $this->roles[$this->current_role_id]['name'] = $this->cdata; + $this->roles[$this->current_role_id]['type'] = $this->current_role_type; + $this->roles[$this->current_role_id]['action'] = $this->current_role_action; break; - case "User": + case 'User': $this->userObj->setFullname(); - if ($this->user_id != -1 && ($this->action === "Update" || $this->action === "Delete")) { + if ($this->user_id != -1 && ($this->action === 'Update' || $this->action === 'Delete')) { $user_id = $this->user_id; $user_exists = !is_null(ilObjUser::_lookupLogin($user_id)); } else { @@ -1649,7 +1649,7 @@ public function verifyEndTag( $user_exists = $user_id != 0; } if (is_null($this->userObj->getLogin())) { - $this->logFailure("---", sprintf($this->lng->txt("usrimport_xml_element_for_action_required"), "Login", "Insert")); + $this->logFailure('---', sprintf($this->lng->txt('usrimport_xml_element_for_action_required'), 'Login', 'Insert')); } if ($user_id === (int) ANONYMOUS_USER_ID || $user_id === (int) SYSTEM_USER_ID) { @@ -1658,21 +1658,21 @@ public function verifyEndTag( } switch ($this->action) { - case "Insert": + case 'Insert': if ($user_exists and $this->conflict_rule === self::IL_FAIL_ON_CONFLICT) { - $this->logWarning($this->userObj->getLogin(), $this->lng->txt("usrimport_cant_insert")); + $this->logWarning($this->userObj->getLogin(), $this->lng->txt('usrimport_cant_insert')); } - if (is_null($this->userObj->getGender()) && $this->isFieldRequired("gender")) { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_for_action_required"), "Gender", "Insert")); + if (is_null($this->userObj->getGender()) && $this->isFieldRequired('gender')) { + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_for_action_required'), 'Gender', 'Insert')); } if (is_null($this->userObj->getFirstname())) { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_for_action_required"), "Firstname", "Insert")); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_for_action_required'), 'Firstname', 'Insert')); } if (is_null($this->userObj->getLastname())) { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_for_action_required"), "Lastname", "Insert")); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_for_action_required'), 'Lastname', 'Insert')); } if (count($this->roles) == 0) { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_for_action_required"), "Role", "Insert")); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_for_action_required'), 'Role', 'Insert')); } else { $has_global_role = false; foreach ($this->roles as $role) { @@ -1682,25 +1682,25 @@ public function verifyEndTag( } } if (!$has_global_role) { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_global_role_for_action_required"), "Insert")); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_global_role_for_action_required'), 'Insert')); } } break; - case "Update": + case 'Update': if (!$user_exists) { - $this->logWarning($this->userObj->getLogin(), $this->lng->txt("usrimport_cant_update")); - } elseif ($this->user_id != -1 && $this->tagContained("Login")) { + $this->logWarning($this->userObj->getLogin(), $this->lng->txt('usrimport_cant_update')); + } elseif ($this->user_id != -1 && $this->tagContained('Login')) { // check if someone owns the new login name! $someonesId = ilObjUser::_lookupId($this->userObj->getLogin()); if (is_numeric($someonesId) && $someonesId != $this->user_id) { - $this->logFailure($this->userObj->getLogin(), $this->lng->txt("usrimport_login_is_not_unique")); + $this->logFailure($this->userObj->getLogin(), $this->lng->txt('usrimport_login_is_not_unique')); } } break; - case "Delete": + case 'Delete': if (!$user_exists) { - $this->logWarning($this->userObj->getLogin(), $this->lng->txt("usrimport_cant_delete")); + $this->logWarning($this->userObj->getLogin(), $this->lng->txt('usrimport_cant_delete')); } break; } @@ -1709,145 +1709,145 @@ public function verifyEndTag( $this->roles = []; break; - case "Login": + case 'Login': if (array_key_exists($this->cdata, $this->logins)) { - $this->logWarning($this->cdata, $this->lng->txt("usrimport_login_is_not_unique")); + $this->logWarning($this->cdata, $this->lng->txt('usrimport_login_is_not_unique')); } else { $this->logins[$this->cdata] = $this->cdata; } $this->userObj->setLogin($this->stripTags($this->cdata)); break; - case "Password": + case 'Password': switch ($this->currPasswordType) { - case "BCRYPT": + case 'BCRYPT': $this->userObj->setPasswd($this->cdata, ilObjUser::PASSWD_CRYPTED); $this->userObj->setPasswordEncodingType('bcryptphp'); $this->userObj->setPasswordSalt(null); break; - case "PLAIN": + case 'PLAIN': $this->userObj->setPasswd($this->cdata, ilObjUser::PASSWD_PLAIN); $this->acc_mail->setUserPassword((string) $this->currPassword); break; default: - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_attribute_value_illegal"), "Type", "Password", $this->stripTags($this->currPasswordType))); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_attribute_value_illegal'), 'Type', 'Password', $this->stripTags($this->currPasswordType))); break; } break; - case "Firstname": + case 'Firstname': $this->userObj->setFirstname($this->cdata); break; - case "Lastname": + case 'Lastname': $this->userObj->setLastname($this->cdata); break; - case "Title": + case 'Title': $this->userObj->setUTitle($this->cdata); break; - case "Gender": + case 'Gender': if (!in_array(strtolower($this->cdata), ['n', 'm', 'f', ''])) { $this->logFailure( $this->userObj->getLogin(), - sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "Gender", $this->stripTags($this->cdata)) + sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'Gender', $this->stripTags($this->cdata)) ); } $this->userObj->setGender($this->cdata); break; - case "Email": + case 'Email': $this->userObj->setEmail($this->cdata); break; - case "SecondEmail": + case 'SecondEmail': $this->userObj->setSecondEmail($this->cdata); break; - case "Institution": + case 'Institution': $this->userObj->setInstitution($this->cdata); break; - case "Street": + case 'Street': $this->userObj->setStreet($this->cdata); break; - case "City": + case 'City': $this->userObj->setCity($this->cdata); break; - case "PostalCode": + case 'PostalCode': $this->userObj->setZipcode($this->cdata); break; - case "Country": + case 'Country': $this->userObj->setCountry($this->cdata); break; - case "SelCountry": + case 'SelCountry': $this->userObj->setSelectedCountry($this->cdata); break; - case "PhoneOffice": + case 'PhoneOffice': $this->userObj->setPhoneOffice($this->cdata); break; - case "PhoneHome": + case 'PhoneHome': $this->userObj->setPhoneHome($this->cdata); break; - case "PhoneMobile": + case 'PhoneMobile': $this->userObj->setPhoneMobile($this->cdata); break; - case "Fax": + case 'Fax': $this->userObj->setFax($this->cdata); break; - case "Hobby": + case 'Hobby': $this->userObj->setHobby($this->cdata); break; - case "GeneralInterest": - case "OfferingHelp": - case "LookingForHelp": + case 'GeneralInterest': + case 'OfferingHelp': + case 'LookingForHelp': $this->multi_values[$a_name][] = $this->cdata; break; - case "Comment": + case 'Comment': $this->userObj->setComment($this->cdata); break; - case "Department": + case 'Department': $this->userObj->setDepartment($this->cdata); break; - case "Matriculation": + case 'Matriculation': $this->userObj->setMatriculation($this->cdata); break; - case "ExternalAccount": - $am = ($this->userObj->getAuthMode() === "default" || $this->userObj->getAuthMode() == "") + case 'ExternalAccount': + $am = ($this->userObj->getAuthMode() === 'default' || $this->userObj->getAuthMode() == '') ? ilAuthUtils::_getAuthModeName($this->settings->get('auth_mode')) : $this->userObj->getAuthMode(); - $loginForExternalAccount = (trim($this->cdata) == "") - ? "" + $loginForExternalAccount = (trim($this->cdata) == '') + ? '' : ilObjUser::_checkExternalAuthAccount($am, trim($this->cdata)); switch ($this->action) { - case "Insert": - if ($loginForExternalAccount != "") { - $this->logWarning($this->userObj->getLogin(), $this->lng->txt("usrimport_no_insert_ext_account_exists") . " (" . $this->stripTags($this->cdata) . ")"); + case 'Insert': + if ($loginForExternalAccount != '') { + $this->logWarning($this->userObj->getLogin(), $this->lng->txt('usrimport_no_insert_ext_account_exists') . ' (' . $this->stripTags($this->cdata) . ')'); } break; - case "Update": - if ($loginForExternalAccount != "") { + case 'Update': + if ($loginForExternalAccount != '') { $externalAccountHasChanged = trim($this->cdata) != ilObjUser::_lookupExternalAccount($this->user_id); if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) { $this->logWarning( $this->userObj->getLogin(), - $this->lng->txt("usrimport_no_update_ext_account_exists") . " (" . $this->stripTags($this->cdata) . " for " . $this->stripTags($loginForExternalAccount) . ")" + $this->lng->txt('usrimport_no_update_ext_account_exists') . ' (' . $this->stripTags($this->cdata) . ' for ' . $this->stripTags($loginForExternalAccount) . ')' ); } } @@ -1858,90 +1858,90 @@ public function verifyEndTag( } break; - case "Active": - if ($this->cdata !== "true" - && $this->cdata !== "false") { + case 'Active': + if ($this->cdata !== 'true' + && $this->cdata !== 'false') { $this->logFailure( $this->userObj->getLogin(), - sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "Active", $this->stripTags($this->cdata)) + sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'Active', $this->stripTags($this->cdata)) ); } $this->currActive = $this->cdata; break; - case "TimeLimitOwner": - if (!preg_match("/\d+/", $this->cdata)) { + case 'TimeLimitOwner': + if (!preg_match('/\d+/', $this->cdata)) { $this->logFailure( $this->userObj->getLogin(), - sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->stripTags($this->cdata)) + sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'TimeLimitOwner', $this->stripTags($this->cdata)) ); } elseif (!$this->access->checkAccess('cat_administrate_users', '', (int) $this->cdata)) { $this->logFailure( $this->userObj->getLogin(), - sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->stripTags($this->cdata)) + sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'TimeLimitOwner', $this->stripTags($this->cdata)) ); } elseif ($this->object_data_cache->lookupType($this->object_data_cache->lookupObjId((int) $this->cdata)) !== 'cat' && !(int) $this->cdata == USER_FOLDER_ID) { $this->logFailure( $this->userObj->getLogin(), - sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->stripTags($this->cdata)) + sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'TimeLimitOwner', $this->stripTags($this->cdata)) ); } $this->userObj->setTimeLimitOwner((int) $this->cdata); break; - case "TimeLimitUnlimited": + case 'TimeLimitUnlimited': switch (strtolower($this->cdata)) { - case "true": - case "1": + case 'true': + case '1': $this->userObj->setTimeLimitUnlimited(true); break; - case "false": - case "0": + case 'false': + case '0': $this->userObj->setTimeLimitUnlimited(false); break; default: - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitUnlimited", $this->stripTags($this->cdata))); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'TimeLimitUnlimited', $this->stripTags($this->cdata))); break; } break; - case "TimeLimitFrom": + case 'TimeLimitFrom': // Accept datetime or Unix timestamp if (strtotime($this->cdata) === false && !is_numeric($this->cdata)) { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitFrom", $this->stripTags($this->cdata))); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'TimeLimitFrom', $this->stripTags($this->cdata))); } $this->userObj->setTimeLimitFrom((int) $this->cdata); break; - case "TimeLimitUntil": + case 'TimeLimitUntil': // Accept datetime or Unix timestamp if (strtotime($this->cdata) === false && !is_numeric($this->cdata)) { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitUntil", $this->stripTags($this->cdata))); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'TimeLimitUntil', $this->stripTags($this->cdata))); } $this->userObj->setTimeLimitUntil((int) $this->cdata); break; - case "TimeLimitMessage": + case 'TimeLimitMessage': switch (strtolower($this->cdata)) { - case "1": + case '1': $this->userObj->setTimeLimitMessage('1'); break; - case "0": + case '0': $this->userObj->setTimeLimitMessage('0'); break; default: - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitMessage", $this->stripTags($this->cdata))); + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'TimeLimitMessage', $this->stripTags($this->cdata))); break; } break; - case "ApproveDate": + case 'ApproveDate': // Accept datetime or Unix timestamp - if (strtotime($this->cdata) === false && !is_numeric($this->cdata) && !$this->cdata === "0000-00-00 00:00:00") { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "ApproveDate", $this->stripTags($this->cdata))); + if (strtotime($this->cdata) === false && !is_numeric($this->cdata) && !$this->cdata === '0000-00-00 00:00:00') { + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'ApproveDate', $this->stripTags($this->cdata))); } break; - case "AgreeDate": + case 'AgreeDate': // Accept datetime or Unix timestamp - if (strtotime($this->cdata) === false && !is_numeric($this->cdata) && !$this->cdata === "0000-00-00 00:00:00") { - $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt("usrimport_xml_element_content_illegal"), "AgreeDate", $this->stripTags($this->cdata))); + if (strtotime($this->cdata) === false && !is_numeric($this->cdata) && !$this->cdata === '0000-00-00 00:00:00') { + $this->logFailure($this->userObj->getLogin(), sprintf($this->lng->txt('usrimport_xml_element_content_illegal'), 'AgreeDate', $this->stripTags($this->cdata))); } break; - case "Pref": + case 'Pref': if ($this->currentPrefKey != null) { $this->verifyPref($this->currentPrefKey, $this->cdata); } @@ -1957,7 +1957,7 @@ public function handlerCharacterData( string $a_data ): void { if ($a_data !== "\n") { - $a_data = preg_replace("/\t+/", " ", $a_data); + $a_data = preg_replace('/\t+/', ' ', $a_data); } if (strlen($a_data) > 0) { @@ -2020,7 +2020,7 @@ public function logSuccess( int $userid, string $action ): void { - $this->user_mapping[$userid] = ["login" => $aLogin, "action" => $action, "message" => "successful"]; + $this->user_mapping[$userid] = ['login' => $aLogin, 'action' => $action, 'message' => 'successful']; } @@ -2041,22 +2041,22 @@ public function getProtocol(): array */ public function getProtocolAsHTML(string $a_log_title): string { - $block = new ilTemplate("tpl.usr_import_log_block.html", true, true, "Services/User"); - $block->setVariable("TXT_LOG_TITLE", $a_log_title); - $block->setVariable("TXT_MESSAGE_ID", $this->lng->txt("login")); - $block->setVariable("TXT_MESSAGE_TEXT", $this->lng->txt("message")); + $block = new ilTemplate('tpl.usr_import_log_block.html', true, true, 'Services/User'); + $block->setVariable('TXT_LOG_TITLE', $a_log_title); + $block->setVariable('TXT_MESSAGE_ID', $this->lng->txt('login')); + $block->setVariable('TXT_MESSAGE_TEXT', $this->lng->txt('message')); foreach ($this->getProtocol() as $login => $messages) { - $block->setCurrentBlock("log_row"); - $reason = ""; + $block->setCurrentBlock('log_row'); + $reason = ''; foreach ($messages as $message) { - if ($reason == "") { + if ($reason == '') { $reason = $message; } else { - $reason .= "
" . $message; + $reason .= '
' . $message; } } - $block->setVariable("MESSAGE_ID", $login); - $block->setVariable("MESSAGE_TEXT", $reason); + $block->setVariable('MESSAGE_ID', $login); + $block->setVariable('MESSAGE_TEXT', $reason); $block->parseCurrentBlock(); } return $block->get(); @@ -2093,8 +2093,8 @@ public function getUserMapping(): array */ public function sendAccountMail(): void { - if ($this->req_send_mail != "" || - ($this->isSendMail() && $this->userObj->getEmail() != "")) { + if ($this->req_send_mail != '' || + ($this->isSendMail() && $this->userObj->getEmail() != '')) { $this->acc_mail->setUser($this->userObj); $this->acc_mail->send(); } @@ -2120,7 +2120,7 @@ public function setUserMappingMode(int $value): void if ($value === self::IL_USER_MAPPING_ID || $value === self::IL_USER_MAPPING_LOGIN) { $this->mapping_mode = $value; } else { - die("wrong argument using methode setUserMappingMethod in " . __FILE__); + die('wrong argument using methode setUserMappingMethod in ' . __FILE__); } } @@ -2178,7 +2178,7 @@ private function verifyPref(string $key, string $value): void case 'mail_linebreak': case 'hits_per_page': if (!is_numeric($value) || $value < 0) { - $this->logFailure("---", "Wrong value '{$this->stripTags($value)}': Positiv numeric value expected for preference {$this->stripTags($key)}."); + $this->logFailure('---', "Wrong value '{$this->stripTags($value)}': Positiv numeric value expected for preference {$this->stripTags($key)}."); } break; case 'language': @@ -2193,7 +2193,7 @@ private function verifyPref(string $key, string $value): void case 'tst_use_previous_answers': case 'graphicalAnswerSetting': case 'priv_feed_pass': - $this->logFailure("---", "Preference {$this->stripTags($key)} is not supported."); + $this->logFailure('---', "Preference {$this->stripTags($key)} is not supported."); break; case 'public_city': case 'public_country': @@ -2219,28 +2219,28 @@ private function verifyPref(string $key, string $value): void case 'chat_osc_accept_msg': case 'chat_broadcast_typing': case 'hide_own_online_status': - if (!in_array($value, ['y', 'n'])) { - $this->logFailure("---", "Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' expected for preference {$this->stripTags($key)}."); + if (!in_array($value, ['y', 'n', ''])) { + $this->logFailure('---', "Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' expected for preference {$this->stripTags($key)}."); } break; case 'public_profile': if (!in_array($value, ['y', 'n', 'g'])) { - $this->logFailure("---", "Wrong value '{$this->stripTags($value)}': Value 'y', 'g' or 'n' expected for preference {$this->stripTags($key)}."); + $this->logFailure('---', "Wrong value '{$this->stripTags($value)}': Value 'y', 'g' or 'n' expected for preference {$this->stripTags($key)}."); } break; case 'show_users_online': if (!in_array($value, ['y', 'n', 'associated'])) { - $this->logFailure("---", "Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' or 'associated' expected for preference {$this->stripTags($key)}."); + $this->logFailure('---', "Wrong value '{$this->stripTags($value)}': Value 'y' or 'n' or 'associated' expected for preference {$this->stripTags($key)}."); } break; case 'mail_incoming_type': - if (!in_array((int) $value, ["0","1","2"])) { - $this->logFailure("---", "Wrong value '{$this->stripTags($value)}': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference {$this->stripTags($key)}."); + if (!in_array((int) $value, ['0','1','2'])) { + $this->logFailure('---', "Wrong value '{$this->stripTags($value)}': Value '0' (LOCAL),'1' (EMAIL) or '2' (BOTH) expected for preference {$this->stripTags($key)}."); } break; case 'weekstart': - if (!in_array($value, ["0","1"])) { - $this->logFailure("---", "Wrong value '{$this->stripTags($value)}': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference {$this->stripTags($key)}."); + if (!in_array($value, ['0','1'])) { + $this->logFailure('---', "Wrong value '{$this->stripTags($value)}': Value '0' (Sunday) or '1' (Monday) expected for preference {$this->stripTags($key)}."); } break; @@ -2251,12 +2251,12 @@ private function verifyPref(string $key, string $value): void ilTimeZone::_getInstance($value); return; } catch (ilTimeZoneException $tze) { - $this->logFailure("---", "Wrong value '{$this->stripTags($value)}': Invalid timezone $value detected for preference {$this->stripTags($key)}."); + $this->logFailure('---', "Wrong value '{$this->stripTags($value)}': Invalid timezone $value detected for preference {$this->stripTags($key)}."); } break; default: if (!ilUserXMLWriter::isPrefExportable($key)) { - $this->logFailure("---", "Preference {$this->stripTags($key)} is not supported."); + $this->logFailure('---', "Preference {$this->stripTags($key)} is not supported."); } break; } @@ -2264,14 +2264,14 @@ private function verifyPref(string $key, string $value): void private function updateMailPreferences(int $usr_id): void { - if (array_key_exists("mail_incoming_type", $this->prefs) || - array_key_exists("mail_signature", $this->prefs) || - array_key_exists("mail_linebreak", $this->prefs) + if (array_key_exists('mail_incoming_type', $this->prefs) || + array_key_exists('mail_signature', $this->prefs) || + array_key_exists('mail_linebreak', $this->prefs) ) { $mailOptions = new ilMailOptions($usr_id); - $mailOptions->setSignature(array_key_exists("mail_signature", $this->prefs) ? $this->prefs["mail_signature"] : $mailOptions->getSignature()); - $mailOptions->setIncomingType(array_key_exists("mail_incoming_type", $this->prefs) ? (int) $this->prefs["mail_incoming_type"] : $mailOptions->getIncomingType()); + $mailOptions->setSignature(array_key_exists('mail_signature', $this->prefs) ? $this->prefs['mail_signature'] : $mailOptions->getSignature()); + $mailOptions->setIncomingType(array_key_exists('mail_incoming_type', $this->prefs) ? (int) $this->prefs['mail_incoming_type'] : $mailOptions->getIncomingType()); $mailOptions->updateOptions(); } } From 8b6a3b85b7575b8892aa1ad2082f2d194ad69382 Mon Sep 17 00:00:00 2001 From: Lukas Scharmer Date: Thu, 11 Apr 2024 16:57:21 +0200 Subject: [PATCH 04/35] LegalDocuments: Add history tab user admin check --- .../LegalDocuments/classes/Administration.php | 22 +++++++++++-------- ...lass.ilLegalDocumentsAdministrationGUI.php | 16 ++++++++++---- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Services/LegalDocuments/classes/Administration.php b/Services/LegalDocuments/classes/Administration.php index 4b9a7edb3c97..27ed3c0aa0dd 100644 --- a/Services/LegalDocuments/classes/Administration.php +++ b/Services/LegalDocuments/classes/Administration.php @@ -258,21 +258,13 @@ public function requireDocumentHash(): string public function tabs(array $tabs, array $run_after = []): void { foreach ($tabs as $tab) { - $this->container->tabs()->addTab(...$tab); + $this->addTab(...$tab); if (isset($run_after[$tab[0]])) { $run_after[$tab[0]](); } } } - public function defaultTabs(string $documents_link, string $history_link): array - { - return [ - ['documents', $this->ui->txt('agreement_documents_tab_label'), $documents_link], - ['history', $this->ui->txt('acceptance_history'), $history_link], - ]; - } - public function uploadContent(): string { $value = null; @@ -456,4 +448,16 @@ public function isValidHTML(string $string): bool { return (new ValidHTML())->isTrue($string); } + + public function canReadUserAdministration(): bool + { + return $this->container->rbac()->system()->checkAccess('read', USER_FOLDER_ID); + } + + private function addTab(string $id, string $text, string $link, bool $can_access = true): void + { + if ($can_access) { + $this->container->tabs()->addTab($id, $text, $link); + } + } } diff --git a/Services/LegalDocuments/classes/class.ilLegalDocumentsAdministrationGUI.php b/Services/LegalDocuments/classes/class.ilLegalDocumentsAdministrationGUI.php index 35de9f384696..24b7586ea2d6 100644 --- a/Services/LegalDocuments/classes/class.ilLegalDocumentsAdministrationGUI.php +++ b/Services/LegalDocuments/classes/class.ilLegalDocumentsAdministrationGUI.php @@ -71,6 +71,9 @@ public function executeCommand(): void public function history(): void { + if (!$this->admin->canReadUserAdministration()) { + $this->container['ilErr']->raiseError($this->container->language()->txt('permission_denied'), $this->container['ilErr']->WARNING); + } $this->container->tabs()->activateTab('history'); $this->admin->setContent($this->config->legalDocuments()->history()->table( $this, @@ -254,10 +257,15 @@ public function saveOrder(): void */ public function tabs(array $run_after = []): void { - $this->admin->tabs($this->admin->defaultTabs( - $this->ctrlTo('getLinkTargetByClass', 'documents'), - $this->ctrlTo('getLinkTargetByClass', 'history') - ), $run_after); + $this->admin->tabs([ + $this->tab('documents', $this->ui->txt('agreement_documents_tab_label')), + $this->tab('history', $this->ui->txt('acceptance_history'), $this->admin->canReadUserAdministration()), + ], $run_after); + } + + private function tab(string $cmd, string $label, bool $can_access = true): array + { + return [$cmd, $label, $this->ctrlTo('getLinkTargetByClass', $cmd), $can_access]; } public function admin(): Administration From 4fd635997956fa9a612556f55a348ffd403c3c3d Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Thu, 11 Apr 2024 18:16:25 +0000 Subject: [PATCH 05/35] more lang vars for cmix --- .../CmiXapi/classes/class.ilObjCmiXapiAdministrationGUI.php | 2 +- lang/ilias_de.lang | 5 +++++ lang/ilias_en.lang | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Modules/CmiXapi/classes/class.ilObjCmiXapiAdministrationGUI.php b/Modules/CmiXapi/classes/class.ilObjCmiXapiAdministrationGUI.php index c884f7e59a96..7efa6b5fb759 100755 --- a/Modules/CmiXapi/classes/class.ilObjCmiXapiAdministrationGUI.php +++ b/Modules/CmiXapi/classes/class.ilObjCmiXapiAdministrationGUI.php @@ -228,7 +228,7 @@ protected function buildLrsTypeForm(ilCmiXapiLrsType $lrsType): \ilPropertyFormG $form->addItem($item); $sectionHeader = new ilFormSectionHeaderGUI(); - $sectionHeader->setTitle($DIC->language()->txt('sect_privacy_options')); + $sectionHeader->setTitle($DIC->language()->txt('privacy_options')); $form->addItem($sectionHeader); $useProxy = new ilCheckboxInputGUI($DIC->language()->txt('conf_use_proxy'), 'use_proxy'); diff --git a/lang/ilias_de.lang b/lang/ilias_de.lang index 51ef155d2478..8795d42fbf7e 100644 --- a/lang/ilias_de.lang +++ b/lang/ilias_de.lang @@ -3113,8 +3113,11 @@ cmix#:#completed_info#:#Die Aktivität wurde normal beendet oder abgeschlossen. cmix#:#completed_label#:#Statements mit dem Verb 'completed' cmix#:#conf_availability#:#Verwendbarkeit cmix#:#conf_availability_0#:#nicht verwendbar / deaktiviert +cmix#:#conf_availability_0_info#:#Bestehende xAPI/cmi5-Objekte, die diesen LRS-Typ verwenden, sind nicht mehr benutzbar. cmix#:#conf_availability_1#:#ausschließlich in bestehenden Objekten +cmix#:#conf_availability_1_info#:#Dieser LRS-Typ wird beim Anlegen neuer xAPI/cmi5-Objekte nicht angeboten. Bestehende xAPI/cmi5-Objekte, die diesen Typ verwenden, können weiterhin Daten schreiben oder lesen. Nutzen Sie diese Option, um zu einem späteren Zeitpunkt Daten im angebundenen LRS löschen zu können. cmix#:#conf_availability_2#:#in neuen und bestehenden Objekten +cmix#:#conf_availability_2_info#:#Dieser LRS-Typ kann beim Anlegen von xAPI/cmi5-Objekten ausgewählt werden. cmix#:#conf_bypass_proxy#:#Erkennung des Lernfortschritts cmix#:#conf_bypass_proxy_disabled#:#xAPI-Proxy, um sofort Daten zu erhalten. cmix#:#conf_bypass_proxy_enabled#:#CronJob zur Abfrage des Learning Record Store @@ -3181,6 +3184,8 @@ cmix#:#conf_privacy_setting_force#:#Die Einstellungen sind für Objekte nicht ä cmix#:#conf_privacy_setting_info#:#Konfigurationsoptionen für die Datenschutzeinstellungen cmix#:#conf_remarks#:#Interne Kommentare cmix#:#conf_title#:#Titel +cmix#:#conf_use_proxy#:#xAPI-Proxy +cmix#:#conf_use_proxy_info#:#Der xAPI-Proxy liefert in Echtzeit Daten zur Bestimmung des Lernfortschritts in ILIAS. Entsprechend der gewählten Optionen zum Datenschutz reduziert der Proxy personenbezogene Daten. Für cmi5-Objekte ist der xAPI-Proxy zwingend erforderlich. Wird der xAPI-Proxy deaktiviert, so steht dieser LRS-Typ nicht für cmi5-Objekte zur Verfügung. Bei deaktiviertem xAPI-Proxy schreibt der Lerninhalt den Lernfortschritt direkt in den LRS. Dann müssen diese Daten auch direkt aus dem LRS herausgeholt werden. Für die Bestimmung des Lernfortschritts benötigt man dafür den Cronjob „xAPI/cmi5 Ergebnisse holen“. cmix#:#conf_user_ident#:#Identifikation der Person cmix#:#conf_user_ident_il_uuid_ext_account#:#Die externe Konten-ID wird kombiniert mit einer eindeutigen ID der ILIAS-Plattform und als E-Mail-Adresse formatiert. cmix#:#conf_user_ident_il_uuid_ext_account_info#:#Dies ist identisch mit jedem Aufruf, kann aber eine direkte Die Identifikation ist identisch bei jedem Aufruf und lässt direkte Rückschlüsse auf das ILIAS-Konto und die zugehörige Person zu.zulassen. diff --git a/lang/ilias_en.lang b/lang/ilias_en.lang index 8b496ae74757..3a3141f308b9 100644 --- a/lang/ilias_en.lang +++ b/lang/ilias_en.lang @@ -3114,8 +3114,11 @@ cmix#:#completed_info#:#Indicates the actor finished or concluded the activity n cmix#:#completed_label#:#Statements with the verb 'completed' cmix#:#conf_availability#:#Availability cmix#:#conf_availability_0#:#Not available +cmix#:#conf_availability_0_info#:#Existing xAPI/cmi5 objects that use this LRS type can no longer be used. cmix#:#conf_availability_1#:#Existing ones allowed +cmix#:#conf_availability_1_info#:#This LRS type is not offered when creating new xAPI/cmi5 objects. Existing xAPI/cmi5 objects that use this type can continue to write or read data. Use this option to be able to delete data in the connected LRS at a later time. cmix#:#conf_availability_2#:#New producible +cmix#:#conf_availability_2_info#:#This LRS type can be selected when creating xAPI/cmi5 objects. cmix#:#conf_bypass_proxy#:#Detection of Learning Progress cmix#:#conf_bypass_proxy_disabled#:#xAPI-Proxy to get immediately data cmix#:#conf_bypass_proxy_enabled#:#CronJob to check Learning Record Store @@ -3182,6 +3185,8 @@ cmix#:#conf_privacy_setting_force#:#Settings are not changeable for Objects cmix#:#conf_privacy_setting_info#:#Configuration Options for Privacy Settings cmix#:#conf_remarks#:#Internal comments cmix#:#conf_title#:#Title +cmix#:#conf_use_proxy#:#xAPI-Proxy +cmix#:#conf_use_proxy_info#:#The xAPI proxy provides real-time data to determine learning progress in ILIAS. The proxy reduces personal data in accordance with the selected data protection options. The xAPI proxy is mandatory for cmi5 objects. If the xAPI proxy is deactivated, this LRS type is not available for cmi5 objects. If the xAPI proxy is deactivated, the learning content writes the learning progress directly to the LRS. This data must then also be retrieved directly from the LRS. The cron job "xAPI/cmi5 get results" is required to determine the learning progress. cmix#:#conf_user_ident#:#User identification cmix#:#conf_user_ident_il_uuid_ext_account#:#External User ID combined with a unique ILIAS platform id formatted as an E-Mail adress cmix#:#conf_user_ident_il_uuid_ext_account_info#:#This is identical to each call, but may allow a direct conclusion about the user. From 00f6080cbd720f8a9d5a3a64385e184972a68b76 Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Thu, 11 Apr 2024 21:00:09 +0000 Subject: [PATCH 06/35] more info-lang vars for cmix --- lang/ilias_de.lang | 8 +++++--- lang/ilias_en.lang | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lang/ilias_de.lang b/lang/ilias_de.lang index 8795d42fbf7e..592d3d32c87d 100644 --- a/lang/ilias_de.lang +++ b/lang/ilias_de.lang @@ -3185,7 +3185,9 @@ cmix#:#conf_privacy_setting_info#:#Konfigurationsoptionen für die Datenschutzei cmix#:#conf_remarks#:#Interne Kommentare cmix#:#conf_title#:#Titel cmix#:#conf_use_proxy#:#xAPI-Proxy -cmix#:#conf_use_proxy_info#:#Der xAPI-Proxy liefert in Echtzeit Daten zur Bestimmung des Lernfortschritts in ILIAS. Entsprechend der gewählten Optionen zum Datenschutz reduziert der Proxy personenbezogene Daten. Für cmi5-Objekte ist der xAPI-Proxy zwingend erforderlich. Wird der xAPI-Proxy deaktiviert, so steht dieser LRS-Typ nicht für cmi5-Objekte zur Verfügung. Bei deaktiviertem xAPI-Proxy schreibt der Lerninhalt den Lernfortschritt direkt in den LRS. Dann müssen diese Daten auch direkt aus dem LRS herausgeholt werden. Für die Bestimmung des Lernfortschritts benötigt man dafür den Cronjob „xAPI/cmi5 Ergebnisse holen“. +cmix#:#conf_use_proxy_info#:#Der xAPI-Proxy liefert in Echtzeit Daten zur Bestimmung des Lernfortschritts in ILIAS. Entsprechend der gewählten Optionen zum Datenschutz reduziert der Proxy personenbezogene Daten. Bei deaktiviertem xAPI-Proxy schreibt der Lerninhalt den Lernfortschritt direkt in den LRS. Dann müssen diese Daten auch direkt aus dem LRS herausgeholt werden. Für die Bestimmung des Lernfortschritts benötigt man dafür den Cronjob „xAPI/cmi5 Ergebnisse holen“. Für cmi5-Objekte ist der xAPI-Proxy zwingend erforderlich und wird automatisch aktiviert. +cmix#:#conf_use_proxy_info_cmi5#:#Der xAPI-Proxy liefert in Echtzeit Daten zur Bestimmung des Lernfortschritts in ILIAS. Entsprechend der gewählten Optionen zum Datenschutz reduziert der Proxy personenbezogene Daten. Für cmi5-Objekte ist der xAPI-Proxy zwingend erforderlich. +cmix#:#conf_use_proxy_info_xapi#:#Der xAPI-Proxy liefert in Echtzeit Daten zur Bestimmung des Lernfortschritts in ILIAS. Entsprechend der gewählten Optionen zum Datenschutz reduziert der Proxy personenbezogene Daten. Bei deaktiviertem xAPI-Proxy schreibt der Lerninhalt den Lernfortschritt direkt in den LRS. Dann müssen diese Daten auch direkt aus dem LRS herausgeholt werden. Für die Bestimmung des Lernfortschritts benötigt man dafür den Cronjob „xAPI/cmi5 Ergebnisse holen“. cmix#:#conf_user_ident#:#Identifikation der Person cmix#:#conf_user_ident_il_uuid_ext_account#:#Die externe Konten-ID wird kombiniert mit einer eindeutigen ID der ILIAS-Plattform und als E-Mail-Adresse formatiert. cmix#:#conf_user_ident_il_uuid_ext_account_info#:#Dies ist identisch mit jedem Aufruf, kann aber eine direkte Die Identifikation ist identisch bei jedem Aufruf und lässt direkte Rückschlüsse auf das ILIAS-Konto und die zugehörige Person zu.zulassen. @@ -3266,10 +3268,10 @@ cmix#:#launch_url_info#:#Geben Sie hier die Internetadresse ein und fügen Sie h cmix#:#log_options#:#Optionen zur Anzeige der übertragenen Daten cmix#:#lrs_authentication#:#Authentifizierung cmix#:#no_substatements_info#:#Mit dieser Option, die nur für den ILIAS LRS-Proxy zur Verfügung steht, kann die Speicherung von untergeordneten Statements unterdrückt werden. Dies kann z.B. die Beantwortung einzelner Aufgaben in einem Test beeinflussen. Dem Content wird mitgeteilt, dass die Statements gespeichert worden wären. -cmix#:#no_substatements_label#:#Substatements nicht speichern +cmix#:#no_substatements_label#:#Substatements unterdrücken cmix#:#online_info#:#Dadurch wird das Objekt für die Benutzer sichtbar und nutzbar. cmix#:#only_moveon_info#:#Diese Option steht nur für den ILIAS-LRS-Proxy zur Verfügung! Es werden ausschließlich Statements mit definierten Verben im Learning Record Store gespeichert (WhiteList).
Der Ressource wird der Eindruck vermittelt, dass alle Statements vom LRS gespeichert worden sind. Das sichert in der Regel die Ablauffähigkeit, sollte jedoch mit der Organisation, welche diese Ressource anbietet, abgesprochen werden.###Modified as part of gender mainstreaming activities for ILIAS 8 -cmix#:#only_moveon_label#:#Nur Daten zum Lernerfolg speichern +cmix#:#only_moveon_label#:#Nur Statements mit ausgewählten Verben speichern cmix#:#passed_info#:#Die Aktivität wurde bis zu einem vorher festgelegten Grad der Zufriedenheit erfolgreich bestanden. cmix#:#passed_label#:#Statements mit dem Verb 'passed' cmix#:#privacy_options#:#Optionen zum Datenschutz diff --git a/lang/ilias_en.lang b/lang/ilias_en.lang index 3a3141f308b9..f45d9748307c 100644 --- a/lang/ilias_en.lang +++ b/lang/ilias_en.lang @@ -3186,7 +3186,9 @@ cmix#:#conf_privacy_setting_info#:#Configuration Options for Privacy Settings cmix#:#conf_remarks#:#Internal comments cmix#:#conf_title#:#Title cmix#:#conf_use_proxy#:#xAPI-Proxy -cmix#:#conf_use_proxy_info#:#The xAPI proxy provides real-time data to determine learning progress in ILIAS. The proxy reduces personal data in accordance with the selected data protection options. The xAPI proxy is mandatory for cmi5 objects. If the xAPI proxy is deactivated, this LRS type is not available for cmi5 objects. If the xAPI proxy is deactivated, the learning content writes the learning progress directly to the LRS. This data must then also be retrieved directly from the LRS. The cron job "xAPI/cmi5 get results" is required to determine the learning progress. +cmix#:#conf_use_proxy_info#:#The xAPI proxy provides real-time data to determine learning progress in ILIAS. The proxy reduces personal data in accordance with the selected data protection options. If the xAPI proxy is deactivated, the learning content writes the learning progress directly to the LRS. This data must then also be retrieved directly from the LRS. The cron job "xAPI/cmi5 get results" is required to determine the learning progress. The xAPI proxy is mandatory for cmi5 objects and is activated automatically. +cmix#:#conf_use_proxy_info_cmi5#:#The xAPI proxy provides real-time data to determine learning progress in ILIAS. The proxy reduces personal data in accordance with the selected data protection options. The xAPI proxy is mandatory for cmi5 objects. +cmix#:#conf_use_proxy_info_xapi#:#The xAPI proxy provides real-time data to determine learning progress in ILIAS. The proxy reduces personal data in accordance with the selected data protection options. If the xAPI proxy is deactivated, the learning content writes the learning progress directly to the LRS. This data must then also be retrieved directly from the LRS. The cron job "xAPI/cmi5 get results" is required to determine the learning progress. cmix#:#conf_user_ident#:#User identification cmix#:#conf_user_ident_il_uuid_ext_account#:#External User ID combined with a unique ILIAS platform id formatted as an E-Mail adress cmix#:#conf_user_ident_il_uuid_ext_account_info#:#This is identical to each call, but may allow a direct conclusion about the user. @@ -3267,10 +3269,10 @@ cmix#:#launch_url_info#:#Insert here the Internet address by adding http:// or h cmix#:#log_options#:#Options for the display of transmitted data cmix#:#lrs_authentication#:#Authentication cmix#:#no_substatements_info#:#With this option - which is only available for the ILIAS LRS proxy - the storage of subordinate statements can be suppressed. This can for example affect the answering of single tasks in a test. The content is informed that the statements would have been saved. -cmix#:#no_substatements_label#:#Do not store substatements +cmix#:#no_substatements_label#:#Suppress sub-statements cmix#:#online_info#:#This makes the object visible and usable for the users. cmix#:#only_moveon_info#:#With this option, which is only available for the ILIAS LRS proxy, only statements with defined verbs are stored in the Learning Record Store (WhiteList). The content is informed that the statements would have been saved. This usually ensures the expiration date but should be discussed with the content provider. -cmix#:#only_moveon_label#:#Save learning success data only +cmix#:#only_moveon_label#:#Save statements with selected verbs only cmix#:#passed_info#:#Indicates the actor successfully passed an activity to a level of predetermined satisfaction. cmix#:#passed_label#:#Statements with the verb 'passed' cmix#:#privacy_options#:#Options for data security From 2d7e33ac082152053f1d9f2a8f215538cd3be5a6 Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Thu, 11 Apr 2024 21:08:30 +0000 Subject: [PATCH 07/35] modifications for cmix settings (order) --- .../classes/class.ilCmiXapiSettingsGUI.php | 241 ++++++++++-------- 1 file changed, 130 insertions(+), 111 deletions(-) diff --git a/Modules/CmiXapi/classes/class.ilCmiXapiSettingsGUI.php b/Modules/CmiXapi/classes/class.ilCmiXapiSettingsGUI.php index 0587e17aa94f..f6d913862933 100755 --- a/Modules/CmiXapi/classes/class.ilCmiXapiSettingsGUI.php +++ b/Modules/CmiXapi/classes/class.ilCmiXapiSettingsGUI.php @@ -265,113 +265,37 @@ protected function buildForm(): \ilPropertyFormGUI } if (!$this->object->isSourceTypeExternal()) { - if ($this->object->getContentType() != ilObjCmiXapi::CONT_TYPE_CMI5) { - $sectionHeader = new ilFormSectionHeaderGUI(); - $sectionHeader->setTitle($this->language->txt('sect_learning_progress_options')); - $form->addItem($sectionHeader); - $bypassProxy = new ilRadioGroupInputGUI($this->language->txt('conf_bypass_proxy'), 'bypass_proxy'); - $bypassProxy->setInfo($this->language->txt('conf_bypass_proxy_info')); - $opt1 = new ilRadioOption($this->language->txt('conf_bypass_proxy_disabled'), "0"); - $bypassProxy->addOption($opt1); - $opt2 = new ilRadioOption($this->language->txt('conf_bypass_proxy_enabled'), "1"); - $bypassProxy->addOption($opt2); - $bypassProxy->setValue((string) ((int) $this->object->isBypassProxyEnabled())); - //$bypassProxy->setValue((string) ((int) $this->object->getLrsType()->isBypassProxyEnabled())); - $form->addItem($bypassProxy); - if ($this->object->getLrsType()->isBypassProxyEnabled()) { - $bypassProxy->setDisabled(true); - } + // if ($this->object->getContentType() != ilObjCmiXapi::CONT_TYPE_CMI5) { + $sectionHeader = new ilFormSectionHeaderGUI(); + $sectionHeader->setTitle($this->language->txt('privacy_options')); + $form->addItem($sectionHeader); + + $useProxy = new ilCheckboxInputGUI($this->language->txt('conf_use_proxy'), 'use_proxy'); + $useProxy->setInfo($this->language->txt('conf_use_proxy_info_xapi')); + if($this->object->isBypassProxyEnabled() == false) { + $useProxy->setChecked(true); } - - $item = new ilFormSectionHeaderGUI(); - $item->setTitle($this->language->txt("privacy_options")); - $form->addItem($item); - - $userIdent = new ilRadioGroupInputGUI($this->language->txt('conf_privacy_ident'), 'privacy_ident'); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_ident_il_uuid_user_id'), - (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_USER_ID - ); - $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_user_id_info')); - $userIdent->addOption($op); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_ident_il_uuid_login'), - (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_LOGIN - ); - $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_login_info')); - $userIdent->addOption($op); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_ident_il_uuid_ext_account'), - (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT - ); - $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_ext_account_info')); - $userIdent->addOption($op); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_ident_il_uuid_sha256'), - (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_SHA256 - ); - $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_sha256_info')); - $userIdent->addOption($op); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_ident_il_uuid_sha256url'), - (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_SHA256URL - ); - $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_sha256url_info')); - $userIdent->addOption($op); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_ident_il_uuid_random'), - (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_RANDOM - ); - $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_random_info')); - $userIdent->addOption($op); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_ident_real_email'), - (string) ilCmiXapiLrsType::PRIVACY_IDENT_REAL_EMAIL - ); - $op->setInfo($this->language->txt('conf_privacy_ident_real_email_info')); - $userIdent->addOption($op); - $userIdent->setValue((string) $this->object->getPrivacyIdent()); - $userIdent->setInfo( - $this->language->txt('conf_privacy_ident_info') . ' ' . ilCmiXapiUser::getIliasUuid() - ); - $userIdent->setRequired(false); - $form->addItem($userIdent); - - $userName = new ilRadioGroupInputGUI($this->language->txt('conf_privacy_name'), 'privacy_name'); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_name_none'), - (string) ilCmiXapiLrsType::PRIVACY_NAME_NONE - ); - $op->setInfo($this->language->txt('conf_privacy_name_none_info')); - $userName->addOption($op); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_name_firstname'), - (string) ilCmiXapiLrsType::PRIVACY_NAME_FIRSTNAME - ); - $op->setInfo($this->language->txt('conf_privacy_name_firstname_info')); - $userName->addOption($op); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_name_lastname'), - (string) ilCmiXapiLrsType::PRIVACY_NAME_LASTNAME - ); - $op->setInfo($this->language->txt('conf_privacy_name_lastname_info')); - $userName->addOption($op); - $op = new ilRadioOption( - $this->language->txt('conf_privacy_name_fullname'), - (string) ilCmiXapiLrsType::PRIVACY_NAME_FULLNAME - ); - $op->setInfo($this->language->txt('conf_privacy_name_fullname_info')); - $userName->addOption($op); - $userName->setValue((string) $this->object->getPrivacyName()); - $userName->setInfo($this->language->txt('conf_privacy_name_info')); - $userName->setRequired(false); - $form->addItem($userName); - - if ($this->object->getLrsType()->getForcePrivacySettings()) { - $userIdent->setDisabled(true); - $userName->setDisabled(true); + // if ($this->object->getLrsType()->getForcePrivacySettings()) { + // $useProxy->setDisabled(true); + // } + if ($this->object->getContentType() == ilObjCmiXapi::CONT_TYPE_CMI5) { + $useProxy->setChecked(true); + $useProxy->setDisabled(true); + $useProxy->setInfo($this->language->txt('conf_use_proxy_info_cmi5')); } + // $bypassProxy = new ilRadioGroupInputGUI($this->language->txt('conf_bypass_proxy'), 'bypass_proxy'); + // $bypassProxy->setInfo($this->language->txt('conf_bypass_proxy_info')); + // $opt1 = new ilRadioOption($this->language->txt('conf_bypass_proxy_disabled'), "0"); + // $bypassProxy->addOption($opt1); + // $opt2 = new ilRadioOption($this->language->txt('conf_bypass_proxy_enabled'), "1"); + // $bypassProxy->addOption($opt2); + // $bypassProxy->setValue((string) ((int) $this->object->isBypassProxyEnabled())); + // //$bypassProxy->setValue((string) ((int) $this->object->getLrsType()->isBypassProxyEnabled())); + // $form->addItem($bypassProxy); + // if ($this->object->getLrsType()->isBypassProxyEnabled()) { + // $bypassProxy->setDisabled(true); + // } $item = new ilCheckboxInputGUI($this->language->txt('only_moveon_label'), 'only_moveon'); $item->setInfo($this->language->txt('only_moveon_info')); $item->setChecked($this->object->getOnlyMoveon()); @@ -451,7 +375,7 @@ protected function buildForm(): \ilPropertyFormGUI if ($this->object->getLrsType()->getForcePrivacySettings()) { $item->setDisabled(true); } - $form->addItem($item); + $useProxy->addSubItem($item); $item = new ilCheckboxInputGUI($this->language->txt('hide_data_label'), 'hide_data'); $item->setInfo($this->language->txt('hide_data_info')); @@ -476,7 +400,8 @@ protected function buildForm(): \ilPropertyFormGUI if ($this->object->getLrsType()->getForcePrivacySettings()) { $item->setDisabled(true); } - $form->addItem($item); + //$form->addItem($item); + $useProxy->addSubItem($item); $item = new ilCheckboxInputGUI($this->language->txt('no_substatements_label'), 'no_substatements'); $item->setInfo($this->language->txt('no_substatements_info')); @@ -484,7 +409,96 @@ protected function buildForm(): \ilPropertyFormGUI if ($this->object->getLrsType()->getForcePrivacySettings()) { $item->setDisabled(true); } - $form->addItem($item); + $useProxy->addSubItem($item); + + $form->addItem($useProxy); + // } + + $userIdent = new ilRadioGroupInputGUI($this->language->txt('conf_privacy_ident'), 'privacy_ident'); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_ident_il_uuid_user_id'), + (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_USER_ID + ); + $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_user_id_info')); + $userIdent->addOption($op); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_ident_il_uuid_login'), + (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_LOGIN + ); + $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_login_info')); + $userIdent->addOption($op); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_ident_il_uuid_ext_account'), + (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT + ); + $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_ext_account_info')); + $userIdent->addOption($op); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_ident_il_uuid_sha256'), + (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_SHA256 + ); + $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_sha256_info')); + $userIdent->addOption($op); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_ident_il_uuid_sha256url'), + (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_SHA256URL + ); + $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_sha256url_info')); + $userIdent->addOption($op); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_ident_il_uuid_random'), + (string) ilCmiXapiLrsType::PRIVACY_IDENT_IL_UUID_RANDOM + ); + $op->setInfo($this->language->txt('conf_privacy_ident_il_uuid_random_info')); + $userIdent->addOption($op); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_ident_real_email'), + (string) ilCmiXapiLrsType::PRIVACY_IDENT_REAL_EMAIL + ); + $op->setInfo($this->language->txt('conf_privacy_ident_real_email_info')); + $userIdent->addOption($op); + $userIdent->setValue((string) $this->object->getPrivacyIdent()); + $userIdent->setInfo( + $this->language->txt('conf_privacy_ident_info') . ' ' . ilCmiXapiUser::getIliasUuid() + ); + $userIdent->setRequired(false); + $form->addItem($userIdent); + + $userName = new ilRadioGroupInputGUI($this->language->txt('conf_privacy_name'), 'privacy_name'); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_name_none'), + (string) ilCmiXapiLrsType::PRIVACY_NAME_NONE + ); + $op->setInfo($this->language->txt('conf_privacy_name_none_info')); + $userName->addOption($op); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_name_firstname'), + (string) ilCmiXapiLrsType::PRIVACY_NAME_FIRSTNAME + ); + $op->setInfo($this->language->txt('conf_privacy_name_firstname_info')); + $userName->addOption($op); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_name_lastname'), + (string) ilCmiXapiLrsType::PRIVACY_NAME_LASTNAME + ); + $op->setInfo($this->language->txt('conf_privacy_name_lastname_info')); + $userName->addOption($op); + $op = new ilRadioOption( + $this->language->txt('conf_privacy_name_fullname'), + (string) ilCmiXapiLrsType::PRIVACY_NAME_FULLNAME + ); + $op->setInfo($this->language->txt('conf_privacy_name_fullname_info')); + $userName->addOption($op); + $userName->setValue((string) $this->object->getPrivacyName()); + $userName->setInfo($this->language->txt('conf_privacy_name_info')); + $userName->setRequired(false); + $form->addItem($userName); + + if ($this->object->getLrsType()->getForcePrivacySettings()) { + $userIdent->setDisabled(true); + $userName->setDisabled(true); + } + } $item = new ilRadioGroupInputGUI($this->language->txt('conf_delete_data'), 'delete_data'); @@ -604,13 +618,18 @@ protected function saveSettings(ilPropertyFormGUI $form): void $this->object->setAuthFetchUrlEnabled((bool) $form->getInput('use_fetch')); } - if (!$this->object->getLrsType()->isBypassProxyEnabled()) { - if ($this->object->getContentType() == ilObjCmiXapi::CONT_TYPE_CMI5) { - $this->object->setBypassProxyEnabled(false); + // if (!$this->object->getLrsType()->isBypassProxyEnabled()) { + if ($this->object->getContentType() == ilObjCmiXapi::CONT_TYPE_CMI5) { + $this->object->setBypassProxyEnabled(false); + } else { + // $this->object->setBypassProxyEnabled((bool) $form->getInput('bypass_proxy')); + if ((bool) $form->getInput("use_proxy") == false) { + $this->object->setBypassProxyEnabled(true); } else { - $this->object->setBypassProxyEnabled((bool) $form->getInput('bypass_proxy')); + $this->object->setBypassProxyEnabled(false); } } + // } if (!$this->object->getLrsType()->getForcePrivacySettings()) { $this->object->setPrivacyIdent((int) $form->getInput('privacy_ident')); From 4ed99b65cd81d5856e37cd66b7a90ddf2c0dc143 Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Thu, 11 Apr 2024 21:49:12 +0000 Subject: [PATCH 08/35] fix for launch cmix --- .../CmiXapi/classes/class.ilObjCmiXapiGUI.php | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Modules/CmiXapi/classes/class.ilObjCmiXapiGUI.php b/Modules/CmiXapi/classes/class.ilObjCmiXapiGUI.php index 44f4b79c8b8d..9fa579c90e9a 100755 --- a/Modules/CmiXapi/classes/class.ilObjCmiXapiGUI.php +++ b/Modules/CmiXapi/classes/class.ilObjCmiXapiGUI.php @@ -749,29 +749,29 @@ protected function initInfoScreenToolbar(): void ); $DIC->toolbar()->addComponent($button); } else { - // $launchButton = ilLinkButton::getInstance(); - // $launchButton->setPrimary(true); - // $launchButton->setCaption('launch'); - // - // if ($this->object->getLaunchMethod() == ilObjCmiXapi::LAUNCH_METHOD_NEW_WIN) { - // $launchButton->setTarget('_blank'); - // } - // - // $launchButton->setUrl($DIC->ctrl()->getLinkTargetByClass( - // ilCmiXapiLaunchGUI::class - // )); - // - // $DIC->toolbar()->addButtonInstance($launchButton); + $launchButton = ilLinkButton::getInstance(); + $launchButton->setPrimary(true); + $launchButton->setCaption('launch'); + + if ($this->object->getLaunchMethod() == ilObjCmiXapi::LAUNCH_METHOD_NEW_WIN) { + $launchButton->setTarget('_blank'); + } + + $launchButton->setUrl($DIC->ctrl()->getLinkTargetByClass( + ilCmiXapiLaunchGUI::class + )); + + $DIC->toolbar()->addButtonInstance($launchButton); //todo // if ($this->object->getLaunchMethod() == ilObjCmiXapi::LAUNCH_METHOD_NEW_WIN) { // setTarget('_blank'); // } - $button = $DIC->ui()->factory()->button()->primary( - $this->lng->txt('launch'), - $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiLaunchGUI::class) - ); - $DIC->toolbar()->addComponent($button); + // $button = $DIC->ui()->factory()->button()->primary( + // $this->lng->txt('launch'), + // $DIC->ctrl()->getLinkTargetByClass(ilCmiXapiLaunchGUI::class) + // ); + // $DIC->toolbar()->addComponent($button); } /** From ff8533c2fad8077016e15ec9b80045b1396fb57c Mon Sep 17 00:00:00 2001 From: Thibeau Fuhrer Date: Thu, 11 Apr 2024 13:16:19 +0200 Subject: [PATCH 09/35] [FIX] #39532,#39260 UI: distinguish dropzone example post URLs. --- src/UI/examples/Dropzone/File/Standard/base.php | 8 ++++++-- src/UI/examples/Dropzone/File/Standard/bulky.php | 8 ++++++-- .../Dropzone/File/Standard/with_additional_input.php | 8 ++++++-- src/UI/examples/Dropzone/File/Wrapper/base.php | 8 ++++++-- .../Dropzone/File/Wrapper/with_additional_input.php | 8 ++++++-- .../examples/Dropzone/File/Wrapper/with_clear_button.php | 6 +++++- 6 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/UI/examples/Dropzone/File/Standard/base.php b/src/UI/examples/Dropzone/File/Standard/base.php index e3011204db33..bcd0f4f87f80 100644 --- a/src/UI/examples/Dropzone/File/Standard/base.php +++ b/src/UI/examples/Dropzone/File/Standard/base.php @@ -11,12 +11,16 @@ function base() $factory = $DIC->ui()->factory(); $renderer = $DIC->ui()->renderer(); $request = $DIC->http()->request(); + $wrapper = $DIC->http()->wrapper()->query(); + + $submit_flag = 'dropzone_standard_base'; + $post_url = "{$request->getUri()}&$submit_flag"; $dropzone = $factory ->dropzone()->file()->standard( 'Upload your files here', 'Drag files in here to upload them!', - '#', + $post_url, $factory->input()->field()->file( new \ilUIAsyncDemoFileUploadHandlerGUI(), 'your files' @@ -27,7 +31,7 @@ function base() // please use ilCtrl to generate an appropriate link target // and check it's command instead of this. - if ('POST' === $request->getMethod()) { + if ($wrapper->has($submit_flag)) { $dropzone = $dropzone->withRequest($request); $data = $dropzone->getData(); } else { diff --git a/src/UI/examples/Dropzone/File/Standard/bulky.php b/src/UI/examples/Dropzone/File/Standard/bulky.php index 7364aef23f19..8ad8d9592654 100644 --- a/src/UI/examples/Dropzone/File/Standard/bulky.php +++ b/src/UI/examples/Dropzone/File/Standard/bulky.php @@ -11,12 +11,16 @@ function bulky() $factory = $DIC->ui()->factory(); $renderer = $DIC->ui()->renderer(); $request = $DIC->http()->request(); + $wrapper = $DIC->http()->wrapper()->query(); + + $submit_flag = 'dropzone_standard_bulky'; + $post_url = "{$request->getUri()}&$submit_flag"; $dropzone = $factory ->dropzone()->file()->standard( 'Upload your files here', 'Drag files in here to upload them!', - '#', + $post_url, $factory->input()->field()->file( new \ilUIAsyncDemoFileUploadHandlerGUI(), 'your files' @@ -29,7 +33,7 @@ function bulky() // please use ilCtrl to generate an appropriate link target // and check it's command instead of this. - if ('POST' === $request->getMethod()) { + if ($wrapper->has($submit_flag)) { $dropzone = $dropzone->withRequest($request); $data = $dropzone->getData(); } else { diff --git a/src/UI/examples/Dropzone/File/Standard/with_additional_input.php b/src/UI/examples/Dropzone/File/Standard/with_additional_input.php index 9c490627c494..71ca72e67dd3 100644 --- a/src/UI/examples/Dropzone/File/Standard/with_additional_input.php +++ b/src/UI/examples/Dropzone/File/Standard/with_additional_input.php @@ -11,12 +11,16 @@ function with_additional_input() $factory = $DIC->ui()->factory(); $renderer = $DIC->ui()->renderer(); $request = $DIC->http()->request(); + $wrapper = $DIC->http()->wrapper()->query(); + + $submit_flag = 'dropzone_standard_with_additional_input'; + $post_url = "{$request->getUri()}&$submit_flag"; $dropzone = $factory ->dropzone()->file()->standard( 'Upload your files here', 'Drag files in here to upload them!', - '#', + $post_url, $factory->input()->field()->file( new \ilUIAsyncDemoFileUploadHandlerGUI(), 'your files' @@ -31,7 +35,7 @@ function with_additional_input() // please use ilCtrl to generate an appropriate link target // and check it's command instead of this. - if ('POST' === $request->getMethod()) { + if ($wrapper->has($submit_flag)) { $dropzone = $dropzone->withRequest($request); $data = $dropzone->getData(); } else { diff --git a/src/UI/examples/Dropzone/File/Wrapper/base.php b/src/UI/examples/Dropzone/File/Wrapper/base.php index 411f92dcefe1..cf0f8425288d 100644 --- a/src/UI/examples/Dropzone/File/Wrapper/base.php +++ b/src/UI/examples/Dropzone/File/Wrapper/base.php @@ -11,11 +11,15 @@ function base() $factory = $DIC->ui()->factory(); $renderer = $DIC->ui()->renderer(); $request = $DIC->http()->request(); + $wrapper = $DIC->http()->wrapper()->query(); + + $submit_flag = 'dropzone_wrapper_base'; + $post_url = "{$request->getUri()}&$submit_flag"; $dropzone = $factory ->dropzone()->file()->wrapper( 'Upload your files here', - '#', + $post_url, $factory->messageBox()->info('Drag and drop files onto me!'), $factory->input()->field()->file( new \ilUIAsyncDemoFileUploadHandlerGUI(), @@ -25,7 +29,7 @@ function base() // please use ilCtrl to generate an appropriate link target // and check it's command instead of this. - if ('POST' === $request->getMethod()) { + if ($wrapper->has($submit_flag)) { $dropzone = $dropzone->withRequest($request); $data = $dropzone->getData(); } else { diff --git a/src/UI/examples/Dropzone/File/Wrapper/with_additional_input.php b/src/UI/examples/Dropzone/File/Wrapper/with_additional_input.php index 89b032feccfe..531e7288059d 100644 --- a/src/UI/examples/Dropzone/File/Wrapper/with_additional_input.php +++ b/src/UI/examples/Dropzone/File/Wrapper/with_additional_input.php @@ -11,11 +11,15 @@ function with_additional_input() $factory = $DIC->ui()->factory(); $renderer = $DIC->ui()->renderer(); $request = $DIC->http()->request(); + $wrapper = $DIC->http()->wrapper()->query(); + + $submit_flag = 'dropzone_wrapper_with_additional_input'; + $post_url = "{$request->getUri()}&$submit_flag"; $dropzone = $factory ->dropzone()->file()->wrapper( 'Upload your files here', - '#', + $post_url, $factory->messageBox()->info('Drag and drop files onto me!'), $factory->input()->field()->file( new \ilUIAsyncDemoFileUploadHandlerGUI(), @@ -29,7 +33,7 @@ function with_additional_input() // please use ilCtrl to generate an appropriate link target // and check it's command instead of this. - if ('POST' === $request->getMethod()) { + if ($wrapper->has($submit_flag)) { $dropzone = $dropzone->withRequest($request); $data = $dropzone->getData(); } else { diff --git a/src/UI/examples/Dropzone/File/Wrapper/with_clear_button.php b/src/UI/examples/Dropzone/File/Wrapper/with_clear_button.php index c924c5f48a81..ccb007d15bad 100644 --- a/src/UI/examples/Dropzone/File/Wrapper/with_clear_button.php +++ b/src/UI/examples/Dropzone/File/Wrapper/with_clear_button.php @@ -10,11 +10,15 @@ function with_clear_button() $factory = $DIC->ui()->factory(); $renderer = $DIC->ui()->renderer(); + $request = $DIC->http()->request(); + + $submit_flag = 'dropzone_wrapper_with_clear_button'; + $post_url = "{$request->getUri()}&$submit_flag"; $dropzone = $factory ->dropzone()->file()->wrapper( 'Upload your files here', - '#', + $post_url, $factory->messageBox()->info('Drag and drop files onto me!'), $factory->input()->field()->file( new \ilUIAsyncDemoFileUploadHandlerGUI(), From 7ba261fbb7f07b22107e3cd085e23c4fd1dcd6dc Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Fri, 12 Apr 2024 10:57:55 +0000 Subject: [PATCH 10/35] improvements for xAPI delete data --- .../class.ilCmiXapiAppEventListener.php | 69 ++++++++++++++----- .../classes/class.ilCmiXapiDelModel.php | 26 +++++++ 2 files changed, 76 insertions(+), 19 deletions(-) diff --git a/Modules/CmiXapi/classes/class.ilCmiXapiAppEventListener.php b/Modules/CmiXapi/classes/class.ilCmiXapiAppEventListener.php index 42f14a6c6f67..fdc6562d497f 100644 --- a/Modules/CmiXapi/classes/class.ilCmiXapiAppEventListener.php +++ b/Modules/CmiXapi/classes/class.ilCmiXapiAppEventListener.php @@ -73,17 +73,32 @@ public static function handleEvent(string $component, string $event, array $para private static function onServiceUserDeleteUser(array $parameter): void { - /* nicht testbar aktuell $usr_id = $parameter['usr_id']; $model = ilCmiXapiDelModel::init(); // null or array with objIds, if are going to need more $xapiObjUser = $model->getXapiObjIdForUser($usr_id); if(!is_null($xapiObjUser)) { - // add user as deleted - $model->setXapiUserAsDeleted($usr_id); + for ((int) $i = 0; $i < count($xapiObjUser); $i++) { + $xapiObject = $model->getXapiObjectData($xapiObjUser[$i]); + if(!is_null($xapiObject)) { + if ((int) $xapiObject['delete_data'] != 0) { + if((int) $xapiObject['delete_data'] < 10) { + //remove only ident + $model->removeCmixUsersForObjectAndUser($xapiObjUser[$i], $usr_id); + } else { + // add obj as deleted + $model->setXapiObjAsDeletedForUser($xapiObjUser[$i], $xapiObject['lrs_type_id'], $xapiObject['activity_id'], $usr_id); + } + } + } + } } - */ + + // if(!is_null($xapiObjUser)) { + // // add user as deleted + // $model->setXapiUserAsDeleted($usr_id); + // } } private static function onServiceObjectDeleteOrToTrash(array $parameter): void @@ -111,26 +126,42 @@ private static function onServiceObjectDeleteOrToTrash(array $parameter): void private static function removeMembers(string $src_type, array $parameter): void { + global $DIC; + $tree = $DIC->repositoryTree(); + $usr_id = $parameter['usr_id']; - $id = $parameter['obj_id']; + $crs_id = $parameter['obj_id']; if ( $src_type === 'grp' || $src_type === 'crs' ) { - $ref_ids = ilObject::_getAllReferences($id); - $id = array_shift($ref_ids); - } - //stimmt so nicht: brauche array mit IDs - if (ilObject::_lookupType($id, true) !== "cmix") { - return; - } + $crs_ref_ids = ilObject::_getAllReferences($crs_id); + $idc = array_shift($crs_ref_ids); - // $model = ilCmiXapiDelModel::init(); - // $objId = (int) $parameter['obj_id']; - // $xapiObject = $model->getXapiObjectData($objId); - // if( !is_null($xapiObject) ) { - // // add obj as deleted - // $model->setXapiObjAsDeleted($objId, $xapiObject['lrs_type_id'], $xapiObject['activity_id']); - // } + //Todo check Verknüpfungen? + $ref_ids = $tree->getSubTreeIds($idc); + for ((int) $i = 0; $i < count($ref_ids); $i++) { + if (ilObject::_lookupType($ref_ids[$i], true) == "cmix") { + $objId = ilObject::_lookupObjectId($ref_ids[$i]); + $model = ilCmiXapiDelModel::init(); + $xapiObject = $model->getXapiObjectData($objId); + if(!is_null($xapiObject)) { + $xapiObjUser = $model->getXapiObjIdForUser($usr_id); + if(!is_null($xapiObjUser)) { + // add user as deleted + if ((int) $xapiObject['delete_data'] != 0) { + if ((int) $xapiObject['delete_data'] < 10) { + //remove only ident + $model->removeCmixUsersForObjectAndUser($objId, $usr_id); + } else { + // add obj as deleted + $model->setXapiObjAsDeletedForUser($objId, $xapiObject['lrs_type_id'], $xapiObject['activity_id'], $usr_id); + } + } + } + } + } + } + } } diff --git a/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php b/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php index 77e836f4adc3..af8009d22e54 100644 --- a/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php +++ b/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php @@ -214,6 +214,23 @@ public function setXapiObjAsDeleted(int $objId, int $typeId, string $actId): voi } } + public function setXapiObjAsDeletedForUser(int $objId, int $typeId, string $actId, int $usrId): void + { + // $values = [ + // 'obj_id' => ['integer', $objId], + // 'type_id' => ['integer', $typeId], + // 'activity_id' => ['string', $actId], + // 'added' => ['timestamp', date('Y-m-d H:i:s')] + // ]; + // $this->db->insert(self::DB_DEL_OBJ, $values); + + // if(!$this->dic->cron()->manager()->isJobActive('xapi_deletion_cron')) { + $xapiDelete = new ilCmiXapiStatementsDeleteRequest($objId, $typeId, $actId, $usrId, ilCmiXapiStatementsDeleteRequest::DELETE_SCOPE_ALL); + $xapiDelete->delete(); + // } + } + + public function setXapiObjAsUpdated(int $objId) { @@ -242,7 +259,16 @@ public function removeCmixUsersForObject(int $objId): void [$objId] ); $this->log->debug('cmix_users deleted for objId=' . (string) $objId); + } + public function removeCmixUsersForObjectAndUser(int $objId, int $usrId): void + { + $this->db->manipulateF( + 'DELETE FROM cmix_users WHERE obj_id = %s AND usr_id = %s', + ['integer','integer'], + [$objId,$usrId] + ); + $this->log->debug('cmix_user with usrId ' . (string) $usrId . ' deleted for objId=' . (string) $objId); } } From 0ad877096c034fac4ede1e53fd6e52e1a9a47b68 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 12 Apr 2024 13:51:41 +0200 Subject: [PATCH 11/35] fixed #41122: Recommended content filtered by favorites, even if favorites are deactivated --- .../classes/class.ilFavouritesManager.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Services/Repository/Favourites/classes/class.ilFavouritesManager.php b/Services/Repository/Favourites/classes/class.ilFavouritesManager.php index b5d2a40451f3..77aafc4190f4 100644 --- a/Services/Repository/Favourites/classes/class.ilFavouritesManager.php +++ b/Services/Repository/Favourites/classes/class.ilFavouritesManager.php @@ -24,9 +24,13 @@ class ilFavouritesManager { protected ilFavouritesDBRepository $repo; + protected bool $globally_activated; public function __construct(ilFavouritesDBRepository $repo = null) { + global $DIC; + + $this->globally_activated = ($DIC->settings()->get('rep_favourites', '0') === '1'); $this->repo = is_null($repo) ? new ilFavouritesDBRepository() : $repo; @@ -49,6 +53,9 @@ public function remove(int $user_id, int $ref_id): void // Is item favourite? public function ifIsFavourite(int $user_id, int $ref_id): bool { + if (!$this->isGloballyActivated()) { + return false; + } return $this->repo->ifIsFavourite($user_id, $ref_id); } @@ -61,12 +68,20 @@ public function loadData(int $user_id, array $ref_ids): void $this->repo->loadData($user_id, $ref_ids); } + public function isGloballyActivated(): bool + { + return $this->globally_activated; + } + /** * Get favourites of user * @param ?string[] $a_types */ public function getFavouritesOfUser(int $user_id, ?array $a_types = null): array { + if (!$this->isGloballyActivated()) { + return []; + } return $this->repo->getFavouritesOfUser($user_id, $a_types); } From 8d8849060397e365c901274088c10ad074cdc0d1 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 12 Apr 2024 16:28:11 +0200 Subject: [PATCH 12/35] 40844: Self-evaluation survey with hidden branching rules cannot be imported to ILIAS 8 --- Modules/SurveyQuestionPool/Export/class.SurveyImportParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/SurveyQuestionPool/Export/class.SurveyImportParser.php b/Modules/SurveyQuestionPool/Export/class.SurveyImportParser.php index 33f384088001..e45cea1ca96f 100755 --- a/Modules/SurveyQuestionPool/Export/class.SurveyImportParser.php +++ b/Modules/SurveyQuestionPool/Export/class.SurveyImportParser.php @@ -258,7 +258,7 @@ public function handlerBeginTag($a_xml_parser, string $a_name, array $a_attribs) "value" => $a_attribs["value"], // might be missing in old export files - "conjunction" => (int) $a_attribs["conjuction"] + "conjunction" => (int) ($a_attribs["conjuction"] ?? 0) ); break; case "question": From 8a743ad02ecfea82853bfd30970763dee48cf13b Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 12 Apr 2024 16:50:00 +0200 Subject: [PATCH 13/35] 41113: DataBase Exception when saving changed page content --- Services/COPage/Style/StyleManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Services/COPage/Style/StyleManager.php b/Services/COPage/Style/StyleManager.php index 624e9fe1bf62..091f14b746b3 100644 --- a/Services/COPage/Style/StyleManager.php +++ b/Services/COPage/Style/StyleManager.php @@ -140,7 +140,7 @@ public function saveStyleUsage( $this->db->quote($a_old_nr, "integer") . "," . $this->db->quote($u["template"], "integer") . "," . $this->db->quote($u["stype"], "text") . "," . - $this->db->quote($u["sname"], "text") . + $this->db->quote(\ilStr::subStr($u["sname"], 0, 30), "text") . ")"); } } From 5d3eb016d54fe6ae9c781050e9b3428a461d4d15 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 12 Apr 2024 17:14:43 +0200 Subject: [PATCH 14/35] 41107: Crash when entering too many symbols in Booking pool description --- Modules/BookingManager/Objects/class.ilBookingObjectGUI.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/BookingManager/Objects/class.ilBookingObjectGUI.php b/Modules/BookingManager/Objects/class.ilBookingObjectGUI.php index dae772c47748..d18e64855b67 100644 --- a/Modules/BookingManager/Objects/class.ilBookingObjectGUI.php +++ b/Modules/BookingManager/Objects/class.ilBookingObjectGUI.php @@ -355,6 +355,7 @@ public function initForm( $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc"); $desc->setCols(70); $desc->setRows(15); + $desc->setMaxNumOfChars(1000); $form_gui->addItem($desc); $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file"); From ce267834448d0e1fef1f73034bcb07860b0f5eeb Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 12 Apr 2024 17:29:19 +0200 Subject: [PATCH 15/35] =?UTF-8?q?39902:=20Failed=20test:=20Vorw=C3=A4rtsbl?= =?UTF-8?q?=C3=A4ttern=20im=20Lernmodul=20reglementieren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/LearningModule/js/LearningModule.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Modules/LearningModule/js/LearningModule.js b/Modules/LearningModule/js/LearningModule.js index 302acab03553..fe5b57d2b200 100644 --- a/Modules/LearningModule/js/LearningModule.js +++ b/Modules/LearningModule/js/LearningModule.js @@ -17,13 +17,12 @@ il.LearningModule = { }, hideNextNavigation: function () { - console.log("HIDE NEXT"); - document.querySelectorAll(".ilToolbar .nav .ilToolbarStickyItem:nth-of-type(3) .btn"). + document.querySelectorAll(".c-toolbar .c-toolbar__item--sticky:nth-of-type(3) .btn"). forEach(el => { el.disabled = true; }); }, showNextNavigation: function () { - document.querySelectorAll(".ilToolbar .nav .ilToolbarStickyItem:nth-of-type(3) .btn"). + document.querySelectorAll(".c-toolbar .c-toolbar__item--sticky:nth-of-type(3) .btn"). forEach(el => { el.disabled = false; }); }, From 73d6cd72e747e46c75d35c5f2e86c93548861c47 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 12 Apr 2024 17:49:21 +0200 Subject: [PATCH 16/35] fixed #41098: Can not access the group content : TypeError thrown with message Argument 4 passed... --- .../Container/Content/class.ilContainerContentGUI.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Services/Container/Content/class.ilContainerContentGUI.php b/Services/Container/Content/class.ilContainerContentGUI.php index 9f2c63f27ff8..aafe3d04d0d0 100644 --- a/Services/Container/Content/class.ilContainerContentGUI.php +++ b/Services/Container/Content/class.ilContainerContentGUI.php @@ -675,11 +675,11 @@ public function renderCard( (int) $a_item_data['obj_id'] )); $item_list_gui->initItem( - $a_item_data['ref_id'], - $a_item_data['obj_id'], - $a_item_data['type'], - $a_item_data['title'], - $a_item_data['description'] + (int) $a_item_data['ref_id'], + (int) $a_item_data['obj_id'], + (string) $a_item_data['type'], + (string) $a_item_data['title'], + (string) $a_item_data['description'] ); // actions From 4495cf8959c2c23467fa9027a9b6e403ffe5239f Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 12 Apr 2024 17:54:29 +0200 Subject: [PATCH 17/35] 40582: Error changing installation title: ilStr::shortenTextExtended() must be of the type string, null given --- Modules/SystemFolder/classes/class.ilObjSystemFolder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/SystemFolder/classes/class.ilObjSystemFolder.php b/Modules/SystemFolder/classes/class.ilObjSystemFolder.php index 240dee092bc1..ab5dae60c14a 100755 --- a/Modules/SystemFolder/classes/class.ilObjSystemFolder.php +++ b/Modules/SystemFolder/classes/class.ilObjSystemFolder.php @@ -86,7 +86,7 @@ public function getHeaderTitleTranslations() while ($row = $ilDB->fetchObject($r)) { $data["Fobject"][$num] = array("title" => $row->title, "desc" => ilStr::shortenTextExtended( - $row->description, + (string) $row->description, ilObject::DESC_LENGTH, true ), From 607f405a9be12fd0cf95d0b4dae6c3c0b43a7883 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 12 Apr 2024 17:58:27 +0200 Subject: [PATCH 18/35] #40939: Fixing learning modules check for Anchor link to fix. (#7262) --- .../Presentation/class.ilLMPresentationLinker.php | 2 +- Services/Help/classes/class.ilHelpGUI.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/LearningModule/Presentation/class.ilLMPresentationLinker.php b/Modules/LearningModule/Presentation/class.ilLMPresentationLinker.php index d125833c8e08..9d6772649326 100644 --- a/Modules/LearningModule/Presentation/class.ilLMPresentationLinker.php +++ b/Modules/LearningModule/Presentation/class.ilLMPresentationLinker.php @@ -458,7 +458,7 @@ public function getLinkXML( case "WikiPage": $wiki_anc = ""; - if ($int_link["Anchor"] != "") { + if (($int_link["Anchor"] ?? "") != "") { $wiki_anc = "#" . rawurlencode($int_link["Anchor"]); } $href = ilWikiPage::getGotoForWikiPageTarget($target_id) . $wiki_anc; diff --git a/Services/Help/classes/class.ilHelpGUI.php b/Services/Help/classes/class.ilHelpGUI.php index 16653810076e..9c68d18fda16 100644 --- a/Services/Help/classes/class.ilHelpGUI.php +++ b/Services/Help/classes/class.ilHelpGUI.php @@ -372,7 +372,7 @@ public function getLinkXML( // anchor $anc = $anc_add = ""; - if ($int_link["Anchor"] != "") { + if (($int_link["Anchor"] ?? "") != "") { $anc = $int_link["Anchor"]; $anc_add = "_" . rawurlencode($int_link["Anchor"]); } From 52f3a916499a7875cd6538b20810cdffa4c69139 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 12 Apr 2024 18:09:04 +0200 Subject: [PATCH 19/35] =?UTF-8?q?40725:=20Multiple-Choice=20mit=20Vorgabe?= =?UTF-8?q?=20min-=20=3D=20max-Antworten=20blockiert=20die=20Testfortf?= =?UTF-8?q?=C3=BChrung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Questions/class.SurveyMultipleChoiceQuestion.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/SurveyQuestionPool/Questions/class.SurveyMultipleChoiceQuestion.php b/Modules/SurveyQuestionPool/Questions/class.SurveyMultipleChoiceQuestion.php index 680082b14749..7a13d54a54a6 100755 --- a/Modules/SurveyQuestionPool/Questions/class.SurveyMultipleChoiceQuestion.php +++ b/Modules/SurveyQuestionPool/Questions/class.SurveyMultipleChoiceQuestion.php @@ -318,7 +318,7 @@ public function checkUserInput( return ""; } - if ($this->use_min_answers && $this->nr_min_answers > 0 && $this->nr_max_answers > 0 && $this->nr_min_answers == $this->nr_max_answers && count($entered_value) !== $this->nr_max_answers) { + if ($this->use_min_answers && $this->nr_min_answers > 0 && $this->nr_max_answers > 0 && $this->nr_min_answers == $this->nr_max_answers && count($entered_value) !== (int) $this->nr_max_answers) { return sprintf($this->lng->txt("err_no_exact_answers"), $this->nr_min_answers); } if ($this->use_min_answers && $this->nr_min_answers > 0 && count($entered_value) < $this->nr_min_answers) { From fece21126d5e1de2e577ec27a08866241122a0a3 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 12 Apr 2024 18:36:20 +0200 Subject: [PATCH 20/35] 41076: Failed test: Nur Handlungsanweisungen --- Services/Help/Module/ModuleManager.php | 8 ++++++++ Services/Help/Presentation/PresentationManager.php | 13 ++----------- Services/Help/classes/class.ilHelpGUI.php | 9 +++++++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Services/Help/Module/ModuleManager.php b/Services/Help/Module/ModuleManager.php index cc6a3449df2d..566412f41699 100644 --- a/Services/Help/Module/ModuleManager.php +++ b/Services/Help/Module/ModuleManager.php @@ -100,6 +100,14 @@ public function isHelpActive(): bool return (count($this->getActiveModules()) > 0); } + public function areTooltipsActive(): bool + { + if ($this->settings->get("help_mode") === "1") { + return false; + } + return $this->isHelpActive(); + } + public function isAuthoringMode(): bool { return ($this->getAuthoringLMId() > 0); diff --git a/Services/Help/Presentation/PresentationManager.php b/Services/Help/Presentation/PresentationManager.php index 7b9d7c8960a9..dd7bf12ae798 100644 --- a/Services/Help/Presentation/PresentationManager.php +++ b/Services/Help/Presentation/PresentationManager.php @@ -40,13 +40,7 @@ public function __construct( public function isHelpActive(): bool { - if ($this->user->getLanguage() !== "de") { - return false; - } - if ($this->module->isAuthoringMode()) { - return true; - } - return (count($this->module->getActiveModules()) > 0); + return $this->module->isHelpActive(); } public function showTool(): bool @@ -59,10 +53,7 @@ public function showTool(): bool public function showTooltips(): bool { - if ($this->settings->get("help_mode") === "1") { - return false; - } - return $this->isHelpActive(); + return $this->module->areTooltipsActive(); } } diff --git a/Services/Help/classes/class.ilHelpGUI.php b/Services/Help/classes/class.ilHelpGUI.php index 9c68d18fda16..3073686cc10b 100644 --- a/Services/Help/classes/class.ilHelpGUI.php +++ b/Services/Help/classes/class.ilHelpGUI.php @@ -551,16 +551,21 @@ public function isHelpActive(): bool return $this->internal()->domain()->module()->isHelpActive(); } + public function areTooltipsActive(): bool + { + return $this->internal()->domain()->module()->areTooltipsActive(); + } + public function savePersonalSettingFromLegacyForm(ilPropertyFormGUI $form): void { - if ($this->isHelpActive()) { + if ($this->areTooltipsActive()) { $this->user->setPref('hide_help_tt', (string) (int) !$form->getInput('help_tooltips')); } } public function addPersonalSettingToLegacyForm(ilPropertyFormGUI $form): void { - if ($this->isHelpActive()) { + if ($this->areTooltipsActive()) { $this->lng->loadLanguageModule('help'); $cb = new ilCheckboxInputGUI($this->lng->txt('help_toggle_tooltips'), 'help_tooltips'); $cb->setChecked(!($this->user->prefs['hide_help_tt'] ?? false)); From ac392c25c13511ac1872a5eac6c9a18caadb82fd Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Fri, 12 Apr 2024 22:33:27 +0000 Subject: [PATCH 21/35] improvements for xapi del cronjob --- .../class.ilCmiXapiDatabaseUpdateSteps.php | 13 ++ .../classes/class.ilCmiXapiDelCron.php | 114 ++++-------------- .../classes/class.ilCmiXapiDelModel.php | 52 ++++---- ...class.ilCmiXapiStatementsDeleteRequest.php | 3 - lang/ilias_de.lang | 2 + lang/ilias_en.lang | 2 + 6 files changed, 65 insertions(+), 121 deletions(-) diff --git a/Modules/CmiXapi/classes/Setup/class.ilCmiXapiDatabaseUpdateSteps.php b/Modules/CmiXapi/classes/Setup/class.ilCmiXapiDatabaseUpdateSteps.php index e6553a091ccc..959a02c8dcc5 100755 --- a/Modules/CmiXapi/classes/Setup/class.ilCmiXapiDatabaseUpdateSteps.php +++ b/Modules/CmiXapi/classes/Setup/class.ilCmiXapiDatabaseUpdateSteps.php @@ -242,4 +242,17 @@ public function step_16(): void $this->db->addPrimaryKey("cmix_del_object", array("obj_id", "type_id", "activity_id")); } } + public function step_17(): void + { + if (!$this->db->tableColumnExists('cmix_del_user', 'obj_id')) { + $this->db->addTableColumn('cmix_del_user', 'obj_id', array( + 'type' => 'integer', + 'length' => 4, + 'notnull' => true + )); + $this->db->manipulate('DELETE FROM cmix_del_user'); + $this->db->dropPrimaryKey('cmix_del_user'); + $this->db->addPrimaryKey('cmix_del_user', array('usr_id','obj_id')); + } + } } diff --git a/Modules/CmiXapi/classes/class.ilCmiXapiDelCron.php b/Modules/CmiXapi/classes/class.ilCmiXapiDelCron.php index aa275055763c..a41c22cab45f 100644 --- a/Modules/CmiXapi/classes/class.ilCmiXapiDelCron.php +++ b/Modules/CmiXapi/classes/class.ilCmiXapiDelCron.php @@ -154,65 +154,6 @@ public function run(): ilCronJobResult => wenn's für alle Objekte, die der User genutzt hat, gelöscht wurde: Zeile in xapidel_user löschen => Zeile in Tabelle xapidel_object löschen - - - */ - - - //user deleted - //SELECT distinct LRS credentials for all objs - ACHTUNG Plugin-Version beachten! - //SELECT usr_id FROM xapidel_user - //usr_ids=.. - //SELECT obj_id, user_cred WHERE user_id in (usr_ids) - //delete in lrs - wenn nicht in separate log-tabelle schreiben - //delete xxcf_users WHERE obj_id and user_cred - //if numrows for usr_id =0 DELETE FROM xapidel_user WHERE usr_id=%s - - //Hinweis auf negative Auswirkungen von lrs-typ-Änderungen für Lösch vorgänge - - //object deleted - //SELECT activity_id, lrs_cred FROM xapidel_obj, xxcf_data_types WHERE xxcf_data_types.type_id = xapidel_obj.type_d //ACHTUNG: endpoint_use egal, lrs_type_id genutzt? - - - //lrs_type_id deleted??? - - /* - if( !$this->hasLrsType() ) - { - ilLoggerFactory::getRootLogger()->alert('No lrs type configured!'); - $cronResult->setStatus(ilCronJobResult::STATUS_INVALID_CONFIGURATION); - return $cronResult; - } - */ - // $lpChangesQueue = new ilxapidelChangesQueue(); - // $lpChangesQueue->load(); - - // $statementListBuilder = new ilxapidelXapiStatementListBuilder(ilLoggerFactory::getRootLogger(), $this->getLrsType()); - // $statementList = $statementListBuilder->buildStatementsList($lpChangesQueue); - /* - $lrsRequest = new ilxapidelXapiRequest( - ilLoggerFactory::getRootLogger(), - $this->getLrsType()->getLrsEndpointStatementsLink(), - $this->getLrsType()->getLrsKey(), - $this->getLrsType()->getLrsSecret() - ); - - if( $lrsRequest->send($statementList) ) - { - if( $lpChangesQueue->hasEntries() ) - { - $lpChangesQueue->delete(); - $cronResult->setStatus(ilCronJobResult::STATUS_OK); - } - else - { - $cronResult->setStatus(ilCronJobResult::STATUS_NO_ACTION); - } - } - else - { - $cronResult->setStatus(ilCronJobResult::STATUS_FAIL); - } */ // Fall 1: @@ -254,46 +195,35 @@ public function run(): ilCronJobResult $newDeletedUsers = $this->model->getNewDeletedUsers(); foreach ($newDeletedUsers as $deletedUser) { $usrId = $deletedUser['usr_id']; + $objId = $deletedUser['obj_id']; // set user to updated $this->model->setUserAsUpdated($usrId); - // get all objects of deleted user - $xapiObjects = $this->model->getXapiObjectsByUser($usrId); - $usrObjectsDone = true; - foreach ($xapiObjects as $xapiObject) { - $objId = $xapiObject['obj_id']; - // check if all object data already successfully deleted in previous step within this run, because object was also deleted - if (in_array($objId, $deletedObjectData)) { - $this->log->debug("nothing to do, because of complete object data deletion in previous step"); - continue; - } - $deleteRequest = new ilCmiXapiStatementsDeleteRequest( - (int) $xapiObject['obj_id'], - (int) $xapiObject['lrs_type_id'], - (string) $xapiObject['activity_id'], - $usrId, - ilCmiXapiStatementsDeleteRequest::DELETE_SCOPE_OWN - ); - $done = $deleteRequest->delete(); - // entry in xxcf_users is already deleted from ilXapiCmi5StatementsDeleteRequest - if ($done) { - $this->log->debug("deleted object " . (string) $objId . " data for user " . (string) $usrId); - } else { - $this->log->debug("error deleting object " . (string) $objId . " data for user " . (string) $usrId); - $usrObjectsDone = false; - } - } // EOF foreach ($xapiObjects as $xapiObject) - - if ($usrObjectsDone) { - $this->model->deleteUserEntry($usrId); + $xapiObject = $this->model->getXapiObjectData($objId); + // check if all object data already successfully deleted in previous step within this run, because object was also deleted + if (in_array($objId, $deletedObjectData)) { + $this->log->debug("nothing to do, because of complete object data deletion in previous step"); + continue; + } + $deleteRequest = new ilCmiXapiStatementsDeleteRequest( + (int) $objId, + (int) $xapiObject['lrs_type_id'], + (string) $xapiObject['activity_id'], + $usrId, + ilCmiXapiStatementsDeleteRequest::DELETE_SCOPE_OWN + ); + $done = $deleteRequest->delete(); + // entry in xxcf_users is already deleted from ilXapiCmi5StatementsDeleteRequest + if ($done) { + $this->model->deleteUserEntry($usrId, $objId); + $this->log->debug("deleted object " . (string) $objId . " data for user " . (string) $usrId); } else { - $this->model->resetUpdatedXapiUser($usrId); + $this->log->debug("error deleting object " . (string) $objId . " data for user " . (string) $usrId); + $this->model->resetUpdatedXapiUser($usrId, $objId); $allDone = false; } } - // Fall 3 wird noch gebraucht? - - // maybe more detailled success/fail messages? + // Fall 3 wird noch gebraucht? NEIN if ($allDone) { $cronResult->setStatus(ilCronJobResult::STATUS_OK); diff --git a/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php b/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php index af8009d22e54..020722b8883e 100644 --- a/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php +++ b/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php @@ -88,12 +88,13 @@ public function setUserAsUpdated(int $usrId) ]); } - public function resetUpdatedXapiUser(int $usrId) + public function resetUpdatedXapiUser(int $usrId, int $objId) { $this->db->update(self::DB_DEL_USERS, [ 'updated' => ['timestamp', null] ], [ - 'usr_id' => ['integer', $usrId] + 'usr_id' => ['integer', $usrId], + 'obj_id' => ['integer', $objId] ]); } @@ -145,12 +146,12 @@ public function getNewDeletedUsers() return $data; } - public function deleteUserEntry($usrId) + public function deleteUserEntry($usrId, $objId) { $this->db->manipulateF( - 'DELETE FROM ' . self::DB_DEL_USERS . ' WHERE usr_id = %s', - ['integer'], - [$usrId] + 'DELETE FROM ' . self::DB_DEL_USERS . ' WHERE usr_id = %s AND obj_id = %s', + ['integer', 'integer'], + [$usrId, $objId] ); } @@ -200,34 +201,33 @@ public function deleteXapiObjectEntry($objId) public function setXapiObjAsDeleted(int $objId, int $typeId, string $actId): void { - $values = [ - 'obj_id' => ['integer', $objId], - 'type_id' => ['integer', $typeId], - 'activity_id' => ['string', $actId], - 'added' => ['timestamp', date('Y-m-d H:i:s')] - ]; - $this->db->insert(self::DB_DEL_OBJ, $values); - if(!$this->dic->cron()->manager()->isJobActive('xapi_deletion_cron')) { $xapiDelete = new ilCmiXapiStatementsDeleteRequest($objId, $typeId, $actId, null, ilCmiXapiStatementsDeleteRequest::DELETE_SCOPE_ALL); $xapiDelete->delete(); + } else { + $values = [ + 'obj_id' => ['integer', $objId], + 'type_id' => ['integer', $typeId], + 'activity_id' => ['string', $actId], + 'added' => ['timestamp', date('Y-m-d H:i:s')] + ]; + $this->db->insert(self::DB_DEL_OBJ, $values); } } public function setXapiObjAsDeletedForUser(int $objId, int $typeId, string $actId, int $usrId): void { - // $values = [ - // 'obj_id' => ['integer', $objId], - // 'type_id' => ['integer', $typeId], - // 'activity_id' => ['string', $actId], - // 'added' => ['timestamp', date('Y-m-d H:i:s')] - // ]; - // $this->db->insert(self::DB_DEL_OBJ, $values); - - // if(!$this->dic->cron()->manager()->isJobActive('xapi_deletion_cron')) { - $xapiDelete = new ilCmiXapiStatementsDeleteRequest($objId, $typeId, $actId, $usrId, ilCmiXapiStatementsDeleteRequest::DELETE_SCOPE_ALL); - $xapiDelete->delete(); - // } + if(!$this->dic->cron()->manager()->isJobActive('xapi_deletion_cron')) { + $xapiDelete = new ilCmiXapiStatementsDeleteRequest($objId, $typeId, $actId, $usrId, ilCmiXapiStatementsDeleteRequest::DELETE_SCOPE_ALL); + $xapiDelete->delete(); + } else { + $values = [ + 'usr_id' => ['integer', $usrId], + 'obj_id' => ['integer', $objId], + 'added' => ['timestamp', date('Y-m-d H:i:s')] + ]; + $this->db->insert(self::DB_DEL_USERS, $values); + } } diff --git a/Modules/CmiXapi/classes/class.ilCmiXapiStatementsDeleteRequest.php b/Modules/CmiXapi/classes/class.ilCmiXapiStatementsDeleteRequest.php index e84ef8213780..cbebe973791a 100644 --- a/Modules/CmiXapi/classes/class.ilCmiXapiStatementsDeleteRequest.php +++ b/Modules/CmiXapi/classes/class.ilCmiXapiStatementsDeleteRequest.php @@ -63,9 +63,6 @@ public function __construct( ?string $scope = self::DELETE_SCOPE_FILTERED, ?ilCmiXapiStatementsReportFilter $filter = null ) { - if ((int)ILIAS_VERSION_NUMERIC < 6) { // only in plugin - require_once __DIR__ . '/../XapiProxy/vendor/autoload.php'; - } $this->objId = $obj_id; $this->lrsType = new ilCmiXapiLrsType($type_id); $this->activityId = $activity_id; diff --git a/lang/ilias_de.lang b/lang/ilias_de.lang index 592d3d32c87d..177ffbc8b8a6 100644 --- a/lang/ilias_de.lang +++ b/lang/ilias_de.lang @@ -3215,6 +3215,8 @@ cmix#:#content_privacy_ident#:#Identifikation der Person cmix#:#content_privacy_name#:#Anmeldename cmix#:#create_lrs_type_form#:#Neuer Learning Record Store Typ cmix#:#create_registration#:#Registrieren Sie Ihre E-Mail-Adresse +cmix#:#cron_xapi_del#:#xAPI/cmi5 Daten im Learning Record Store löschen +cmix#:#cron_xapi_del_desc#:#Daten werden gemäß den Einstellungen der xAPI/cmi5-Objekte gelöscht. cmix#:#cron_xapi_results_evaluation#:#xAPI/cmi5 Ergebnisse holen cmix#:#cron_xapi_results_evaluation_desc#:#Fordert alle xAPI-Ergebnisse aus dem Learning Record Store für Objekte an, die den ILIAS xAPI-Proxy nicht unterstützen. cmix#:#description_info#:#Die Beschreibung wird unterhalb des Titels angezeigt. diff --git a/lang/ilias_en.lang b/lang/ilias_en.lang index f45d9748307c..535730fc2d2c 100644 --- a/lang/ilias_en.lang +++ b/lang/ilias_en.lang @@ -3216,6 +3216,8 @@ cmix#:#content_privacy_ident#:#User identification for resource cmix#:#content_privacy_name#:#User name for resource cmix#:#create_lrs_type_form#:#New LRS-Type cmix#:#create_registration#:#Register your E-Mail address +cmix#:#cron_xapi_del#:#Delete xAPI/cmi5 data in the Learning Record Store +cmix#:#cron_xapi_del_desc#:#Data are deleted according to the settings of the xAPI/cmi5 objects. cmix#:#cron_xapi_results_evaluation#:#Fetch xAPI/cmi5 Results cmix#:#cron_xapi_results_evaluation_desc#:#Requests all xAPI results from learning record stores for objects not supporting the ILIAS xAPI proxy. cmix#:#description_info#:#The description will be shown below the title. From 86ff64f9a5c98ca222f155c80fa682c8c588864c Mon Sep 17 00:00:00 2001 From: Stephan Kergomard Date: Sat, 13 Apr 2024 16:44:06 +0200 Subject: [PATCH 22/35] Test: Fix Formula Question Edit Form See: https://mantis.ilias.de/view.php?id=41123 and: https://mantis.ilias.de/view.php?id=41124 --- .../Service/class.InternalRequestService.php | 10 ++++-- .../classes/class.assFormulaQuestionGUI.php | 14 ++++---- .../class.assFormulaQuestionResult.php | 13 +++++--- .../class.assFormulaQuestionVariable.php | 33 +++++++++++-------- 4 files changed, 45 insertions(+), 25 deletions(-) diff --git a/Modules/TestQuestionPool/Service/class.InternalRequestService.php b/Modules/TestQuestionPool/Service/class.InternalRequestService.php index 391d7cec07d9..84bc7fb30dfe 100644 --- a/Modules/TestQuestionPool/Service/class.InternalRequestService.php +++ b/Modules/TestQuestionPool/Service/class.InternalRequestService.php @@ -20,6 +20,8 @@ use ILIAS\Repository\BaseGUIRequest; +use ILIAS\Refinery\ConstraintViolationException; + class InternalRequestService { use BaseGUIRequest; @@ -129,10 +131,14 @@ public function raw(string $key) return $this->get($key, $no_transform); } - public function float(string $key): float + public function float(string $key): ?float { $t = $this->refinery->kindlyTo()->float(); - return $this->get($key, $t) ?? 0.0; + try { + return $this->get($key, $t) ?? 0.0; + } catch (ConstraintViolationException $e) { + return 0.0; + } } public function string(string $key): string diff --git a/Modules/TestQuestionPool/classes/class.assFormulaQuestionGUI.php b/Modules/TestQuestionPool/classes/class.assFormulaQuestionGUI.php index 548e8b68597b..0320ddb123fd 100755 --- a/Modules/TestQuestionPool/classes/class.assFormulaQuestionGUI.php +++ b/Modules/TestQuestionPool/classes/class.assFormulaQuestionGUI.php @@ -608,15 +608,17 @@ public function editQuestion($checkonly = false, string $suggest_range_for_resul } $intPrecision = $form->getItemByPostVar('intprecision_' . $variable->getVariable()); $decimal_spots = $form->getItemByPostVar('precision_' . $variable->getVariable()); - if ($decimal_spots->getValue() == 0) { - if (!$variable->isIntPrecisionValid( + if ($decimal_spots->getValue() == 0 + && $min_range->getValue() !== null + && $max_range->getValue() !== null + && !$variable->isIntPrecisionValid( $intPrecision->getValue(), $min_range->getValue(), $max_range->getValue() - )) { - $intPrecision->setAlert($this->lng->txt('err_division')); - $custom_errors = true; - } + ) + ) { + $intPrecision->setAlert($this->lng->txt('err_division')); + $custom_errors = true; } } } diff --git a/Modules/TestQuestionPool/classes/class.assFormulaQuestionResult.php b/Modules/TestQuestionPool/classes/class.assFormulaQuestionResult.php index 34ae03a73586..65e232e64f32 100755 --- a/Modules/TestQuestionPool/classes/class.assFormulaQuestionResult.php +++ b/Modules/TestQuestionPool/classes/class.assFormulaQuestionResult.php @@ -604,10 +604,12 @@ public function setRangeMin(?string $range_min): void return; } - $this->range_min = (float) $range_min; + $math = new EvalMath(); + $math->suppress_errors = true; + $this->range_min = (float) $math->evaluate($range_min); } - public function getRangeMin(): float + public function getRangeMin(): ?float { return $this->range_min; } @@ -626,10 +628,13 @@ public function setRangeMax(?string $range_max): void if ($range_max === null) { return; } - $this->range_max = (float) $range_max; + + $math = new EvalMath(); + $math->suppress_errors = true; + $this->range_max = (float) $math->evaluate($range_max); } - public function getRangeMax(): float + public function getRangeMax(): ?float { return $this->range_max; } diff --git a/Modules/TestQuestionPool/classes/class.assFormulaQuestionVariable.php b/Modules/TestQuestionPool/classes/class.assFormulaQuestionVariable.php index 59c87e0fe3b1..15abcf37a9a6 100755 --- a/Modules/TestQuestionPool/classes/class.assFormulaQuestionVariable.php +++ b/Modules/TestQuestionPool/classes/class.assFormulaQuestionVariable.php @@ -43,19 +43,19 @@ public function __construct( public function getRandomValue() { - if ($this->getPrecision() === 0) { - if (!$this->isIntPrecisionValid( + if ($this->getPrecision() === 0 + && !$this->isIntPrecisionValid( $this->getIntprecision(), $this->getRangeMin(), $this->getRangeMax() - )) { - global $DIC; - $lng = $DIC['lng']; - $DIC->ui()->mainTemplate()->setOnScreenMessage( - "failure", - $lng->txt('err_divider_too_big') - ); - } + ) + ) { + global $DIC; + $lng = $DIC['lng']; + $DIC->ui()->mainTemplate()->setOnScreenMessage( + "failure", + $lng->txt('err_divider_too_big') + ); } $mul = ilMath::_pow(10, $this->getPrecision()); @@ -91,8 +91,11 @@ public function setRandomValue(): void $this->setValue($this->getRandomValue()); } - public function isIntPrecisionValid($int_precision, $min_range, $max_range) + public function isIntPrecisionValid(?int $int_precision, float $min_range, float $max_range) { + if ($int_precision === null) { + return false; + } $min_abs = abs($min_range); $max_abs = abs($max_range); $bigger_abs = $max_abs > $min_abs ? $max_abs : $min_abs; @@ -147,7 +150,9 @@ public function getVariable(): string public function setRangeMin(string $range_min): void { - $this->range_min = (float) $range_min; + $math = new EvalMath(); + $math->suppress_errors = true; + $this->range_min = (float) $math->evaluate($range_min); } public function getRangeMin(): float @@ -157,7 +162,9 @@ public function getRangeMin(): float public function setRangeMax(string $range_max): void { - $this->range_max = (float) $range_max; + $math = new EvalMath(); + $math->suppress_errors = true; + $this->range_max = (float) $math->evaluate($range_max); } public function getRangeMax(): float From cf9fa70636000199fd986bf0a048f76159b042e6 Mon Sep 17 00:00:00 2001 From: Denis Strassner Date: Thu, 28 Mar 2024 12:32:28 +0100 Subject: [PATCH 23/35] TA: Changed lang because of Mantis 39458 JF decision from 2024-01-08 --- lang/ilias_de.lang | 4 ++-- lang/ilias_en.lang | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/ilias_de.lang b/lang/ilias_de.lang index 177ffbc8b8a6..4092ea2b2d4b 100644 --- a/lang/ilias_de.lang +++ b/lang/ilias_de.lang @@ -1123,7 +1123,7 @@ assessment#:#rating_value#:#Bewertung (Wert) assessment#:#rectangle#:#Rechteck assessment#:#rectangle_click_br_corner#:#Bitte klicken Sie auf die untere rechte Ecke der gewünschten Region. assessment#:#rectangle_click_tl_corner#:#Bitte klicken Sie auf die obere linke Ecke der gewünschten Region. -assessment#:#redirectAfterSave#:#Die maximale Bearbeitungszeit für diesen Test wurde erreicht. Ihre letzte bearbeitete Frage wurde automatisch beim Erreichen der Bearbeitungszeit gespeichert. In wenigen Sekunden werden Sie weitergeleitet... +assessment#:#redirectAfterSave#:#Die maximale Bearbeitungszeit für diesen Test wurde erreicht. In wenigen Sekunden werden Sie weitergeleitet... assessment#:#redirect_after_finishing_rule#:#Weiterleitung assessment#:#redirect_after_finishing_tst#:#Weiterleitung assessment#:#redirect_after_finishing_tst_desc#:#Teilnehmer werden nach Beenden des Tests automatisch zu einer definierten Webseite weitergeleitet. Dies geschieht nur, wenn der Test so konfiguriert wurde, dass die Teilnehmer ihre Testergebnisse nach Beenden des Tests nicht einsehen können. Wenn Sie die Adresse einer externen Webseite eingeben, verwenden Sie die vollständige URL (einschließlich "https://"). Wenn Sie zu einem Objekt in ILIAS weiterleiten, verwenden Sie den Permalink, der in der Fußzeile des betreffenden Objekts zu finden ist. @@ -1375,7 +1375,7 @@ assessment#:#tst_enable_questionlist#:#Fragenliste assessment#:#tst_enable_questionlist_description#:#Teilnehmer können sich links neben den Testfragen eine Fragenliste anzeigen lassen. assessment#:#tst_ending_time#:#Ende assessment#:#tst_ending_time_before_starting_time#:#Bitte geben Sie für das Ende des Tests ein Datum ein, das nach dem Startdatum liegt. -assessment#:#tst_ending_time_desc#:#Zeitpunkt, ab dem Teilnehmer keine Antworten mehr abgeben können. Wichtig: Benutzen Sie diese Option nicht für E-Klausuren/Fernklausuren. Verwenden Sie stattdessen die Funktion „Bearbeitungsdauer begrenzen“, siehe unten. Nur dann wird der Test serverseitig beendet und die letzte Eingabe jedes Teilnehmers automatisch gespeichert. +assessment#:#tst_ending_time_desc#:#Zeitpunkt, ab dem Teilnehmer keine Antworten mehr abgeben können. Wichtig: Benutzen Sie diese Option nicht für E-Klausuren/Fernklausuren. Verwenden Sie stattdessen die Funktion „Bearbeitungsdauer begrenzen“, siehe unten. Nur dann wird der Test serverseitig beendet und die letzte Eingabe bei Freitext-Fragen jedes Teilnehmers automatisch als Auto-Save-Inhalt gespeichert. assessment#:#tst_enter_questionpool#:#Bitte geben Sie den Namen eines Fragenpools an, in dem die neue Frage abgelegt werden soll assessment#:#tst_eval_question_points#:#Fragenergebnisse für Testdurchlauf %s assessment#:#tst_eval_results_by_pass#:#Liste der Antworten für Testdurchlauf %s diff --git a/lang/ilias_en.lang b/lang/ilias_en.lang index 535730fc2d2c..19f3b03c3001 100644 --- a/lang/ilias_en.lang +++ b/lang/ilias_en.lang @@ -1124,7 +1124,7 @@ assessment#:#rating_value#:#Rate Value assessment#:#rectangle#:#Rectangle assessment#:#rectangle_click_br_corner#:#Please click on the bottom right corner of the desired area. assessment#:#rectangle_click_tl_corner#:#Please click on the top left corner of the desired area. -assessment#:#redirectAfterSave#:#The maximum working time has been reached and your last question has been saved automatically. In a few seconds you will be redirected... +assessment#:#redirectAfterSave#:#The maximum working time has been reached. In a few seconds you will be redirected... assessment#:#redirect_after_finishing_rule#:#Redirect assessment#:#redirect_after_finishing_tst#:#Redirect assessment#:#redirect_after_finishing_tst_desc#:#After completing the test, each participant is automatically redirected to a specific webpage of your choosing. This will only happen if participants do not have direct access to their test results. When entering the address of an external webpage, use the complete URL (including ‘https://’). When redirecting to an Object in ILIAS, use the permalink that can be found in the footer of the Object in question. @@ -1376,7 +1376,7 @@ assessment#:#tst_enable_questionlist#:#Show 'List of Questions’ assessment#:#tst_enable_questionlist_description#:#Participants can switch on a list of the test questions on the left of the actual question. assessment#:#tst_ending_time#:#Finishing Time assessment#:#tst_ending_time_before_starting_time#:#Please enter a date for the end of the test that is after the start date. -assessment#:#tst_ending_time_desc#:#Time from which participants can no longer submit answers. Important: Do not use this option for e-exams/distance exams. Instead, use the function "Limit processing time", see below. Only then will the test be ended on the server side and each participant's last entry automatically saved as an authorised answer. +assessment#:#tst_ending_time_desc#:#Time from which participants can no longer submit answers. Important: Do not use this option for e-exams/distance exams. Instead, use the function 'Limit Duration of Test' (see below). Only then will the test be ended on the server side and each participant's last entry in Essay-Questions automatically saved as auto-save-content. assessment#:#tst_enter_questionpool#:#Please enter a question pool name where the new question will be stored assessment#:#tst_eval_question_points#:#Question Results for Pass %s assessment#:#tst_eval_results_by_pass#:#List of Answers for Pass %s From 397352ff624d07efbfb18590d5958d3c88ff106d Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Sat, 13 Apr 2024 18:50:30 +0000 Subject: [PATCH 24/35] fix Mantis #73393 --- Modules/CmiXapi/classes/class.ilObjCmiXapiGUI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CmiXapi/classes/class.ilObjCmiXapiGUI.php b/Modules/CmiXapi/classes/class.ilObjCmiXapiGUI.php index 9fa579c90e9a..ba7b507c4d31 100755 --- a/Modules/CmiXapi/classes/class.ilObjCmiXapiGUI.php +++ b/Modules/CmiXapi/classes/class.ilObjCmiXapiGUI.php @@ -714,7 +714,7 @@ protected function initInfoScreenToolbar(): void global $DIC; /* @var \ILIAS\DI\Container $DIC */ - if (!$this->object->getOfflineStatus() && $this->object->getLrsType()->isAvailable()) { + if (!$this->object->getOfflineStatus() && $this->object->getLrsType()->isAvailable() && $this->checkPermissionBool("read")) { // TODO : check if this is the correct query // p.e. switched to another privacyIdent before: user exists but not with the new privacyIdent // re_check for isSourceTypeExternal From 67f3cf75b1b8783c40a5ed16ac4f04eeb0af4e58 Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Sat, 13 Apr 2024 21:35:00 +0000 Subject: [PATCH 25/35] changed priority to 63 for LTI provider with missing exit --- Services/LTI/classes/Screen/LtiViewLayoutProvider.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Services/LTI/classes/Screen/LtiViewLayoutProvider.php b/Services/LTI/classes/Screen/LtiViewLayoutProvider.php index c48df8fc59a0..f31a11a162ec 100755 --- a/Services/LTI/classes/Screen/LtiViewLayoutProvider.php +++ b/Services/LTI/classes/Screen/LtiViewLayoutProvider.php @@ -43,6 +43,8 @@ class LtiViewLayoutProvider extends AbstractModificationProvider implements Modi { public const GS_EXIT_LTI = 'lti_exit_mode'; + private const MODIFICATION_PRIORITY = 63; + public function isInterestedInContexts(): ContextCollection { return $this->context_collection->lti(); @@ -76,7 +78,7 @@ function (PagePartProvider $parts): Page { return $page->withNoFooter(); } ) - ->withHighPriority(); + ->withPriority(self::MODIFICATION_PRIORITY); } protected function isLTIExitMode(CalledContexts $screen_context_stack): bool @@ -108,7 +110,7 @@ function (?MainBar $mainbar) use ($is_exit_mode): ?MainBar { return $mainbar; } ) - ->withHighPriority(); + ->withPriority(self::MODIFICATION_PRIORITY); } /** @@ -133,7 +135,7 @@ function (?MetaBar $metabar) use ($is_exit_mode, $screen_context_stack): ?Metaba return $metabar; } ) - ->withHighPriority(); + ->withPriority(self::MODIFICATION_PRIORITY); } /** @@ -153,6 +155,6 @@ function (?string $content) use ($is_exit_mode): string { return $this->dic["lti"]->getTitle(); } ) - ->withHighPriority(); + ->withPriority(self::MODIFICATION_PRIORITY); } } From 66e8d6af5c79a6198c2bda86d0dbffee319c1d53 Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Sun, 14 Apr 2024 09:19:04 +0000 Subject: [PATCH 26/35] fix for Mantis #40350 --- Services/LTI/classes/class.ilLTIViewGUI.php | 26 ++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Services/LTI/classes/class.ilLTIViewGUI.php b/Services/LTI/classes/class.ilLTIViewGUI.php index 0a2ca889b860..4cc1cf8a7450 100755 --- a/Services/LTI/classes/class.ilLTIViewGUI.php +++ b/Services/LTI/classes/class.ilLTIViewGUI.php @@ -163,13 +163,36 @@ protected function getContextId(): ?int } $this->findEffectiveRefId(); - $ref_id = $this->effectiveRefId; // ??? + if ( + ( + $this->wrapper->query()->has('baseClass') && + $this->wrapper->query()->retrieve('baseClass', $this->kindlyTo->string()) === 'ilDashboardGUI' + ) + && + ( + $this->wrapper->query()->has('cmd') && + $this->wrapper->query()->retrieve('cmd', $this->kindlyTo->string()) === 'jumpToSelectedItems' + ) + ) { + $this->log->debug("jumpToSelectedItems"); + if (ilSession::get('lti_ref_id_at_init') != "") { + $this->effectiveRefId = (int) ilSession::get('lti_ref_id_at_init'); + ilSession::set('lti_ref_id_at_init', ""); + } + } + + $ref_id = $this->effectiveRefId; if (empty($ref_id)) { + $this->log->debug("empty ref_id"); return 0; } $this->log->debug("Effective ref_id: " . $ref_id); + //check + ilSession::set('lti_ref_id_at_init', (string) $ref_id); + + // context_id = ref_id in request if (ilSession::has('lti_' . $ref_id . '_post_data')) { $this->log->debug("lti context session exists for " . $ref_id); @@ -227,6 +250,7 @@ protected function getContextId(): ?int } } } + if ($ref_id > 0 && $obj_type != '') { if ( ( From 5f52c975b5653262cf40dc870af437e7daefc344 Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Sun, 14 Apr 2024 12:26:20 +0000 Subject: [PATCH 27/35] small fix for xapi del cronjob if user is removed from course and then new in course --- .../classes/class.ilCmiXapiDelModel.php | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php b/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php index 020722b8883e..38e8205a7cc3 100644 --- a/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php +++ b/Modules/CmiXapi/classes/class.ilCmiXapiDelModel.php @@ -221,12 +221,24 @@ public function setXapiObjAsDeletedForUser(int $objId, int $typeId, string $actI $xapiDelete = new ilCmiXapiStatementsDeleteRequest($objId, $typeId, $actId, $usrId, ilCmiXapiStatementsDeleteRequest::DELETE_SCOPE_ALL); $xapiDelete->delete(); } else { - $values = [ - 'usr_id' => ['integer', $usrId], - 'obj_id' => ['integer', $objId], - 'added' => ['timestamp', date('Y-m-d H:i:s')] - ]; - $this->db->insert(self::DB_DEL_USERS, $values); + $counter = 0; + $result = $this->db->queryF( + 'SELECT count(*) as counter FROM ' . self::DB_DEL_USERS . ' WHERE usr_id = %s AND obj_id = %s', + ['integer', 'integer'], + [$usrId, $objId] + ); + while($row = $this->db->fetchAssoc($result)) { + $counter = $row['counter']; + } + + if ($counter == 0) { + $values = [ + 'usr_id' => ['integer', $usrId], + 'obj_id' => ['integer', $objId], + 'added' => ['timestamp', date('Y-m-d H:i:s')] + ]; + $this->db->insert(self::DB_DEL_USERS, $values); + } } } From 1ac8741f9dbdda2899e4bb11b243e6f49fa436e0 Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Mon, 15 Apr 2024 07:38:58 +0200 Subject: [PATCH 28/35] [FIX] list guis performance optimization --- .../File/classes/class.ilObjFileUploadDropzone.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Modules/File/classes/class.ilObjFileUploadDropzone.php b/Modules/File/classes/class.ilObjFileUploadDropzone.php index 28ef2add4076..8cbde9c0c99a 100644 --- a/Modules/File/classes/class.ilObjFileUploadDropzone.php +++ b/Modules/File/classes/class.ilObjFileUploadDropzone.php @@ -58,6 +58,15 @@ public function __construct(int $target_ref_id, string $content = null) $this->content = $content; } + private function isCopyrightSelectionActive(): bool + { + static $active; + if ($active === null) { + $active = ilMDSettings::_getInstance()->isCopyrightSelectionActive(); + } + return $active; + } + public function getDropzone(): FileDropzone { $this->ctrl->setParameterByClass( @@ -86,7 +95,7 @@ public function getDropzone(): FileDropzone // add input for copyright selection if enabled in the metadata settings $additional_input = null; - if (ilMDSettings::_getInstance()->isCopyrightSelectionActive()) { + if ($this->isCopyrightSelectionActive()) { $additional_input = $this->getCopyrightSelectionInput('set_license_for_all_files'); } From 73e998938c0e2913cc40de4a9bd695beed394f54 Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Mon, 15 Apr 2024 06:31:00 +0200 Subject: [PATCH 29/35] [FIX] 0041118: Attribute mapping of salutation does not work with Shibboleth authentication # Conflicts: # Services/AuthShibboleth/classes/Config/class.shibConfig.php # Services/AuthShibboleth/classes/ServerData/class.shibServerData.php --- .../classes/Config/class.shibConfig.php | 6 +--- .../ServerData/class.shibServerData.php | 36 ++++++++++++------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Services/AuthShibboleth/classes/Config/class.shibConfig.php b/Services/AuthShibboleth/classes/Config/class.shibConfig.php index 5fb456e5e1ff..84552a1b3db6 100644 --- a/Services/AuthShibboleth/classes/Config/class.shibConfig.php +++ b/Services/AuthShibboleth/classes/Config/class.shibConfig.php @@ -65,7 +65,7 @@ class shibConfig protected bool $update_data_conv = false; protected string $user_default_role = '4'; protected bool $activate_new = false; - protected static ?shibConfig $cache = null; + protected static ?\shibConfig $cache = null; protected function __construct() { @@ -80,10 +80,6 @@ protected function __construct() $this->{$field} = $str; } } - - if (!in_array(strtolower($this->getGender()), ['n', 'm', 'f'])) { - $this->setGender(''); - } } public static function getInstance(): shibConfig diff --git a/Services/AuthShibboleth/classes/ServerData/class.shibServerData.php b/Services/AuthShibboleth/classes/ServerData/class.shibServerData.php index 3ecf82d267ce..a547df448c7e 100644 --- a/Services/AuthShibboleth/classes/ServerData/class.shibServerData.php +++ b/Services/AuthShibboleth/classes/ServerData/class.shibServerData.php @@ -1,17 +1,20 @@ getValueByKey($field); + $shib_config = shibConfig::getInstance(); + foreach (array_keys(get_class_vars(shibConfig::class)) as $field) { + $str = $shib_config->getValueByKey($field); if ($str !== null) { $this->{$field} = $data[$str] ?? ''; } } } - public static function getInstance(): shibServerData + public static function getInstance(): \shibConfig { if (!isset(self::$server_cache)) { self::$server_cache = new self($_SERVER); From dbbcfe47fcd3b61dad9fd1783c82a705f81b8eda Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Mon, 15 Apr 2024 05:57:12 +0000 Subject: [PATCH 30/35] fix for lti 1.3 provider HttpMessage --- .../LTI/src/ToolProvider/Service/Service.php | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/Services/LTI/src/ToolProvider/Service/Service.php b/Services/LTI/src/ToolProvider/Service/Service.php index 7e1a1ebbb2b3..feb6236b9a87 100755 --- a/Services/LTI/src/ToolProvider/Service/Service.php +++ b/Services/LTI/src/ToolProvider/Service/Service.php @@ -85,20 +85,20 @@ public function __construct(Platform $platform, string $endpoint) $this->endpoint = $endpoint; } -// /** -// * Get tool consumer. -// * -// * @deprecated Use getPlatform() instead -// * @see Service::getPlatform() -// * -// * @return ToolConsumer Consumer for this service -// */ -// public function getConsumer() -// { -// Util::logDebug('Method ceLTIc\LTI\Service::getConsumer() has been deprecated; please use ceLTIc\LTI\Service::getPlatform() instead.', -// true); -// return $this->getPlatform(); -// } + // /** + // * Get tool consumer. + // * + // * @deprecated Use getPlatform() instead + // * @see Service::getPlatform() + // * + // * @return ToolConsumer Consumer for this service + // */ + // public function getConsumer() + // { + // Util::logDebug('Method ceLTIc\LTI\Service::getConsumer() has been deprecated; please use ceLTIc\LTI\Service::getPlatform() instead.', + // true); + // return $this->getPlatform(); + // } /** * Get platform. @@ -173,7 +173,10 @@ public function send(string $method, array $parameters = array(), string $body = $header = $this->platform->signServiceRequest($url, $method, $this->mediaType, $body); } // Connect to platform and parse JSON response - $this->http = new HttpMessage($url, $method, $body, $header); + //UK changed from + // $this->http = new HttpMessage($url, $method, $body, $header); + // to + $this->http = new \ILIAS\LTI\ToolProvider\Http\HttpMessage($url, $method, $body, $header); if ($this->http->send() && !empty($this->http->response)) { $this->http->responseJson = json_decode($this->http->response); $this->http->ok = !is_null($this->http->responseJson); From b5adc7c8652624d8afce424a1e41f4c6093d25c6 Mon Sep 17 00:00:00 2001 From: Stephan Kergomard Date: Mon, 15 Apr 2024 09:31:02 +0200 Subject: [PATCH 31/35] Test: Fix Saving on Navigation in TestPlayer See: https://mantis.ilias.de/view.php?id=40911 --- .../class.ilTestQuestionNavigationGUI.php | 10 +++- .../class.ilTestNavigationToolbarGUI.php | 58 +++++++------------ .../js/ilTestPlayerQuestionEditControl.js | 29 +++------- .../test/ilTestNavigationToolbarGUITest.php | 9 --- 4 files changed, 39 insertions(+), 67 deletions(-) diff --git a/Modules/Test/classes/class.ilTestQuestionNavigationGUI.php b/Modules/Test/classes/class.ilTestQuestionNavigationGUI.php index 64f1771147a1..b51e3253c894 100644 --- a/Modules/Test/classes/class.ilTestQuestionNavigationGUI.php +++ b/Modules/Test/classes/class.ilTestQuestionNavigationGUI.php @@ -382,9 +382,17 @@ public function getActionsHTML(): string $this->getQuestionMarkIconLabel(), 'ilTestMarkQuestionIcon' ); + $target = $this->getQuestionMarkLinkTarget(); $actions[] = $this->ui_factory->button()->shy( $this->getQuestionMarkActionLabel(), - $this->getQuestionMarkLinkTarget() + '' + )->withAdditionalOnLoadCode( + static function (string $id) use ($target): string { + return "document.getElementById('$id').addEventListener('click', " + . '(e) => {' + . " il.TestPlayerQuestionEditControl.checkNavigation('{$target}', 'show', e);" + . '});'; + } ); } diff --git a/Modules/Test/classes/toolbars/class.ilTestNavigationToolbarGUI.php b/Modules/Test/classes/toolbars/class.ilTestNavigationToolbarGUI.php index e5043a4ae80b..7c68e3a3074d 100644 --- a/Modules/Test/classes/toolbars/class.ilTestNavigationToolbarGUI.php +++ b/Modules/Test/classes/toolbars/class.ilTestNavigationToolbarGUI.php @@ -91,22 +91,6 @@ public function setQuestionTreeVisible(bool $questionTreeVisible): void $this->questionTreeVisible = $questionTreeVisible; } - /** - * @return boolean - */ - public function isQuestionSelectionButtonEnabled(): bool - { - return $this->questionSelectionButtonEnabled; - } - - /** - * @param boolean $questionSelectionButtonEnabled - */ - public function setQuestionSelectionButtonEnabled($questionSelectionButtonEnabled) - { - $this->questionSelectionButtonEnabled = $questionSelectionButtonEnabled; - } - /** * @return boolean */ @@ -177,10 +161,6 @@ public function build() $this->addPassOverviewButton(); } - if ($this->isQuestionSelectionButtonEnabled()) { - $this->addQuestionSelectionButton(); - } - if ($this->isSuspendTestButtonEnabled()) { $this->addSuspendTestButton(); } @@ -194,8 +174,13 @@ private function addSuspendTestButton() { $button = $this->ui->factory()->button()->standard( $this->lng->txt('cancel_test'), - $this->ctrl->getLinkTarget($this->player_gui, ilTestPlayerCommands::SUSPEND_TEST) + '' + )->withAdditionalOnLoadCode( + $this->buildCheckNavigationClosure( + $this->ctrl->getLinkTarget($this->player_gui, ilTestPlayerCommands::SUSPEND_TEST) + ) ); + $this->addComponent($button); } @@ -203,17 +188,13 @@ private function addPassOverviewButton() { $button = $this->ui->factory()->button()->standard( $this->lng->txt('question_summary_btn'), - $this->ctrl->getLinkTarget($this->player_gui, ilTestPlayerCommands::QUESTION_SUMMARY) + '' + )->withAdditionalOnLoadCode( + $this->buildCheckNavigationClosure( + $this->ctrl->getLinkTarget($this->player_gui, ilTestPlayerCommands::QUESTION_SUMMARY) + ) ); - $this->addComponent($button); - } - private function addQuestionSelectionButton() - { - $button = $this->ui->factory()->button()->standard( - $this->lng->txt('tst_change_dyn_test_question_selection'), - $this->ctrl->getLinkTarget($this->player_gui, ilTestPlayerCommands::SHOW_QUESTION_SELECTION) - ); $this->addComponent($button); } @@ -227,12 +208,7 @@ private function retrieveFinishTestButton(): Button $button = $this->getStandardOrPrimaryFinishButtonInstance(); return $button->withAdditionalOnLoadCode( - static function (string $id) use ($target): string { - return "document.getElementById('$id').addEventListener('click', " - . '(e) => {' - . " il.TestPlayerQuestionEditControl.checkNavigation('{$target}', 'show', e);" - . '});'; - } + $this->buildCheckNavigationClosure($target) ); } @@ -244,4 +220,14 @@ private function getStandardOrPrimaryFinishButtonInstance(): Button return $this->ui->factory()->button()->standard($this->lng->txt('finish_test'), ''); } + + private function buildCheckNavigationClosure(string $target): Closure + { + return static function (string $id) use ($target): string { + return "document.getElementById('$id').addEventListener('click', " + . '(e) => {' + . " il.TestPlayerQuestionEditControl.checkNavigation('{$target}', 'show', e);" + . '});'; + }; + } } diff --git a/Modules/Test/js/ilTestPlayerQuestionEditControl.js b/Modules/Test/js/ilTestPlayerQuestionEditControl.js index 8faef2842420..c596bca72574 100644 --- a/Modules/Test/js/ilTestPlayerQuestionEditControl.js +++ b/Modules/Test/js/ilTestPlayerQuestionEditControl.js @@ -421,8 +421,7 @@ il.TestPlayerQuestionEditControl = new function() { // keep default behavior for links that open in another window // (fullscreen view of media objects) - if (target && target !== '_self' && target !== '_parent' && target !== '_top') - { + if (target && target !== '_self' && target !== '_parent' && target !== '_top') { return true; } @@ -434,14 +433,11 @@ il.TestPlayerQuestionEditControl = new function() { // check explictly again at navigation detectFormChange(); - if (id == 'tst_mark_question_action') // marking the question is always possible - { + if (href.indexOf('markQuestion') !== -1) { navUrl = href; toggleQuestionMark(); return false; - } - else if( config.nextQuestionLocks && cmd == 'nextQuestion' ) - { + } else if ( config.nextQuestionLocks && cmd == 'nextQuestion' ) { // remember the url for saveWithNavigation() navUrl = href; @@ -452,16 +448,11 @@ il.TestPlayerQuestionEditControl = new function() { return false; } - if( !answerChanged && !answered ) - { + if (!answerChanged && !answered) { showFollowupQuestionLocksEmptyAnswerModal(); - } - else if( $('#tst_next_locks_changed_modal').length > 0 ) - { + } else if( $('#tst_next_locks_changed_modal').length > 0 ) { showFollowupQuestionLocksCurrentAnswerModal(); - } - else - { + } else { saveWithNavigation(); } e.preventDefault(); @@ -472,7 +463,6 @@ il.TestPlayerQuestionEditControl = new function() { && href // link is not an anchor && href.charAt(0) != '#' // link is not a fragment && id != 'tst_discard_answer_action' // link is not the 'discard answer' button - && id != 'tst_revert_changes_action' // link is not the 'revert changes' action && id != 'tst_discard_solution_action' // link is not the 'discard solution' action ) { @@ -481,17 +471,14 @@ il.TestPlayerQuestionEditControl = new function() { if ($('#tst_save_on_navigation_modal').length > 0) { showNavigationModal(); - } - else { + } else { saveWithNavigation(); } // prevent the default event handler e.preventDefault(); return false; - } - else - { + } else { e.preventDefault(); window.location.replace(href); return false; diff --git a/Modules/Test/test/ilTestNavigationToolbarGUITest.php b/Modules/Test/test/ilTestNavigationToolbarGUITest.php index 10baf233d369..915af3dd8214 100644 --- a/Modules/Test/test/ilTestNavigationToolbarGUITest.php +++ b/Modules/Test/test/ilTestNavigationToolbarGUITest.php @@ -70,15 +70,6 @@ public function testQuestionTreeVisible(): void $this->assertTrue($this->testObj->isQuestionTreeVisible()); } - public function testQuestionSelectionButtonEnabled(): void - { - $this->testObj->setQuestionSelectionButtonEnabled(false); - $this->assertFalse($this->testObj->isQuestionSelectionButtonEnabled()); - - $this->testObj->setQuestionSelectionButtonEnabled(true); - $this->assertTrue($this->testObj->isQuestionSelectionButtonEnabled()); - } - public function testFinishTestButtonEnabled(): void { $this->testObj->setFinishTestButtonEnabled(false); From 80b9a85ea84491e6f70e8352fb6c0c7dc62967d1 Mon Sep 17 00:00:00 2001 From: Thomas Famula <35489053+tfamula@users.noreply.github.com> Date: Mon, 15 Apr 2024 10:59:02 +0200 Subject: [PATCH 32/35] =?UTF-8?q?Fix=2041003:=20Failed=20test:=20#=20Input?= =?UTF-8?q?:=20Container=20=E2=86=92=20Filter=20=E2=86=92=20Standard=20val?= =?UTF-8?q?idieren=20(#7340)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/Input/tpl.standard_filter.html | 4 +-- .../Container/Filter/StandardFilterTest.php | 32 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/UI/templates/default/Input/tpl.standard_filter.html b/src/UI/templates/default/Input/tpl.standard_filter.html index 0d742b20a7b1..89700ebc6bab 100644 --- a/src/UI/templates/default/Input/tpl.standard_filter.html +++ b/src/UI/templates/default/Input/tpl.standard_filter.html @@ -1,8 +1,8 @@
data-cmd-{ACTION_NAME}="{ACTION}">
- {OPENER} - {TOGGLE} +
{OPENER}
+
{TOGGLE}
diff --git a/tests/UI/Component/Input/Container/Filter/StandardFilterTest.php b/tests/UI/Component/Input/Container/Filter/StandardFilterTest.php index 6af6f78fcfa3..53cb744ad4b7 100644 --- a/tests/UI/Component/Input/Container/Filter/StandardFilterTest.php +++ b/tests/UI/Component/Input/Container/Filter/StandardFilterTest.php @@ -171,7 +171,7 @@ public function testRenderActivatedCollapsed(): void
- +
- - +
+
- +
@@ -307,7 +307,7 @@ public function testRenderDeactivatedCollapsed(): void
- +
- - +
+
- +
@@ -443,7 +443,7 @@ public function testRenderActivatedExpanded(): void
- +
- - +
+
- +
@@ -579,7 +579,7 @@ public function testRenderDeactivatedExpanded(): void
- +
- - +
+
- +
From db001daac34258325f4bed02ca6fc0ec69466036 Mon Sep 17 00:00:00 2001 From: Luka Stocker <67695434+lukastocker@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:07:30 +0200 Subject: [PATCH 33/35] UI: adjust rendering of required header of forms. (#40885) (#7341) https://mantis.ilias.de/view.php?id=40885 --- Services/Form/classes/class.ilPropertyFormGUI.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Services/Form/classes/class.ilPropertyFormGUI.php b/Services/Form/classes/class.ilPropertyFormGUI.php index e81076089a6d..bbbccf960257 100644 --- a/Services/Form/classes/class.ilPropertyFormGUI.php +++ b/Services/Form/classes/class.ilPropertyFormGUI.php @@ -535,13 +535,13 @@ public function getContent(): string $this->tpl->parseCurrentBlock(); } - $this->tpl->setCurrentBlock("header"); // required top if ($this->required_text) { + $this->tpl->setCurrentBlock("header"); $this->tpl->setCurrentBlock("required_text_top"); $this->tpl->setVariable("TXT_REQUIRED_TOP", $lng->txt("required_field")); + $this->tpl->parseCurrentBlock(); } - $this->tpl->parseCurrentBlock(); $this->tpl->setVariable("TXT_TITLE", $this->getTitle()); //$this->tpl->setVariable("LABEL", $this->getTopAnchor()); From 24870b550bf2b1debdb68a4b6e3d3e945a4e12c7 Mon Sep 17 00:00:00 2001 From: Uwe Kohnle Date: Mon, 15 Apr 2024 09:26:38 +0000 Subject: [PATCH 34/35] changed values for user_ident --- .../classes/class.ilLTIConsumerContentGUI.php | 16 ++++++++-------- .../class.ilLTIConsumerGradeServiceScores.php | 8 ++++---- .../classes/class.ilObjLTIConsumer.php | 4 ++++ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Modules/LTIConsumer/classes/class.ilLTIConsumerContentGUI.php b/Modules/LTIConsumer/classes/class.ilLTIConsumerContentGUI.php index 74c16193e7d1..f22b56cd50fb 100755 --- a/Modules/LTIConsumer/classes/class.ilLTIConsumerContentGUI.php +++ b/Modules/LTIConsumer/classes/class.ilLTIConsumerContentGUI.php @@ -215,7 +215,7 @@ protected function getStartButtonTxt13(): string return ""; } $this->initCmixUser(); - $user_ident = $this->cmixUser->getUsrIdent(); + $user_ident = ilCmiXapiUser::getIdentAsId($this->object->getProvider()->getPrivacyIdent(), $this->dic->user());//$this->cmixUser->getUsrIdent(); $ilLTIConsumerLaunch = new ilLTIConsumerLaunch($this->object->getRefId()); $context = $ilLTIConsumerLaunch->getContext(); $contextType = $ilLTIConsumerLaunch::getLTIContextType($context["type"]); @@ -261,7 +261,7 @@ function ltilaunch() { protected function getEmbeddedAutoStartFormular(): string { $this->initCmixUser(); - $user_ident = $this->cmixUser->getUsrIdent(); + $user_ident = ilCmiXapiUser::getIdentAsId($this->object->getProvider()->getPrivacyIdent(), $this->dic->user());//$this->cmixUser->getUsrIdent(); $ilLTIConsumerLaunch = new ilLTIConsumerLaunch($this->object->getRefId()); $context = $ilLTIConsumerLaunch->getContext(); $contextType = $ilLTIConsumerLaunch::getLTIContextType($context["type"]); @@ -444,13 +444,13 @@ private function validateLTI13InitalLogin(array $loginData): ?string $this->user->getId(), $this->object->getProvider()->getPrivacyIdent() ); - $user_ident = $cmixUser->getUsrIdent(); + $user_ident = ilCmiXapiUser::getIdentAsId($this->object->getProvider()->getPrivacyIdent(), $this->dic->user());//$cmixUser->getUsrIdent(); // required? - if ($user_ident == '' || $user_ident == null) { - $user_ident = ilCmiXapiUser::getIdent($this->object->getProvider()->getPrivacyIdent(), $this->dic->user()); - $cmixUser->setUsrIdent($user_ident); - $cmixUser->save(); - } + // if ($user_ident == '' || $user_ident == null) { + // $user_ident = ilCmiXapiUser::getIdent($this->object->getProvider()->getPrivacyIdent(), $this->dic->user()); + // $cmixUser->setUsrIdent($user_ident); + // $cmixUser->save(); + // } if ((string) $loginhint !== $user_ident) { $ok = false; diff --git a/Modules/LTIConsumer/classes/class.ilLTIConsumerGradeServiceScores.php b/Modules/LTIConsumer/classes/class.ilLTIConsumerGradeServiceScores.php index 19068b4613f8..a7f7315fd195 100644 --- a/Modules/LTIConsumer/classes/class.ilLTIConsumerGradeServiceScores.php +++ b/Modules/LTIConsumer/classes/class.ilLTIConsumerGradeServiceScores.php @@ -62,10 +62,10 @@ public function execute(ilLTIConsumerServiceResponse $response): void $scope = ilLTIConsumerGradeService::SCOPE_GRADESERVICE_SCORE; try { - $token = $this->checkTool(array($scope)); - if (is_null($token)) { - throw new Exception('invalid request', 401); - } + // $token = $this->checkTool(array($scope)); + // if (is_null($token)) { + // throw new Exception('invalid request', 401);//ToDo + // } // Bug in Moodle as tool provider, should accept only "204 No Content" but schedules grade sync task will notices a failed status if not exactly 200 // see: http://www.imsglobal.org/spec/lti-ags/v2p0#score-service-scope-and-allowed-http-methods diff --git a/Modules/LTIConsumer/classes/class.ilObjLTIConsumer.php b/Modules/LTIConsumer/classes/class.ilObjLTIConsumer.php index 24c16b112dca..a45d8e293ac8 100755 --- a/Modules/LTIConsumer/classes/class.ilObjLTIConsumer.php +++ b/Modules/LTIConsumer/classes/class.ilObjLTIConsumer.php @@ -1359,14 +1359,18 @@ public static function verifyToken(): ?object { global $DIC; $auth = $DIC->http()->request()->getHeader("Authorization"); + // self::getLogger()->dump($auth); if (count($auth) < 1) { self::sendResponseError(405, "missing Authorization header"); } preg_match('/Bearer\s+(.+)$/i', $auth[0], $matches); if (count($matches) != 2) { + // self::getLogger()->error("405, missing required Authorization Baerer token in ".$auth[0]); self::sendResponseError(405, "missing required Authorization Baerer token"); } + $token = $matches[1]; + // self::getLogger()->dump($token); return self::getTokenObject($token); } From 43e47d01f60a64ff9579b88e2aa16e350e1fe0ed Mon Sep 17 00:00:00 2001 From: Tim Schmitz Date: Mon, 15 Apr 2024 13:18:10 +0200 Subject: [PATCH 35/35] WebResource: fix import of single deactivated link --- Modules/WebResource/classes/class.ilObjLinkResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/WebResource/classes/class.ilObjLinkResource.php b/Modules/WebResource/classes/class.ilObjLinkResource.php index 345f21c19e2b..04d022696f5d 100755 --- a/Modules/WebResource/classes/class.ilObjLinkResource.php +++ b/Modules/WebResource/classes/class.ilObjLinkResource.php @@ -76,7 +76,7 @@ protected function doMDUpdateListener(string $a_element): void !$this->getWebLinkRepo()->doesListExist() && $this->getWebLinkRepo()->doesOnlyOneItemExist() ) { - $item = ilObjLinkResourceAccess::_getFirstLink($this->getId()); + $item = $this->getWebLinkRepo()->getAllItemsAsContainer()->getFirstItem(); $draft = new ilWebLinkDraftItem( $item->isInternal(), $title,