19 declare(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;
201 return $this->launchMethod == self::LAUNCH_METHOD_OWN_WIN;
206 return $this->launchMethod == self::LAUNCH_METHOD_EMBEDDED;
251 if ($this->
getProvider()->isProviderKeyCustomizable()) {
260 if ($this->
getProvider()->isProviderKeyCustomizable()) {
289 if (strlen($this->
getProvider()->getXapiActivityId())) {
318 $param = explode(
'=', $param);
320 if ($param[0] !=
'') {
321 $value = isset($param[1]) ? $param[1] :
'';
322 $paramsAsArray[$param[0]] = $value;
326 return $paramsAsArray;
341 $param = explode(
'=', $param);
343 if ($param[0] !=
'') {
344 $value = isset($param[1]) ? $param[1] :
'';
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);
474 return self::DB_TABLE_NAME;
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) {
623 return self::HIGHSCORE_SHOW_ALL_TABLES;
626 return self::HIGHSCORE_SHOW_TOP_TABLE;
630 return self::HIGHSCORE_SHOW_OWN_TABLE;
640 case self::HIGHSCORE_SHOW_ALL_TABLES:
645 case self::HIGHSCORE_SHOW_TOP_TABLE:
650 case self::HIGHSCORE_SHOW_OWN_TABLE:
666 string $contextTitle,
667 ?
string $returnUrl =
'' 672 $roles = $DIC->access()->checkAccess(
'write',
'', $this->
getRefId()) ?
"Instructor" :
"Learner";
676 if ($this->
getProvider()->getAlwaysLearner() ==
true) {
680 $resource_link_id = $this->
getRefId();
681 if ($this->
getProvider()->getUseProviderId() ==
true) {
682 $resource_link_id =
'p' . $this->
getProvider()->getId();
686 if ($this->
getProvider()->getIncludeUserPicture()) {
687 $usrImage = self::getIliasHttpPath() .
"/" . $DIC->user()->getPersonalPicturePath(
"small");
690 $documentTarget =
"window";
692 $documentTarget =
"iframe";
700 $nameGiven = $DIC->user()->getFirstname();
701 $nameFull = $DIC->user()->getFirstname();
704 $usrName = $DIC->user()->getUTitle() ? $DIC->user()->getUTitle() .
' ' :
'';
705 $usrName .= $DIC->user()->getLastname();
706 $nameFamily = $usrName;
707 $nameFull = $usrName;
710 $nameGiven = $DIC->user()->getFirstname();
711 $nameFamily = $DIC->user()->getLastname();
712 $nameFull = $DIC->user()->getFullname();
726 $provider_custom_params = self::getProviderCustomParamsArray($this->
getProvider());
728 $merged_params = array_merge($provider_custom_params, $custom_params);
730 $toolConsumerInstanceGuid =
CLIENT_ID .
".";
731 $parseIliasUrl = parse_url(self::getIliasHttpPath());
732 if (array_key_exists(
"path", $parseIliasUrl)) {
733 $toolConsumerInstanceGuid .= implode(
".", array_reverse(explode(
"/", $parseIliasUrl[
"path"])));
735 $toolConsumerInstanceGuid .= $parseIliasUrl[
"host"];
737 "lti_message_type" =>
"basic-lti-launch-request",
738 "lti_version" =>
"LTI-1p0",
739 "resource_link_id" => $resource_link_id,
740 "resource_link_title" => $this->
getTitle(),
742 "user_id" => $userIdLTI,
743 "user_image" => $usrImage,
745 "lis_person_name_given" => $nameGiven,
746 "lis_person_name_family" => $nameFamily,
747 "lis_person_name_full" => $nameFull,
748 "lis_person_contact_email_primary" => $emailPrimary,
749 "context_id" => $contextId,
750 "context_type" => $contextType,
751 "context_title" => $contextTitle,
752 "context_label" => $contextType .
" " . $contextId,
753 "launch_presentation_locale" => $this->
lng->getLangKey(),
754 "launch_presentation_document_target" => $documentTarget,
755 "launch_presentation_width" =>
"",
757 "launch_presentation_height" =>
"",
759 "launch_presentation_return_url" => $returnUrl,
760 "tool_consumer_instance_guid" => $toolConsumerInstanceGuid,
761 "tool_consumer_instance_name" => $DIC->settings()->get(
"short_inst_name") ? $DIC->settings()->get(
764 "tool_consumer_instance_description" => ilObjSystemFolder::_getHeaderTitle(),
765 "tool_consumer_instance_url" => ilLink::_getLink(
ROOT_FOLDER_ID,
"root"),
767 "tool_consumer_instance_contact_email" => $DIC->settings()->get(
"admin_email"),
768 "launch_presentation_css_url" =>
"",
769 "tool_consumer_info_product_family_code" =>
"ilias",
771 "lis_result_sourcedid" =>
$token,
772 "lis_outcome_service_url" => self::getIliasHttpPath(
773 ) .
"/components/ILIAS/LTIConsumer/result.php?client_id=" .
CLIENT_ID,
774 "role_scope_mentor" =>
"" 781 "callback" =>
"about:blank",
782 "http_method" =>
"POST",
783 "sign_method" =>
"HMAC_SHA1",
785 "data" => ($launch_vars + $merged_params)
803 string $contextTitle,
804 ?
string $returnUrl =
'' 809 $roles = $DIC->access()->checkAccess(
'write',
'', $this->
getRefId()) ?
"Instructor" :
"Learner";
810 if ($this->
getProvider()->getAlwaysLearner() ==
true) {
814 $resource_link_id = $this->
getRefId();
815 if ($this->
getProvider()->getUseProviderId() ==
true) {
816 $resource_link_id =
'p' . $this->
getProvider()->getId();
820 if ($this->
getProvider()->getIncludeUserPicture()) {
821 $usrImage = self::getIliasHttpPath() .
"/" . $DIC->user()->getPersonalPicturePath(
"small");
824 $documentTarget =
"window";
826 $documentTarget =
"iframe";
834 $nameGiven = $DIC->user()->getFirstname();
835 $nameFull = $DIC->user()->getFirstname();
838 $usrName = $DIC->user()->getUTitle() ? $DIC->user()->getUTitle() .
' ' :
'';
839 $usrName .= $DIC->user()->getLastname();
840 $nameFamily = $usrName;
841 $nameFull = $usrName;
844 $nameGiven = $DIC->user()->getFirstname();
845 $nameFamily = $DIC->user()->getLastname();
846 $nameFull = $DIC->user()->getFullname();
856 $toolConsumerInstanceGuid =
CLIENT_ID .
".";
857 $parseIliasUrl = parse_url(self::getIliasHttpPath());
858 if (array_key_exists(
"path", $parseIliasUrl)) {
859 $toolConsumerInstanceGuid .= implode(
".", array_reverse(explode(
"/", $parseIliasUrl[
"path"])));
861 $toolConsumerInstanceGuid .= $parseIliasUrl[
"host"];
863 "lti_message_type" =>
"basic-lti-launch-request",
864 "lti_version" =>
"1.3.0",
865 "resource_link_id" => (string) $resource_link_id,
866 "resource_link_title" => $this->
getTitle(),
868 "user_id" => (string) $userIdLTI,
869 "user_image" => $usrImage,
871 "lis_person_name_given" => $nameGiven,
872 "lis_person_name_family" => $nameFamily,
873 "lis_person_name_full" => $nameFull,
874 "lis_person_contact_email_primary" => $emailPrimary,
875 "context_id" => $contextId,
876 "context_type" => $contextType,
877 "context_title" => $contextTitle,
878 "context_label" => $contextType .
" " . $contextId,
879 "launch_presentation_locale" => $this->
lng->getLangKey(),
880 "launch_presentation_document_target" => $documentTarget,
881 "launch_presentation_width" =>
"",
883 "launch_presentation_height" =>
"",
885 "launch_presentation_return_url" => $returnUrl,
886 "tool_consumer_instance_guid" => $toolConsumerInstanceGuid,
887 "tool_consumer_instance_name" => $DIC->settings()->get(
"short_inst_name") ? $DIC->settings()->get(
890 "tool_consumer_instance_description" => ilObjSystemFolder::_getHeaderTitle(),
891 "tool_consumer_instance_url" => ilLink::_getLink(
ROOT_FOLDER_ID,
"root"),
893 "tool_consumer_instance_contact_email" => $DIC->settings()->get(
"admin_email"),
894 "launch_presentation_css_url" =>
"",
895 "tool_consumer_info_product_family_code" =>
"ilias",
897 "lis_result_sourcedid" =>
"",
899 "lis_outcome_service_url" => self::getIliasHttpPath(
900 ) .
"/components/ILIAS/LTIConsumer/result.php?client_id=" .
CLIENT_ID,
901 "role_scope_mentor" =>
"" 904 $provider_custom_params = self::getProviderCustomParamsArray($this->
getProvider());
906 $merged_params = array_merge($provider_custom_params, $custom_params);
907 foreach ($merged_params as $key => $value) {
908 $launch_vars[
'custom_' . $key] = $value;
911 if ($this->
getProvider()->isGradeSynchronization()) {
913 $launch_vars[
'custom_lineitem_url'] = self::getIliasHttpPath(
914 ) .
"/components/ILIAS/LTIConsumer/ltiservices.php/gradeservice/" . $contextId .
"/lineitems/" . $this->
id .
"/lineitem";
918 $launch_vars[
'custom_lineitems_url'] = self::getIliasHttpPath(
919 ) .
"/components/ILIAS/LTIConsumer/ltiservices.php/gradeservice/" . $contextId .
"/linetitems/";
921 $launch_vars[
'custom_ags_scopes'] = implode(
",", $gradeservice->getPermittedScopes());
924 if (!empty(self::verifyPrivateKey())) {
925 $DIC->ui()->mainTemplate()->setOnScreenMessage(
'failure',
'ERROR_OPEN_SSL_CONF',
true);
928 return self::LTISignJWT($launch_vars, $endpoint, $clientId, $deploymentId, $nonce);
946 $deploymentId = $provider->
getId();
948 $context = $ilLTIConsumerLaunch->getContext();
949 $contextType = $ilLTIConsumerLaunch::getLTIContextType(
$context[
"type"]);
953 $roles =
"Instructor";
956 $usrImage = self::getIliasHttpPath() .
"/" . $DIC->user()->getPersonalPicturePath(
"small");
958 $documentTarget =
"window";
960 $documentTarget =
"iframe";
967 $nameGiven = $DIC->user()->getFirstname();
968 $nameFull = $DIC->user()->getFirstname();
971 $usrName = $DIC->user()->getUTitle() ? $DIC->user()->getUTitle() .
' ' :
'';
972 $usrName .= $DIC->user()->getLastname();
973 $nameFamily = $usrName;
974 $nameFull = $usrName;
977 $nameGiven = $DIC->user()->getFirstname();
978 $nameFamily = $DIC->user()->getLastname();
979 $nameFull = $DIC->user()->getFullname();
985 $toolConsumerInstanceGuid =
CLIENT_ID .
".";
986 $parseIliasUrl = parse_url(self::getIliasHttpPath());
987 if (array_key_exists(
"path", $parseIliasUrl)) {
988 $toolConsumerInstanceGuid .= implode(
".", array_reverse(explode(
"/", $parseIliasUrl[
"path"])));
990 $toolConsumerInstanceGuid .= $parseIliasUrl[
"host"];
992 $content_select_vars = [
993 "lti_message_type" =>
"ContentItemSelectionRequest",
994 "lti_version" =>
"1.3.0",
995 "user_id" => (string) $userIdLTI,
996 "user_image" => $usrImage,
998 "lis_person_name_given" => $nameGiven,
999 "lis_person_name_family" => $nameFamily,
1000 "lis_person_name_full" => $nameFull,
1001 "lis_person_contact_email_primary" => $emailPrimary,
1002 "context_id" => (
string) $contextId,
1003 "context_type" => $contextType,
1004 "context_title" => $contextTitle,
1005 "context_label" => $contextType .
" " . $contextId,
1006 "launch_presentation_locale" => $DIC->language()->getLangKey(),
1007 "launch_presentation_document_target" => $documentTarget,
1008 "launch_presentation_width" =>
"",
1010 "launch_presentation_height" =>
"",
1012 "tool_consumer_instance_guid" => $toolConsumerInstanceGuid,
1013 "tool_consumer_instance_name" => $DIC->settings()->get(
"short_inst_name") ? $DIC->settings()->get(
1016 "tool_consumer_instance_description" => ilObjSystemFolder::_getHeaderTitle(),
1017 "tool_consumer_instance_url" => ilLink::_getLink(
ROOT_FOLDER_ID,
"root"),
1019 "tool_consumer_instance_contact_email" => $DIC->settings()->get(
"admin_email"),
1020 "tool_consumer_info_product_family_code" =>
"ilias",
1022 "content_item_return_url" => $returnUrl,
1023 "accept_types" =>
"ltiResourceLink",
1024 "accept_presentation_document_targets" =>
"iframe,window,embed",
1025 "accept_multiple" =>
true,
1026 "auto_create" =>
true,
1028 $provider_custom_params = self::getProviderCustomParamsArray($provider);
1029 foreach ($provider_custom_params as $key => $value) {
1030 $content_select_vars[
'custom_' . $key] = $value;
1033 if (!empty(self::verifyPrivateKey())) {
1034 $DIC->ui()->mainTemplate()->setOnScreenMessage(
'failure',
'ERROR_OPEN_SSL_CONF',
true);
1037 return self::LTISignJWT($content_select_vars,
'',
$clientId, $deploymentId, $nonce);
1043 string $oAuthConsumerKey,
1050 $messageTypeMapping = Util::MESSAGE_TYPE_MAPPING;
1051 if (isset($parms[
'lti_message_type']) && array_key_exists($parms[
'lti_message_type'], $messageTypeMapping)) {
1052 $parms[
'lti_message_type'] = $messageTypeMapping[$parms[
'lti_message_type']];
1054 if (isset($parms[
'roles'])) {
1055 $roles = explode(
',', $parms[
'roles']);
1056 $newRoles = array();
1057 foreach ($roles as $role) {
1058 if (strpos($role,
'urn:lti:role:ims/lis/') === 0) {
1059 $role =
'http://purl.imsglobal.org/vocab/lis/v2/membership#' . substr($role, 21);
1060 } elseif (strpos($role,
'urn:lti:instrole:ims/lis/') === 0) {
1061 $role =
'http://purl.imsglobal.org/vocab/lis/v2/institution/person#' . substr($role, 25);
1062 } elseif (strpos($role,
'urn:lti:sysrole:ims/lis/') === 0) {
1063 $role =
'http://purl.imsglobal.org/vocab/lis/v2/system/person#' . substr($role, 24);
1064 } elseif ((strpos($role,
'://') ===
false) && (strpos($role,
'urn:') !== 0)) {
1065 $role =
"http://purl.imsglobal.org/vocab/lis/v2/membership#{$role}";
1067 $newRoles[] = $role;
1069 $parms[
'roles'] = implode(
',', $newRoles);
1072 if (empty($nonce)) {
1073 $nonce = bin2hex(openssl_random_pseudo_bytes(10));
1075 $claimMapping = Util::JWT_CLAIM_MAPPING;
1081 $payLoad[
'iss'] = self::getIliasHttpPath();
1082 $payLoad[
'aud'] = $oAuthConsumerKey;
1083 $payLoad[self::LTI_JWT_CLAIM_PREFIX .
'/claim/deployment_id'] = strval(
$typeId);
1084 if (!empty($endpoint)) {
1085 $payLoad[self::LTI_JWT_CLAIM_PREFIX .
'/claim/target_link_uri'] = $endpoint;
1088 foreach ($parms as $key => $value) {
1089 $claim = self::LTI_JWT_CLAIM_PREFIX;
1090 if (array_key_exists($key, $claimMapping)) {
1091 $mapping = $claimMapping[$key];
1093 if (isset($mapping[
'isArray']) && $mapping[
'isArray']) {
1094 $value = explode(
',', $value);
1096 } elseif (isset($mapping[
'isBoolean'])) {
1097 $value = $mapping[
'isBoolean'];
1099 if (!empty($mapping[
'suffix'])) {
1100 $claim .=
"-{$mapping['suffix']}";
1102 $claim .=
'/claim/';
1103 if (is_null($mapping[
'group'])) {
1104 $payLoad[$mapping[
'claim']] = $value;
1105 } elseif (empty($mapping[
'group'])) {
1106 $payLoad[
"{$claim}{$mapping['claim']}"] = $value;
1108 $claim .= $mapping[
'group'];
1109 $payLoad[$claim][$mapping[
'claim']] = $value;
1111 } elseif (strpos($key,
'custom_') === 0) {
1112 $payLoad[
"{$claim}/claim/custom"][substr($key, 7)] = $value;
1113 } elseif (strpos($key,
'ext_') === 0) {
1114 $payLoad[
"{$claim}/claim/ext"][substr($key, 4)] = $value;
1118 if (!empty(self::verifyPrivateKey())) {
1119 throw new DomainException(self::ERROR_OPEN_SSL_CONF);
1123 $newParms = array();
1124 $newParms[
'id_token'] = $jwt;
1131 $err = self::verifyPrivateKey();
1135 $privatekey = $ilSetting->get(self::LTI_1_3_PRIVATE_KEY);
1136 $kid = $ilSetting->get(self::LTI_1_3_KID);
1138 "key" => $privatekey,
1146 $key = $ilSetting->get(self::LTI_1_3_PRIVATE_KEY);
1149 $kid = bin2hex(openssl_random_pseudo_bytes(10));
1150 $ilSetting->set(self::LTI_1_3_KID, $kid);
1152 "digest_alg" =>
"sha256",
1153 "private_key_bits" => 2048,
1154 "private_key_type" => self::OPENSSL_KEYTYPE_RSA
1156 $res = openssl_pkey_new($config);
1157 openssl_pkey_export(
$res, $privatekey);
1158 if (!empty($privatekey)) {
1159 $ilSetting->set(self::LTI_1_3_PRIVATE_KEY, $privatekey);
1161 return self::ERROR_OPEN_SSL_CONF;
1172 if (
$res !==
false) {
1173 $details = openssl_pkey_get_details(
$res);
1174 $publicKey = $details[
'key'];
1181 $jwks = [
'keys' => []];
1183 $privatekey = self::getPrivateKey();
1184 $res = openssl_pkey_get_private($privatekey[
'key']);
1185 $details = openssl_pkey_get_details(
$res);
1188 $jwk[
'kty'] =
'RSA';
1189 $jwk[
'alg'] =
'RS256';
1190 $jwk[
'kid'] = $privatekey[
'kid'];
1191 $jwk[
'e'] = rtrim(strtr(base64_encode($details[
'rsa'][
'e']),
'+/',
'-_'),
'=');
1192 $jwk[
'n'] = rtrim(strtr(base64_encode($details[
'rsa'][
'n']),
'+/',
'-_'),
'=');
1193 $jwk[
'use'] =
'sig';
1195 $jwks[
'keys'][] = $jwk;
1203 if ($DIC[
'https']->isDetected()) {
1204 $protocol =
'https://';
1206 $protocol =
'http://';
1210 $rq_uri = strip_tags(
$_SERVER[
'REQUEST_URI']);
1214 if (is_int($pos = strpos($rq_uri,
"?"))) {
1215 $rq_uri = substr($rq_uri, 0, $pos);
1218 $path = pathinfo($rq_uri);
1219 if (isset(
$path[
'extension']) &&
$path[
'extension'] !==
'') {
1220 $uri = dirname($rq_uri);
1224 $uri = str_replace(
"components/ILIAS/LTIConsumer",
"", $uri);
1226 $f = new \ILIAS\Data\Factory();
1227 $uri =
$f->uri(rtrim($iliasHttpPath,
"/"));
1228 return $uri->getBaseURI();
1233 return self::getIliasHttpPath();
1238 return self::getIliasHttpPath() .
"/components/ILIAS/LTIConsumer/ltiauth.php";
1243 return self::getIliasHttpPath() .
"/components/ILIAS/LTIConsumer/ltitoken.php";
1248 return self::getIliasHttpPath() .
"/components/ILIAS/LTIConsumer/lticerts.php";
1253 return self::getIliasHttpPath() .
"/components/ILIAS/LTIConsumer/ltiregistration.php";
1258 return self::getIliasHttpPath() .
"/components/ILIAS/LTIConsumer/ltiregstart.php";
1263 return self::getIliasHttpPath() .
"/components/ILIAS/LTIConsumer/ltiregend.php";
1268 return self::getIliasHttpPath() .
"/components/ILIAS/LTIConsumer/lticonfig.php";
1273 $scopesSupported = array(
'openid');
1275 $scopesSupported = array_merge($scopesSupported, $gradeservice->getPermittedScopes());
1277 "issuer" => self::getPlattformId(),
1278 "authorization_endpoint" => self::getAuthenticationRequestUrl(),
1279 "token_endpoint" => self::getAccessTokenUrl(),
1280 "token_endpoint_auth_methods_supported" => [
"private_key_jwt"],
1281 "token_endpoint_auth_signing_alg_values_supported" => [
"RS256"],
1282 "jwks_uri" => self::getPublicKeysetUrl(),
1283 "registration_endpoint" => self::getRegistrationUrl(),
1284 "scopes_supported" => $scopesSupported,
1285 "response_types_supported" => [
"id_token"],
1286 "subject_types_supported" => [
"public",
"pairwise"],
1287 "id_token_signing_alg_values_supported" => [
"RS256"],
1288 "claims_supported" => [
"iss",
"aud"],
1289 "https://purl.imsglobal.org/spec/lti-platform-configuration" => [
1290 "product_family_code" =>
"ilias.de",
1292 "messages_supported" => [
1294 "type" =>
"LtiResourceLinkRequest",
1299 "type" =>
"LtiDeepLinkingRequest",
1313 $reponseData =
$data;
1315 $toolConfig = $data[
'https://purl.imsglobal.org/spec/lti-tool-configuration'];
1316 $provider->
setTitle(strip_tags($data[
'client_name'], ilObjectGUI::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION));
1320 if (isset($data[
'jwks_uri'])) {
1323 foreach ($toolConfig[
'messages'] as
$message) {
1324 if (isset($message[
'type']) && $message[
'type'] ===
'LtiDeepLinkingRequest') {
1340 $reponseData[
'client_id'] = $tokenObj->aud;
1341 $reponseData[
'https://purl.imsglobal.org/spec/lti-tool-configuration'][
'deployment_id'] = $provider->
getId();
1342 return $reponseData;
1347 return Util::getRandomString(15);
1355 self::getLogger()->error(
"$code $message");
1357 $DIC->http()->saveResponse(
1358 $DIC->http()->response()
1360 ->withBody(Streams::ofString($message))
1362 $DIC->http()->sendResponse();
1363 $DIC->http()->close();
1365 $DIC->http()->close();
1373 header(
'Content-Type: application/json; charset=utf-8');
1374 header(
'Cache-Control: no-store');
1375 header(
'Pragma: no-cache');
1376 echo json_encode($obj, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
1378 self::sendResponseError(500,
"error in sendResponseJson");
1379 $DIC->http()->close();
1385 return new self($a_id, $a_reference);
1395 return file_get_contents(
'php://input');
1401 $keys = JWK::parseKeySet(self::getJwks());
1402 return JWT::decode($token, $keys);
1411 $auth = $DIC->http()->request()->getHeader(
"Authorization");
1412 if (count($auth) < 1) {
1413 self::sendResponseError(405,
"missing Authorization header");
1415 preg_match(
'/Bearer\s+(.+)$/i', $auth[0], $matches);
1416 if (count($matches) != 2) {
1417 self::sendResponseError(405,
"missing required Authorization Baerer token");
1420 return self::getTokenObject(
$token);
static getIdentAsId(int $userIdentMode, ilObjUser $user)
setUseXapi(bool $use_xapi)
const LAUNCH_METHOD_OWN_WIN
setInitiateLogin(string $initiate_login)
const HIGHSCORE_SHOW_TOP_TABLE
setPublicKeyset(string $public_keyset)
getHighscoreWTime()
Gets if the column with the workingtime should be shown.
setActivationEndingTime(?int $activationEndingTime=null)
static getLogger(string $a_component_id)
Get component logger.
setCustomActivityId(string $custom_activity_id)
__construct(int $a_id=0, bool $a_reference=true)
ilObjLTIConsumer constructor.
setCustomParams(string $customParams)
getActivationEndingTime()
setActivationLimited(bool $activationLimited)
setHighscoreEnabled(bool $a_enabled)
HIGHSCORE.
static getPublicKeysetUrl()
static sendResponseError(int $code, string $message, $log=true)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
getHighscorePercentage()
Gets if the percentage column should be shown.
getHighscoreEnabled()
Gets the setting which determines if the highscore feature is enabled.
setStatementsReportEnabled(bool $statementsReportEnabled)
setMasteryScorePercent(float $mastery_score_percent)
bool $activationLimited
repository object activation settings (handled by ilObject)
setHighscoreWTime(bool $a_wtime)
Sets if the workingtime of the scores should be shown.
const TIMINGS_DEACTIVATED
const AVAILABILITY_CREATE
setHighscoreAchievedTS(bool $a_achieved_ts)
Sets if the date and time of the scores achievement should be displayed.
static verifyPrivateKey()
setHighscoreTopTable(bool $a_top_table)
Sets if the top-rankings table should be shown.
setContentItemUrl(string $content_item_url)
setCustomLaunchSecret(string $customLaunchSecret)
saveRepositoryActivationSettings()
static buildContentSelectionParameters(ilLTIConsumeProvider $provider, int $refId, string $returnUrl, string $nonce)
bool $activationVisibility
static getRegistrationUrl()
static modifyHttpPath(string $httpPath)
const PRIVACY_NAME_LASTNAME
static registerClient(array $data, object $tokenObj)
const PRIVACY_IDENT_IL_UUID_RANDOM
static getIdent(int $userIdentMode, ilObjUser $user)
sort()
description: > Example for rendering a Sort Glyph.
bool $_highscore_top_table
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getInstance(int $a_id=0, bool $a_reference=true)
bool $statementsReportEnabled
getHighscoreTopNum(int $a_retval=10)
Gets the number of entries which are to be shown in the top-rankings table.
const LTI_1_3_PRIVATE_KEY
buildLaunchParametersLTI13(ilCmiXapiUser $cmixUser, string $endpoint, string $clientId, int $deploymentId, string $nonce, string $contextType, string $contextId, string $contextTitle, ?string $returnUrl='')
setRedirectionUris(string $redirection_uris)
loadRepositoryActivationSettings()
setLaunchMethod(string $launchMethod)
const REG_TOKEN_OP_NEW_REG
static getIliasHttpPath()
const PRIVACY_NAME_FIRSTNAME
bool $_highscore_percentage
setHighscoreOwnTable(bool $a_own_table)
Sets if the table with the own ranking should be shown.
getActivationVisibility()
static getOpenidConfigUrl()
static getAuthenticationRequestUrl()
static getTokenObject(string $token)
static LTISignJWT(array $parms, string $endpoint, string $oAuthConsumerKey, $typeId=0, string $nonce='')
static getAccessTokenUrl()
setKeyType(string $key_type)
static getRegistrationEndUrl()
ilLTIConsumeProvider $provider
const HIGHSCORE_SHOW_OWN_TABLE
setClientId(string $client_id)
setLtiVersion(string $lti_version)
const PRIVACY_NAME_FULLNAME
getActivationStartingTime()
isStatementsReportEnabled()
const LTI_JWT_CLAIM_PREFIX
static getRegistrationStartUrl()
const OPENSSL_KEYTYPE_RSA
static getByKeys(int $a_obj_id, int $a_usr_id, ?bool $a_create=false)
Get a result by object and user key.
int $activationEndingTime
setHighscorePercentage(bool $a_percentage)
Sets if the percentages of the scores pass should be shown.
setHighscoreMode(int $mode)
setActivationVisibility(bool $activationVisibility)
const LAUNCH_METHOD_NEW_WIN
static getItem(int $ref_id)
const REG_TOKEN_OP_UPDATE_REG
static getProviderCustomParamsArray(ilLTIConsumeProvider $provider)
setActivationStartingTime(?int $activationStartingTime=null)
buildLaunchParameters(ilCmiXapiUser $cmixUser, string $token, string $contextType, string $contextId, string $contextTitle, ?string $returnUrl='')
__construct(Container $dic, ilPlugin $plugin)
setCustomLaunchKey(string $customLaunchKey)
getHighscoreTopTable()
Gets, if the top-rankings table should be shown.
int $activationStartingTime
getHighscoreAchievedTS()
Returns if date and time of the scores achievement should be displayed.
string $custom_activity_id
setHighscoreTopNum(int $a_top_num)
Sets the number of entries which are to be shown in the top-rankings table.
static sendResponseJson(array $obj)
static signOAuth(array $a_params)
sign request data with OAuth
string $customLaunchSecret
setProviderUrl(string $provider_url)
Class ilObjectActivation.
const ERROR_OPEN_SSL_CONF
setAvailability(int $availability)
const LAUNCH_METHOD_EMBEDDED
const HIGHSCORE_SHOW_ALL_TABLES
getHighscoreOwnTable()
Gets if the own rankings table should be shown.
bool $_highscore_achieved_ts
setMasteryScore(float $mastery_score)
setProviderId(int $providerId)
setIsGlobal(bool $is_global)
setProvider(ilLTIConsumeProvider $provider)
bool $_highscore_own_table