19declare(strict_types=1);
104 public function __construct(
int $a_id = 0,
bool $a_reference =
true)
166 return $this->mastery_score * 100;
171 $this->mastery_score = $mastery_score_percent / 100;
251 if ($this->
getProvider()->isProviderKeyCustomizable()) {
260 if ($this->
getProvider()->isProviderKeyCustomizable()) {
289 if (strlen($this->
getProvider()->getXapiActivityId())) {
322 $paramsAsArray[
$param[0]] = $value;
326 return $paramsAsArray;
345 $paramsAsArray[
$param[0]] = $value;
349 return $paramsAsArray;
362 $query =
"SELECT * FROM {$this->dbTableName()} WHERE obj_id = %s";
363 $res =
$DIC->database()->queryF($query, [
'integer'], [$this->
getId()]);
365 while ($row =
$DIC->database()->fetchAssoc(
$res)) {
405 'obj_id' => [
'integer', $this->
getId()]
412 'use_xapi' => [
'integer', $this->
getUseXapi()],
430 if ($this->ref_id > 0) {
432 switch ($activation[
"timing_type"]) {
435 if (!is_null($activation[
"timing_start"])) {
436 $activation[
"timing_start"] = (
int) $activation[
"timing_start"];
439 if (!is_null($activation[
"timing_end"])) {
440 $activation[
"timing_end"] = (
int) $activation[
"timing_end"];
455 if ($this->ref_id > 0) {
468 $item->update($this->ref_id);
485 $this->_highscore_enabled = $a_enabled;
503 $this->_highscore_achieved_ts = $a_achieved_ts;
521 $this->_highscore_percentage = $a_percentage;
539 $this->_highscore_wtime = $a_wtime;
559 $this->_highscore_own_table = $a_own_table;
577 $this->_highscore_top_table = $a_top_table;
598 $this->_highscore_top_num = $a_top_num;
612 if ($this->_highscore_top_num != 0) {
666 string $contextTitle,
667 ?
string $returnUrl =
''
673 $roles =
$DIC->access()->checkAccess(
'write',
'', $this->
getRefId()) ?
"Instructor" :
"Learner";
677 if ($this->
getProvider()->getAlwaysLearner() ==
true) {
681 $resource_link_id = $this->
getRefId();
682 if ($this->
getProvider()->getUseProviderId() ==
true) {
683 $resource_link_id =
'p' . $this->
getProvider()->getId();
687 if ($this->
getProvider()->getIncludeUserPicture()) {
691 $documentTarget =
"window";
693 $documentTarget =
"iframe";
701 $nameGiven =
$DIC->user()->getFirstname();
702 $nameFull =
$DIC->user()->getFirstname();
705 $usrName =
$DIC->user()->getUTitle() ?
$DIC->user()->getUTitle() .
' ' :
'';
706 $usrName .=
$DIC->user()->getLastname();
707 $nameFamily = $usrName;
708 $nameFull = $usrName;
711 $nameGiven =
$DIC->user()->getFirstname();
712 $nameFamily =
$DIC->user()->getLastname();
713 $nameFull =
$DIC->user()->getFullname();
729 $merged_params = array_merge($provider_custom_params, $custom_params);
731 $toolConsumerInstanceGuid =
CLIENT_ID .
".";
732 $parseIliasUrl = parse_url(self::getIliasHttpPath());
733 if (array_key_exists(
"path", $parseIliasUrl)) {
734 $toolConsumerInstanceGuid .= implode(
".", array_reverse(explode(
"/", $parseIliasUrl[
"path"])));
736 $toolConsumerInstanceGuid .= $parseIliasUrl[
"host"];
739 "lti_message_type" =>
"basic-lti-launch-request",
740 "lti_version" =>
"LTI-1p0",
741 "resource_link_id" => $resource_link_id,
742 "resource_link_title" => $this->
getTitle(),
744 "user_id" => $userIdLTI,
745 "user_image" => $usrImage,
747 "lis_person_name_given" => $nameGiven,
748 "lis_person_name_family" => $nameFamily,
749 "lis_person_name_full" => $nameFull,
750 "lis_person_contact_email_primary" => $emailPrimary,
751 "context_id" => $contextId,
752 "context_type" => $contextType,
753 "context_title" => $contextTitle,
754 "context_label" => $contextType .
" " . $contextId,
755 "launch_presentation_locale" => $this->
lng->getLangKey(),
756 "launch_presentation_document_target" => $documentTarget,
761 "launch_presentation_return_url" => $returnUrl,
762 "tool_consumer_instance_guid" => $toolConsumerInstanceGuid,
763 "tool_consumer_instance_name" =>
$DIC->settings()->get(
"short_inst_name") ?
$DIC->settings()->get(
766 "tool_consumer_instance_description" => ilObjSystemFolder::_getHeaderTitle(),
767 "tool_consumer_instance_url" => ilLink::_getLink(
ROOT_FOLDER_ID,
"root"),
769 "tool_consumer_instance_contact_email" =>
$DIC->settings()->get(
"admin_email"),
770 "launch_presentation_css_url" =>
"",
771 "tool_consumer_info_product_family_code" =>
"ilias",
773 "lis_result_sourcedid" =>
$token,
775 ) .
"/ltiresult.php?client_id=" .
CLIENT_ID,
776 "role_scope_mentor" =>
""
783 "callback" =>
"about:blank",
784 "http_method" =>
"POST",
785 "sign_method" =>
"HMAC_SHA1",
787 "data" => ($launch_vars + $merged_params)
806 string $contextTitle,
807 ?
string $returnUrl =
''
811 $roles = $this->determineLTIRole(
$DIC->user()->getId(), $this->getRefId(),
$DIC->rbac()->review());
813 if ($this->getProvider()->getAlwaysLearner() ==
true) {
819 $resource_link_id = $this->getRefId();
820 if ($this->getProvider()->getUseProviderId() ==
true) {
821 $resource_link_id =
'p' . $this->getProvider()->getId();
825 if ($this->getProvider()->getIncludeUserPicture()) {
826 $usrImage = self::getIliasHttpPath() .
"/" .
$DIC->user()->getPersonalPicturePath(
"small");
829 $documentTarget =
"window";
830 if ($this->getLaunchMethod() == self::LAUNCH_METHOD_EMBEDDED) {
831 $documentTarget =
"iframe";
837 switch ($this->getProvider()->getPrivacyName()) {
839 $nameGiven =
$DIC->user()->getFirstname();
840 $nameFull =
$DIC->user()->getFirstname();
843 $usrName =
$DIC->user()->getUTitle() ?
$DIC->user()->getUTitle() .
' ' :
'';
844 $usrName .=
$DIC->user()->getLastname();
845 $nameFamily = $usrName;
846 $nameFull = $usrName;
849 $nameGiven =
$DIC->user()->getFirstname();
850 $nameFamily =
$DIC->user()->getLastname();
851 $nameFull =
$DIC->user()->getFullname();
861 $toolConsumerInstanceGuid =
CLIENT_ID .
".";
862 $parseIliasUrl = parse_url(self::getIliasHttpPath());
863 if (array_key_exists(
"path", $parseIliasUrl)) {
864 $toolConsumerInstanceGuid .= implode(
".", array_reverse(explode(
"/", $parseIliasUrl[
"path"])));
866 $toolConsumerInstanceGuid .= $parseIliasUrl[
"host"];
868 "lti_message_type" =>
"basic-lti-launch-request",
869 "lti_version" =>
"1.3.0",
870 "resource_link_id" => (string) $resource_link_id,
871 "resource_link_title" => $this->
getTitle(),
872 "resource_link_description" => $this->getDescription(),
873 "user_id" => (string) $userIdLTI,
874 "user_image" => $usrImage,
876 "lis_person_name_given" => $nameGiven,
877 "lis_person_name_family" => $nameFamily,
878 "lis_person_name_full" => $nameFull,
879 "lis_person_contact_email_primary" => $emailPrimary,
880 "context_id" => $contextId,
881 "context_type" => $contextType,
882 "context_title" => $contextTitle,
883 "context_label" => $contextType .
" " . $contextId,
884 "launch_presentation_locale" => $this->
lng->getLangKey(),
885 "launch_presentation_document_target" => $documentTarget,
890 "launch_presentation_return_url" => $returnUrl,
891 "tool_consumer_instance_guid" => $toolConsumerInstanceGuid,
892 "tool_consumer_instance_name" =>
$DIC->settings()->get(
"short_inst_name") ?
$DIC->settings()->get(
895 "tool_consumer_instance_description" => ilObjSystemFolder::_getHeaderTitle(),
896 "tool_consumer_instance_url" => ilLink::_getLink(
ROOT_FOLDER_ID,
"root"),
898 "tool_consumer_instance_contact_email" =>
$DIC->settings()->get(
"admin_email"),
899 "launch_presentation_css_url" =>
"",
900 "tool_consumer_info_product_family_code" =>
"ilias",
902 "lis_result_sourcedid" =>
$token,
903 "lis_outcome_service_url" => self::getIliasHttpPath(
904 ) .
"/ltiresult.php?client_id=" .
CLIENT_ID,
905 "role_scope_mentor" =>
""
908 $provider_custom_params = self::getProviderCustomParamsArray($this->getProvider());
909 $custom_params = $this->getCustomParamsArray();
910 $merged_params = array_merge($provider_custom_params, $custom_params);
911 foreach ($merged_params as $key => $value) {
912 $launch_vars[
'custom_' . $key] = $value;
915 if ($this->getProvider()->isGradeSynchronization()) {
917 $launch_vars[
'custom_lineitem_url'] = self::getIliasHttpPath(
918 ) .
"/ltiservices.php/gradeservice/" . $contextId .
"/lineitems/" . $this->
id .
"/lineitem";
922 $launch_vars[
'custom_lineitems_url'] = self::getIliasHttpPath(
923 ) .
"/ltiservices.php/gradeservice/" . $contextId .
"/linetitems/";
925 $launch_vars[
'custom_ags_scopes'] = implode(
",", $gradeservice->getPermittedScopes());
928 if (!empty(self::verifyPrivateKey())) {
929 $DIC->ui()->mainTemplate()->setOnScreenMessage(
'failure',
'ERROR_OPEN_SSL_CONF',
true);
932 return self::LTISignJWT($launch_vars, $endpoint,
$clientId, $deploymentId, $nonce);
952 $context = $ilLTIConsumerLaunch->getContext();
953 $contextType = $ilLTIConsumerLaunch::getLTIContextType(
$context[
"type"]);
957 $roles =
"Instructor";
959 if (
$provider->getIncludeUserPicture()) {
960 $usrImage = self::getIliasHttpPath() .
"/" .
$DIC->user()->getPersonalPicturePath(
"small");
962 $documentTarget =
"window";
963 if (
$provider->getLaunchMethod() == self::LAUNCH_METHOD_EMBEDDED) {
964 $documentTarget =
"iframe";
971 $nameGiven =
$DIC->user()->getFirstname();
972 $nameFull =
$DIC->user()->getFirstname();
975 $usrName =
$DIC->user()->getUTitle() ?
$DIC->user()->getUTitle() .
' ' :
'';
976 $usrName .=
$DIC->user()->getLastname();
977 $nameFamily = $usrName;
978 $nameFull = $usrName;
981 $nameGiven =
$DIC->user()->getFirstname();
982 $nameFamily =
$DIC->user()->getLastname();
983 $nameFull =
$DIC->user()->getFullname();
989 $toolConsumerInstanceGuid =
CLIENT_ID .
".";
990 $parseIliasUrl = parse_url(self::getIliasHttpPath());
991 if (array_key_exists(
"path", $parseIliasUrl)) {
992 $toolConsumerInstanceGuid .= implode(
".", array_reverse(explode(
"/", $parseIliasUrl[
"path"])));
994 $toolConsumerInstanceGuid .= $parseIliasUrl[
"host"];
996 $content_select_vars = [
997 "lti_message_type" =>
"ContentItemSelectionRequest",
998 "lti_version" =>
"1.3.0",
999 "user_id" => (string) $userIdLTI,
1000 "user_image" => $usrImage,
1002 "lis_person_name_given" => $nameGiven,
1003 "lis_person_name_family" => $nameFamily,
1004 "lis_person_name_full" => $nameFull,
1005 "lis_person_contact_email_primary" => $emailPrimary,
1006 "context_id" => (
string) $contextId,
1007 "context_type" => $contextType,
1008 "context_title" => $contextTitle,
1009 "context_label" => $contextType .
" " . $contextId,
1010 "launch_presentation_locale" =>
$DIC->language()->getLangKey(),
1011 "launch_presentation_document_target" => $documentTarget,
1012 "launch_presentation_width" =>
"",
1014 "launch_presentation_height" =>
"",
1016 "tool_consumer_instance_guid" => $toolConsumerInstanceGuid,
1017 "tool_consumer_instance_name" =>
$DIC->settings()->get(
"short_inst_name") ?
$DIC->settings()->get(
1020 "tool_consumer_instance_description" => ilObjSystemFolder::_getHeaderTitle(),
1021 "tool_consumer_instance_url" => ilLink::_getLink(
ROOT_FOLDER_ID,
"root"),
1023 "tool_consumer_instance_contact_email" =>
$DIC->settings()->get(
"admin_email"),
1024 "tool_consumer_info_product_family_code" =>
"ilias",
1026 "content_item_return_url" => $returnUrl,
1027 "accept_types" =>
"ltiResourceLink",
1028 "accept_presentation_document_targets" =>
"iframe,window,embed",
1029 "accept_multiple" =>
true,
1030 "auto_create" =>
true,
1032 $provider_custom_params = self::getProviderCustomParamsArray(
$provider);
1033 foreach ($provider_custom_params as $key => $value) {
1034 $content_select_vars[
'custom_' . $key] = $value;
1037 if (!empty(self::verifyPrivateKey())) {
1038 $DIC->ui()->mainTemplate()->setOnScreenMessage(
'failure',
'ERROR_OPEN_SSL_CONF',
true);
1041 return self::LTISignJWT($content_select_vars,
'',
$clientId, $deploymentId, $nonce);
1047 string $oAuthConsumerKey,
1054 $messageTypeMapping = Util::MESSAGE_TYPE_MAPPING;
1055 if (isset($parms[
'lti_message_type']) && array_key_exists($parms[
'lti_message_type'], $messageTypeMapping)) {
1056 $parms[
'lti_message_type'] = $messageTypeMapping[$parms[
'lti_message_type']];
1058 if (isset($parms[
'roles'])) {
1059 $roles = explode(
',', $parms[
'roles']);
1060 $newRoles = array();
1061 foreach ($roles as $role) {
1062 if (strpos($role,
'urn:lti:role:ims/lis/') === 0) {
1063 $role =
'http://purl.imsglobal.org/vocab/lis/v2/membership#' . substr($role, 21);
1064 } elseif (strpos($role,
'urn:lti:instrole:ims/lis/') === 0) {
1065 $role =
'http://purl.imsglobal.org/vocab/lis/v2/institution/person#' . substr($role, 25);
1066 } elseif (strpos($role,
'urn:lti:sysrole:ims/lis/') === 0) {
1067 $role =
'http://purl.imsglobal.org/vocab/lis/v2/system/person#' . substr($role, 24);
1068 } elseif ((strpos($role,
'://') ===
false) && (strpos($role,
'urn:') !== 0)) {
1069 $role =
"http://purl.imsglobal.org/vocab/lis/v2/membership#{$role}";
1071 $newRoles[] = $role;
1073 $parms[
'roles'] = implode(
',', $newRoles);
1076 if (empty($nonce)) {
1077 $nonce = bin2hex(openssl_random_pseudo_bytes(10));
1079 $claimMapping = Util::JWT_CLAIM_MAPPING;
1085 $payLoad[
'iss'] = self::getIliasHttpPath();
1086 $payLoad[
'aud'] = $oAuthConsumerKey;
1087 $payLoad[self::LTI_JWT_CLAIM_PREFIX .
'/claim/deployment_id'] = strval(
$typeId);
1088 if (!empty($endpoint)) {
1089 $payLoad[self::LTI_JWT_CLAIM_PREFIX .
'/claim/target_link_uri'] = $endpoint;
1092 foreach ($parms as $key => $value) {
1093 $claim = self::LTI_JWT_CLAIM_PREFIX;
1094 if (array_key_exists($key, $claimMapping)) {
1095 $mapping = $claimMapping[$key];
1097 if (isset($mapping[
'isArray']) && $mapping[
'isArray']) {
1098 $value = explode(
',', $value);
1100 } elseif (isset($mapping[
'isBoolean'])) {
1101 $value = $mapping[
'isBoolean'];
1103 if (!empty($mapping[
'suffix'])) {
1104 $claim .=
"-{$mapping['suffix']}";
1106 $claim .=
'/claim/';
1107 if (is_null($mapping[
'group'])) {
1108 $payLoad[$mapping[
'claim']] = $value;
1109 } elseif (empty($mapping[
'group'])) {
1110 $payLoad[
"{$claim}{$mapping['claim']}"] = $value;
1112 $claim .= $mapping[
'group'];
1113 $payLoad[$claim][$mapping[
'claim']] = $value;
1115 } elseif (strpos($key,
'custom_') === 0) {
1116 $payLoad[
"{$claim}/claim/custom"][substr($key, 7)] = $value;
1117 } elseif (strpos($key,
'ext_') === 0) {
1118 $payLoad[
"{$claim}/claim/ext"][substr($key, 4)] = $value;
1122 if (!empty(self::verifyPrivateKey())) {
1123 throw new DomainException(self::ERROR_OPEN_SSL_CONF);
1127 $newParms = array();
1128 $newParms[
'id_token'] = $jwt;
1135 $err = self::verifyPrivateKey();
1139 $privatekey =
$ilSetting->get(self::LTI_1_3_PRIVATE_KEY);
1142 "key" => $privatekey,
1150 $key =
$ilSetting->get(self::LTI_1_3_PRIVATE_KEY);
1153 $kid = bin2hex(openssl_random_pseudo_bytes(10));
1156 "digest_alg" =>
"sha256",
1157 "private_key_bits" => 2048,
1158 "private_key_type" => self::OPENSSL_KEYTYPE_RSA
1160 $res = openssl_pkey_new($config);
1161 openssl_pkey_export(
$res, $privatekey);
1162 if (!empty($privatekey)) {
1163 $ilSetting->set(self::LTI_1_3_PRIVATE_KEY, $privatekey);
1165 return self::ERROR_OPEN_SSL_CONF;
1176 if (
$res !==
false) {
1177 $details = openssl_pkey_get_details(
$res);
1178 $publicKey = $details[
'key'];
1185 $jwks = [
'keys' => []];
1187 $privatekey = self::getPrivateKey();
1188 $res = openssl_pkey_get_private($privatekey[
'key']);
1189 $details = openssl_pkey_get_details(
$res);
1192 $jwk[
'kty'] =
'RSA';
1193 $jwk[
'alg'] =
'RS256';
1194 $jwk[
'kid'] = $privatekey[
'kid'];
1195 $jwk[
'e'] = rtrim(strtr(base64_encode($details[
'rsa'][
'e']),
'+/',
'-_'),
'=');
1196 $jwk[
'n'] = rtrim(strtr(base64_encode($details[
'rsa'][
'n']),
'+/',
'-_'),
'=');
1197 $jwk[
'use'] =
'sig';
1199 $jwks[
'keys'][] = $jwk;
1207 $logger =
$DIC->logger()->root();
1209 if (
$DIC[
'https']->isDetected()) {
1210 $protocol =
'https://';
1212 $protocol =
'http://';
1216 $rq_uri = strip_tags(
$_SERVER[
'REQUEST_URI']);
1220 if (is_int($pos = strpos($rq_uri,
"?"))) {
1221 $rq_uri = substr($rq_uri, 0, $pos);
1224 $path = pathinfo($rq_uri);
1225 if (isset(
$path[
'extension']) &&
$path[
'extension'] !==
'') {
1226 $uri = dirname($rq_uri);
1230 $logger->info(
"URI --- 1: " . $uri);
1231 $uri = str_replace(
"components/ILIAS/LTIConsumer",
"", $uri);
1232 $logger->info(
"URI --- 2: " . $uri);
1234 $f = new \ILIAS\Data\Factory();
1235 $uri =
$f->uri(rtrim($iliasHttpPath,
"/"));
1236 return $uri->getBaseURI();
1241 return self::getIliasHttpPath();
1246 return self::getIliasHttpPath() .
"/ltiauth.php";
1251 return self::getIliasHttpPath() .
"/ltitoken.php";
1256 return self::getIliasHttpPath() .
"/lticerts.php";
1261 return self::getIliasHttpPath() .
"/ltiregistration.php";
1266 return self::getIliasHttpPath() .
"/ltiregstart.php";
1271 return self::getIliasHttpPath() .
"/ltiregend.php";
1276 return self::getIliasHttpPath() .
"/lticonfig.php";
1281 $scopesSupported = array(
'openid');
1283 $scopesSupported = array_merge($scopesSupported, $gradeservice->getPermittedScopes());
1285 "issuer" => self::getPlattformId(),
1286 "authorization_endpoint" => self::getAuthenticationRequestUrl(),
1287 "token_endpoint" => self::getAccessTokenUrl(),
1288 "token_endpoint_auth_methods_supported" => [
"private_key_jwt"],
1289 "token_endpoint_auth_signing_alg_values_supported" => [
"RS256"],
1290 "jwks_uri" => self::getPublicKeysetUrl(),
1291 "registration_endpoint" => self::getRegistrationUrl(),
1292 "scopes_supported" => $scopesSupported,
1293 "response_types_supported" => [
"id_token"],
1294 "subject_types_supported" => [
"public",
"pairwise"],
1295 "id_token_signing_alg_values_supported" => [
"RS256"],
1296 "claims_supported" => [
"iss",
"aud"],
1297 "https://purl.imsglobal.org/spec/lti-platform-configuration" => [
1298 "product_family_code" =>
"ilias.de",
1300 "messages_supported" => [
1302 "type" =>
"LtiResourceLinkRequest",
1307 "type" =>
"LtiDeepLinkingRequest",
1321 $reponseData =
$data;
1323 $toolConfig =
$data[
'https://purl.imsglobal.org/spec/lti-tool-configuration'];
1324 $provider->setTitle(strip_tags(
$data[
'client_name'], ilObjectGUI::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION));
1325 $provider->setProviderUrl($toolConfig[
'target_link_uri']);
1327 $provider->setRedirectionUris(implode(
",",
$data[
'redirect_uris']));
1328 if (isset(
$data[
'jwks_uri'])) {
1331 foreach ($toolConfig[
'messages'] as
$message) {
1332 if (isset(
$message[
'type']) &&
$message[
'type'] ===
'LtiDeepLinkingRequest') {
1343 $provider->setClientId((
string) $tokenObj->aud);
1344 $provider->setCreator((
int) $tokenObj->sub);
1348 $reponseData[
'client_id'] = $tokenObj->aud;
1349 $reponseData[
'https://purl.imsglobal.org/spec/lti-tool-configuration'][
'deployment_id'] =
$provider->getId();
1350 return $reponseData;
1355 return Util::getRandomString(15);
1363 self::getLogger()->error(
"$code $message");
1365 $DIC->http()->saveResponse(
1366 $DIC->http()->response()
1368 ->withBody(Streams::ofString(
$message))
1370 $DIC->http()->sendResponse();
1371 $DIC->http()->close();
1372 }
catch (Exception
$e) {
1373 $DIC->http()->close();
1381 header(
'Content-Type: application/json; charset=utf-8');
1382 header(
'Cache-Control: no-store');
1383 header(
'Pragma: no-cache');
1384 echo json_encode($obj, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
1385 }
catch (Exception
$e) {
1386 self::sendResponseError(500,
"error in sendResponseJson");
1387 $DIC->http()->close();
1393 return new self($a_id, $a_reference);
1403 return file_get_contents(
'php://input');
1409 $keys = JWK::parseKeySet(self::getJwks());
1410 return JWT::decode(
$token, $keys);
1411 }
catch (Exception
$e) {
1419 $auth =
$DIC->http()->request()->getHeader(
"Authorization");
1420 if (count($auth) < 1) {
1421 self::sendResponseError(405,
"missing Authorization header");
1423 preg_match(
'/Bearer\s+(.+)$/i', $auth[0], $matches);
1424 if (count($matches) != 2) {
1425 self::sendResponseError(405,
"missing required Authorization Baerer token");
1428 return self::getTokenObject(
$token);
1439 $new_obj->setProviderId($this->getProviderId());
1440 $new_obj->setLaunchMethod($this->getLaunchMethod());
1441 $new_obj->setCustomLaunchKey($this->getCustomLaunchKey());
1442 $new_obj->setCustomLaunchSecret($this->getCustomLaunchSecret());
1443 $new_obj->setCustomParams($this->getCustomParams());
1444 $new_obj->setUseXapi($this->getUseXapi());
1445 $new_obj->setCustomActivityId($this->getCustomActivityId());
1446 $new_obj->setStatementsReportEnabled($this->isStatementsReportEnabled());
1447 $new_obj->setMasteryScore($this->getMasteryScore());
1450 $new_obj->setHighscoreEnabled($this->getHighscoreEnabled());
1451 $new_obj->setHighscoreAchievedTS($this->getHighscoreAchievedTS());
1452 $new_obj->setHighscorePercentage($this->getHighscorePercentage());
1453 $new_obj->setHighscoreWTime($this->getHighscoreWTime());
1454 $new_obj->setHighscoreOwnTable($this->getHighscoreOwnTable());
1455 $new_obj->setHighscoreTopTable($this->getHighscoreTopTable());
1456 $new_obj->setHighscoreTopNum($this->getHighscoreTopNum());
1459 $new_obj->setActivationLimited($this->isActivationLimited());
1460 $new_obj->setActivationStartingTime($this->getActivationStartingTime());
1461 $new_obj->setActivationEndingTime($this->getActivationEndingTime());
1463 if ($this->isActivationLimited() && $this->getActivationVisibility() !==
null) {
1464 $new_obj->setActivationVisibility($this->getActivationVisibility());
1476 return 'Administrator';
1479 $user_assigned_roles = $rbac_review_instance->
assignedRoles($a_user_id);
1480 $parent_roles_data = $rbac_review_instance->
getParentRoleIds($a_ref_id,
true);
1481 $roles_in_path_ids = array_keys($parent_roles_data);
1482 $effective_roles_in_context = array_intersect($user_assigned_roles, $roles_in_path_ids);
1484 if (!empty($effective_roles_in_context)) {
1485 $parent_ref_id =
$DIC->repositoryTree()->getParentId($a_ref_id);
1488 $instructor_base_titles = [
1489 'il_' . $context_obj_type .
'_admin',
1490 'il_' . $context_obj_type .
'_tutor'
1493 foreach ($effective_roles_in_context as $role_id) {
1496 foreach ($instructor_base_titles as $base_title) {
1497 if (str_starts_with((
string) $role_title, $base_title)) {
1498 return 'Instructor';
Stream factory which enables the user to create streams without the knowledge of the concrete class.
static getIdent(int $userIdentMode, ilObjUser $user)
static getIdentAsId(int $userIdentMode, ilObjUser $user)
static modifyHttpPath(string $httpPath)
const PRIVACY_NAME_FULLNAME
const AVAILABILITY_CREATE
const PRIVACY_NAME_FIRSTNAME
const PRIVACY_NAME_LASTNAME
static signOAuth(array $a_params)
sign request data with OAuth
static getByKeys(int $a_obj_id, int $a_usr_id, ?bool $a_create=false)
Get a result by object and user key.
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
const PRIVACY_IDENT_IL_UUID_RANDOM
bool $activationLimited
repository object activation settings (handled by ilObject)
static getIliasHttpPath()
static sendResponseError(int $code, string $message, $log=true)
isStatementsReportEnabled()
doCloneObject(ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
static getAccessTokenUrl()
const LTI_1_3_PRIVATE_KEY
setCustomLaunchSecret(string $customLaunchSecret)
const HIGHSCORE_SHOW_TOP_TABLE
buildLaunchParametersLTI13(ilCmiXapiUser $cmixUser, string $token, string $endpoint, string $clientId, int $deploymentId, string $nonce, string $contextType, string $contextId, string $contextTitle, ?string $returnUrl='')
getHighscoreEnabled()
Gets the setting which determines if the highscore feature is enabled.
const REG_TOKEN_OP_NEW_REG
getHighscoreTopTable()
Gets, if the top-rankings table should be shown.
setHighscoreMode(int $mode)
string $customLaunchSecret
int $activationEndingTime
bool $activationVisibility
setProvider(ilLTIConsumeProvider $provider)
setHighscorePercentage(bool $a_percentage)
Sets if the percentages of the scores pass should be shown.
setCustomParams(string $customParams)
static getRegistrationUrl()
static getTokenObject(string $token)
setHighscoreEnabled(bool $a_enabled)
HIGHSCORE.
const LAUNCH_METHOD_EMBEDDED
setHighscoreAchievedTS(bool $a_achieved_ts)
Sets if the date and time of the scores achievement should be displayed.
setHighscoreOwnTable(bool $a_own_table)
Sets if the table with the own ranking should be shown.
bool $_highscore_top_table
const OPENSSL_KEYTYPE_RSA
getActivationVisibility()
setLaunchMethod(string $launchMethod)
const HIGHSCORE_SHOW_OWN_TABLE
getHighscoreOwnTable()
Gets if the own rankings table should be shown.
static getInstance(int $a_id=0, bool $a_reference=true)
int $activationStartingTime
getHighscorePercentage()
Gets if the percentage column should be shown.
saveRepositoryActivationSettings()
static verifyPrivateKey()
setActivationEndingTime(?int $activationEndingTime=null)
buildLaunchParameters(ilCmiXapiUser $cmixUser, string $token, string $contextType, string $contextId, string $contextTitle, ?string $returnUrl='')
const LAUNCH_METHOD_NEW_WIN
setActivationLimited(bool $activationLimited)
getActivationEndingTime()
setStatementsReportEnabled(bool $statementsReportEnabled)
setMasteryScorePercent(float $mastery_score_percent)
static getOpenidConfigUrl()
static LTISignJWT(array $parms, string $endpoint, string $oAuthConsumerKey, $typeId=0, string $nonce='')
static buildContentSelectionParameters(ilLTIConsumeProvider $provider, int $refId, string $returnUrl, string $nonce)
const HIGHSCORE_SHOW_ALL_TABLES
setHighscoreTopNum(int $a_top_num)
Sets the number of entries which are to be shown in the top-rankings table.
const REG_TOKEN_OP_UPDATE_REG
const LTI_JWT_CLAIM_PREFIX
ilLTIConsumeProvider $provider
static registerClient(array $data, object $tokenObj)
loadRepositoryActivationSettings()
setHighscoreWTime(bool $a_wtime)
Sets if the workingtime of the scores should be shown.
getActivationStartingTime()
bool $statementsReportEnabled
setCustomLaunchKey(string $customLaunchKey)
setProviderId(int $providerId)
bool $_highscore_achieved_ts
static getProviderCustomParamsArray(ilLTIConsumeProvider $provider)
string $custom_activity_id
setHighscoreTopTable(bool $a_top_table)
Sets if the top-rankings table should be shown.
getHighscoreAchievedTS()
Returns if date and time of the scores achievement should be displayed.
setActivationVisibility(bool $activationVisibility)
static getRegistrationEndUrl()
static getPublicKeysetUrl()
static getAuthenticationRequestUrl()
setMasteryScore(float $mastery_score)
const ERROR_OPEN_SSL_CONF
getHighscoreWTime()
Gets if the column with the workingtime should be shown.
determineLTIRole(int $a_user_id, int $a_ref_id, ilRbacReview $rbac_review_instance)
__construct(int $a_id=0, bool $a_reference=true)
ilObjLTIConsumer constructor.
getHighscoreTopNum(int $a_retval=10)
Gets the number of entries which are to be shown in the top-rankings table.
bool $_highscore_percentage
static getRegistrationStartUrl()
setCustomActivityId(string $custom_activity_id)
setActivationStartingTime(?int $activationStartingTime=null)
static sendResponseJson(array $obj)
bool $_highscore_own_table
const LAUNCH_METHOD_OWN_WIN
setUseXapi(bool $use_xapi)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjectActivation.
const TIMINGS_DEACTIVATED
static getItem(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)
class ilRbacReview Contains Review functions of core Rbac.
assignedRoles(int $a_usr_id)
get all assigned roles to a given user
getParentRoleIds(int $a_endnode_id, bool $a_templates=false)
Get an array of parent role ids of all parent roles, if last parameter is set true you get also all p...
assignedGlobalRoles(int $a_usr_id)
Get assigned global roles for an user.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(!file_exists('../ilias.ini.php'))