288 $this->groupSets = null;
289 $this->groups = null;
290 $this->primaryResourceLinkId = null;
291 $this->shareApproved = null;
292 $this->created = null;
293 $this->updated = null;
315 $this->settingsChanged =
false;
326 public function delete():
bool 383 if (is_null($this->platform)) {
384 if (!is_null($this->context) || !is_null($this->contextId)) {
385 $this->platform = $this->
getContext()->getPlatform();
411 $this->platform = null;
422 if (is_null($this->context) && !is_null($this->contextId)) {
436 if (is_null($this->contextId) && !is_null($this->context)) {
437 $this->contextId = $this->context->getRecordId();
459 if ($this->contextId !== $contextId) {
460 $this->context = null;
511 if (empty($this->dataConnector)) {
513 if (!empty($this->platform)) {
514 $this->dataConnector = $this->platform->getDataConnector();
527 public function getSetting(
string $name,
string $default =
''): string
529 if (array_key_exists($name, $this->
settings)) {
543 public function setSetting(
string $name,
string $value = null)
546 if ($value !== $old_value) {
547 if (!empty($value)) {
552 $this->settingsChanged =
true;
582 if ($this->settingsChanged) {
598 $has = !empty($this->
getSetting(
'ext_ims_lis_basic_outcome_url')) || !empty($this->
getSetting(
'lis_outcome_service_url'));
599 if (!$has && !empty($this->
getSetting(
'custom_lineitem_url')) && !empty($this->
getSetting(
'custom_ags_scopes'))) {
621 $has = !empty($this->
getSetting(
'custom_link_memberships_url'));
624 $has = !empty($this->
getSetting(
'ext_ims_lis_memberships_url'));
653 if (!empty($this->
getSetting(
'custom_ags_scopes'))) {
656 $has = !empty($this->
getSetting(
'custom_lineitems_url'));
671 if (!empty($this->
getSetting(
'custom_ags_scopes'))) {
674 $has = !empty($this->
getSetting(
'custom_lineitem_url'));
689 if (!empty($this->
getSetting(
'custom_ags_scopes'))) {
692 $has = !empty($this->
getSetting(
'custom_lineitem_url'));
721 $this->extResponse =
'';
724 $sourcedId = $userResult->ltiResultSourcedId;
727 $urlAGS = $sourceResourceLink->getSetting(
'custom_lineitem_url');
728 $urlLTI11 = $sourceResourceLink->getSetting(
'lis_outcome_service_url');
729 $urlExt = $sourceResourceLink->getSetting(
'ext_ims_lis_basic_outcome_url');
731 if (!empty($urlAGS)) {
732 if (($action === self::EXT_READ) && ($ltiOutcome->type === self::EXT_TYPE_DECIMAL) && $sourceResourceLink->hasResultService()) {
734 $ok = !empty($ltiOutcome);
735 } elseif ((($action === self::EXT_WRITE) && $this->
checkValueType($ltiOutcome, array(self::EXT_TYPE_DECIMAL)) && $sourceResourceLink->hasScoreService()) ||
736 ($action === self::EXT_DELETE)) {
737 if ($action === self::EXT_DELETE) {
739 $ltiOutcome->activityProgress =
'Initialized';
740 $ltiOutcome->gradingProgress =
'NotReady';
745 if (!$ok && is_null($ltiOutcome->
getValue())) {
748 if (!$ok && !empty($urlLTI11)) {
751 if (($action === self::EXT_READ) && ($ltiOutcome->type === self::EXT_TYPE_DECIMAL)) {
753 } elseif (($action === self::EXT_WRITE) && $this->
checkValueType($ltiOutcome, array(self::EXT_TYPE_DECIMAL))) {
754 $do =
'replaceResult';
758 } elseif ($action === self::EXT_DELETE) {
759 $do =
'deleteResult';
763 if ($action === self::EXT_WRITE) {
764 $comment = (empty($ltiOutcome->comment)) ?
'' : trim($ltiOutcome->comment);
765 if (!empty(
$comment) && !empty($sourceResourceLink->getSetting(
'ext_outcome_data_values_accepted'))) {
766 $resultDataTypes = explode(
',', $sourceResourceLink->getSetting(
'ext_outcome_data_values_accepted'));
767 $resultDataType =
'';
768 if (count($resultDataTypes) === 1) {
769 $resultDataType = $resultDataTypes[0];
770 } elseif (count($resultDataTypes) > 1) {
771 $isUrl = (strpos(
$comment,
'http://') === 0) || (strpos(
$comment,
'https://') === 0);
772 if ($isUrl && in_array(
'ltiLaunchUrl', $resultDataTypes)) {
773 $resultDataType =
'ltiLaunchUrl';
774 } elseif ($isUrl && in_array(
'url', $resultDataTypes)) {
775 $resultDataType =
'url';
776 } elseif (in_array(
'text', $resultDataTypes)) {
777 $resultDataType =
'text';
780 if (!empty($resultDataType)) {
784 <{$resultDataType}>{
$comment}</{$resultDataType}>
794 <textString>{$outcome}</textString>
799 $sourcedId = htmlentities($sourcedId);
803 <sourcedId>{$sourcedId}</sourcedId>
810 if (!isset($this->extNodes[
'imsx_POXBody'][
"{$do}Response"][
'result'][
'resultScore'][
'textString'])) {
813 $ltiOutcome->
setValue($this->extNodes[
'imsx_POXBody'][
"{$do}Response"][
'result'][
'resultScore'][
'textString']);
816 case self::EXT_WRITE:
817 case self::EXT_DELETE:
824 if (!$ok && !empty($urlExt)) {
827 if (($action === self::EXT_READ) && ($ltiOutcome->type === self::EXT_TYPE_DECIMAL)) {
828 $do =
'basic-lis-readresult';
829 } elseif (($action === self::EXT_WRITE) && $this->
checkValueType($ltiOutcome, array(self::EXT_TYPE_DECIMAL))) {
830 $do =
'basic-lis-updateresult';
834 } elseif ($action === self::EXT_DELETE) {
835 $do =
'basic-lis-deleteresult';
839 $params[
'sourcedid'] = $sourcedId;
840 $params[
'result_resultscore_textstring'] = $outcome;
841 if (!empty($ltiOutcome->language)) {
842 $params[
'result_resultscore_language'] = $ltiOutcome->language;
844 if (!empty($ltiOutcome->status)) {
845 $params[
'result_statusofresult'] = $ltiOutcome->status;
847 if (!empty($ltiOutcome->date)) {
848 $params[
'result_date'] = $ltiOutcome->date;
850 if (!empty($ltiOutcome->type)) {
851 $params[
'result_resultvaluesourcedid'] = $ltiOutcome->type;
853 if (!empty($ltiOutcome->dataSource)) {
854 $params[
'result_datasource'] = $ltiOutcome->dataSource;
856 if ($this->
doService($do, $urlExt,
$params,
'https://purl.imsglobal.org/spec/lti-ext/scope/outcomes')) {
859 if (isset($this->extNodes[
'result'][
'resultscore'][
'textstring'])) {
860 $ltiOutcome->
setValue($this->extNodes[
'result'][
'resultscore'][
'textstring']);
863 case self::EXT_WRITE:
864 case self::EXT_DELETE:
873 $hook =
new $className($this);
874 $response = $hook->doOutcomesService($action, $ltiOutcome, $userResult);
877 if ($action === self::EXT_READ) {
910 $this->extResponse =
'';
913 $do =
'basic-lti-loadsetting';
915 case self::EXT_WRITE:
916 $do =
'basic-lti-savesetting';
918 case self::EXT_DELETE:
919 $do =
'basic-lti-deletesetting';
926 if (is_null($value)) {
931 if ($this->
doService($do,
$url,
$params,
'https://purl.imsglobal.org/spec/lti-ext/scope/setting')) {
934 if (isset($this->extNodes[
'setting'][
'value'])) {
935 $response = $this->extNodes[
'setting'][
'value'];
941 case self::EXT_WRITE:
942 $this->
setSetting(
'ext_ims_lti_tool_setting', $value);
946 case self::EXT_DELETE:
963 $has = !empty($this->
getSetting(
'custom_link_setting_url'));
980 if (!empty($this->
getSetting(
'custom_link_setting_url'))) {
984 $this->lastServiceRequest =
$service->getHttpMessage();
985 $ok = $settings !==
false;
989 $hook =
new $className($this);
990 $settings = $hook->getToolSettings($mode, $simple);
1004 if (!empty($this->
getSetting(
'custom_link_setting_url'))) {
1008 $this->lastServiceRequest =
$service->getHttpMessage();
1012 $hook =
new $className($this);
1013 $ok = $hook->setToolSettings($settings);
1030 'Method ceLTIc\LTI\ResourceLink::hasMembershipService() has been deprecated; please use ceLTIc\LTI\ResourceLink::hasMembershipsService() instead.',
1047 'Method ceLTIc\LTI\ResourceLink::getMembership() has been deprecated; please use ceLTIc\LTI\ResourceLink::getMemberships() instead.',
1061 $userResults = array();
1062 $hasLtiLinkService = !empty($this->
getSetting(
'custom_link_memberships_url'));
1063 $hasLtiContextService = !empty($this->
getContextId()) &&
1066 $hasExtService = !empty($this->
getSetting(
'ext_ims_lis_memberships_url'));
1068 if (($hasLtiContextService && (!$withGroups || $hasGroupsService)) || (!$hasExtService && !$hasApiHook)) {
1070 $url = $this->
getContext()->getSetting(
'custom_context_memberships_v2_url');
1073 $url = $this->
getContext()->getSetting(
'custom_context_memberships_url');
1080 $userResults =
$service->getWithGroups();
1082 $this->lastServiceRequest =
$service->getHttpMessage();
1083 $ok = $userResults !==
false;
1084 } elseif ($hasLtiLinkService) {
1093 $userResults =
$service->getWithGroups();
1095 $this->lastServiceRequest =
$service->getHttpMessage();
1097 $ok = $userResults !==
false;
1099 if (!$ok && $hasExtService) {
1100 $this->extResponse =
'';
1106 'basic-lis-readmembershipsforcontextwithgroups',
1109 'https://purl.imsglobal.org/spec/lti-ext/scope/memberships' 1114 'basic-lis-readmembershipsforcontext',
1117 'https://purl.imsglobal.org/spec/lti-ext/scope/memberships' 1121 $this->groupSets = array();
1122 $this->groups = array();
1123 if (isset($this->extNodes[
'memberships'])) {
1124 $memberships = $this->extNodes[
'memberships'];
1125 } elseif (isset($this->extNodes[
'members'])) {
1126 $memberships = $this->extNodes[
'members'];
1132 if (!isset($memberships[
'member'])) {
1134 } elseif (!isset($memberships[
'member'][0])) {
1136 $members[0] = $memberships[
'member'];
1138 $members = $memberships[
'member'];
1141 for ($i = 0; $i < count($members); $i++) {
1145 $firstname = (isset($members[$i][
'person_name_given'])) ? $members[$i][
'person_name_given'] :
'';
1146 $lastname = (isset($members[$i][
'person_name_family'])) ? $members[$i][
'person_name_family'] :
'';
1147 $fullname = (isset($members[$i][
'person_name_full'])) ? $members[$i][
'person_name_full'] :
'';
1148 $userresult->setNames($firstname, $lastname, $fullname);
1151 if (isset($members[$i][
'person_sourcedid'])) {
1152 $userresult->sourcedId = $members[$i][
'person_sourcedid'];
1156 $email = (isset($members[$i][
'person_contact_email_primary'])) ? $members[$i][
'person_contact_email_primary'] :
'';
1157 $userresult->setEmail($email, $this->
getPlatform()->defaultEmail);
1160 if (isset($members[$i][
'roles'])) {
1165 if (!isset($members[$i][
'groups'][
'group'])) {
1167 } elseif (!isset($members[$i][
'groups'][
'group'][0])) {
1169 $groups[0] = $members[$i][
'groups'][
'group'];
1171 $groups = $members[$i][
'groups'][
'group'];
1173 for ($j = 0; $j < count($groups); $j++) {
1174 $group = $groups[$j];
1175 if (isset($group[
'set'])) {
1176 $set_id = $group[
'set'][
'id'];
1177 if (!isset($this->groupSets[$set_id])) {
1178 $this->groupSets[$set_id] = array(
'title' => $group[
'set'][
'title'],
'groups' => array(),
1179 'num_members' => 0,
'num_staff' => 0,
'num_learners' => 0);
1181 $this->groupSets[$set_id][
'num_members']++;
1182 if ($userresult->isStaff()) {
1183 $this->groupSets[$set_id][
'num_staff']++;
1185 if ($userresult->isLearner()) {
1186 $this->groupSets[$set_id][
'num_learners']++;
1188 if (!in_array($group[
'id'], $this->groupSets[$set_id][
'groups'])) {
1189 $this->groupSets[$set_id][
'groups'][] = $group[
'id'];
1191 $this->groups[$group[
'id']] = array(
'title' => $group[
'title'],
'set' => $set_id);
1193 $this->groups[$group[
'id']] = array(
'title' => $group[
'title']);
1195 $userresult->groups[] = $group[
'id'];
1197 if (isset($members[$i][
'lis_result_sourcedid'])) {
1198 $userresult->ltiResultSourcedId = $members[$i][
'lis_result_sourcedid'];
1200 $userResults[] = $userresult;
1203 $userResults =
false;
1205 $ok = $userResults !==
false;
1207 if (!$ok && $hasApiHook) {
1209 $hook =
new $className($this);
1210 $userResults = $hook->getMemberships($withGroups);
1211 $ok = $userResults !==
false;
1215 foreach ($userResults as $userresult) {
1217 if (!empty($userresult->ltiResultSourcedId)) {
1218 $userresult->save();
1224 foreach ($oldUsers as $id => $userresult) {
1225 $userresult->delete();
1229 return $userResults;
1242 return $this->
getDataConnector()->getUserResultSourcedIDsResourceLink($this, $localOnly, $idScope);
1262 public function getLineItems(
string $resourceId = null,
string $tag = null,
int $limit = null)
1265 $this->extRequest =
'';
1266 $this->extRequestHeaders =
'';
1267 $this->extResponse =
'';
1268 $this->extResponseHeaders =
'';
1269 $this->lastServiceRequest = null;
1271 if (!empty($lineItemService)) {
1272 $lineItems = $lineItemService->getAll($this->ltiResourceLinkId, $resourceId, $tag, $limit);
1273 $http = $lineItemService->getHttpMessage();
1274 $this->extResponse =
$http->response;
1275 $this->extResponseHeaders =
$http->responseHeaders;
1276 $this->extRequest =
$http->request;
1277 $this->extRequestHeaders =
$http->requestHeaders;
1278 $this->lastServiceRequest =
$http;
1293 if (!empty($lineItemService)) {
1295 $ok = $lineItemService->createLineItem($lineItem);
1309 $this->extRequest =
'';
1310 $this->extRequestHeaders =
'';
1311 $this->extResponse =
'';
1312 $this->extResponseHeaders =
'';
1313 $this->lastServiceRequest = null;
1317 $outcomes = $resultService->getAll($limit);
1318 $http = $resultService->getHttpMessage();
1319 $this->extResponse =
$http->response;
1320 $this->extResponseHeaders =
$http->responseHeaders;
1321 $this->extRequest =
$http->request;
1322 $this->extRequestHeaders =
$http->requestHeaders;
1323 $this->lastServiceRequest =
$http;
1339 $this->extRequest =
'';
1340 $this->extRequestHeaders =
'';
1341 $this->extResponse =
'';
1342 $this->extResponseHeaders =
'';
1343 $this->lastServiceRequest = null;
1347 $status = $assessmentControlService->submitAction($assessmentControlAction, $user, $attemptNumber);
1348 $http = $assessmentControlService->getHttpMessage();
1349 $this->extResponse =
$http->response;
1350 $this->extResponseHeaders =
$http->responseHeaders;
1351 $this->extRequest =
$http->request;
1352 $this->extRequestHeaders =
$http->requestHeaders;
1353 $this->lastServiceRequest =
$http;
1391 if (!empty($ltiResourceLinkId)) {
1392 $resourceLink->load();
1393 if (is_null($resourceLink->id) && !empty($tempId)) {
1394 $resourceLink->ltiResourceLinkId = $tempId;
1395 $resourceLink->load();
1400 return $resourceLink;
1413 $resourceLink->setContext($context);
1416 if (!empty($ltiResourceLinkId)) {
1417 $resourceLink->load();
1418 if (is_null($resourceLink->id) && !empty($tempId)) {
1419 $resourceLink->ltiResourceLinkId = $tempId;
1420 $resourceLink->load();
1423 $resourceLink->setContext($context);
1426 return $resourceLink;
1439 $resourceLink->load($id);
1441 return $resourceLink;
1453 private function load(
int $id = null): bool
1469 if (empty($supportedTypes)) {
1470 $supportedTypes = explode(
1472 str_replace(
' ',
'', strtolower($this->
getSetting(
'ext_ims_lis_resultvalue_sourcedids', self::EXT_TYPE_DECIMAL)))
1475 $type = $ltiOutcome->type;
1478 $ok = in_array($type, $supportedTypes) || empty($value);
1481 if ($type === self::EXT_TYPE_PERCENTAGE) {
1482 if (substr($value, -1) ===
'%') {
1483 $value = substr($value, 0, -1);
1485 $ok = is_numeric($value) && ($value >= 0) && ($value <= 100);
1487 $ltiOutcome->
setValue($value / 100);
1488 $ltiOutcome->type = self::EXT_TYPE_DECIMAL;
1490 } elseif ($type === self::EXT_TYPE_RATIO) {
1491 $parts = explode(
'/', $value, 2);
1495 $ltiOutcome->type = self::EXT_TYPE_DECIMAL;
1498 } elseif ($type === self::EXT_TYPE_LETTER_AF) {
1499 if (in_array(self::EXT_TYPE_LETTER_AF_PLUS, $supportedTypes)) {
1501 $ltiOutcome->type = self::EXT_TYPE_LETTER_AF_PLUS;
1502 } elseif (in_array(self::EXT_TYPE_TEXT, $supportedTypes)) {
1504 $ltiOutcome->type = self::EXT_TYPE_TEXT;
1507 } elseif ($type === self::EXT_TYPE_LETTER_AF_PLUS) {
1508 if (in_array(self::EXT_TYPE_LETTER_AF, $supportedTypes) && (strlen($value) === 1)) {
1510 $ltiOutcome->type = self::EXT_TYPE_LETTER_AF;
1511 } elseif (in_array(self::EXT_TYPE_TEXT, $supportedTypes)) {
1513 $ltiOutcome->type = self::EXT_TYPE_TEXT;
1516 } elseif ($type === self::EXT_TYPE_TEXT) {
1517 $ok = is_numeric($value) && ($value >= 0) && ($value <= 1);
1519 $ltiOutcome->type = self::EXT_TYPE_DECIMAL;
1520 } elseif (substr($value, -1) ===
'%') {
1521 $value = substr($value, 0, -1);
1522 $ok = is_numeric($value) && ($value >= 0) && ($value <= 100);
1524 if (in_array(self::EXT_TYPE_PERCENTAGE, $supportedTypes)) {
1525 $ltiOutcome->type = self::EXT_TYPE_PERCENTAGE;
1527 $ltiOutcome->
setValue($value / 100);
1528 $ltiOutcome->type = self::EXT_TYPE_DECIMAL;
1549 $this->extRequest =
'';
1550 $this->extRequestHeaders =
'';
1551 $this->extResponse =
'';
1552 $this->extResponseHeaders =
'';
1553 $this->lastServiceRequest = null;
1555 $params[
'lti_version'] = $this->
getPlatform()->ltiVersion;
1556 $params[
'lti_message_type'] = $type;
1560 $accessToken = $this->platform->getAccessToken();
1562 if (empty($accessToken)) {
1564 $this->platform->setAccessToken($accessToken);
1570 $accessToken->expires = time();
1571 $accessToken->get($scope,
true);
1572 $this->platform->setAccessToken($accessToken);
1578 $signed = $this->
getPlatform()->addSignature($url, $params,
'POST',
'application/x-www-form-urlencoded');
1580 if (is_array($signed)) {
1581 $http =
new HttpMessage($url,
'POST', $signed);
1583 $http =
new HttpMessage($url,
'POST', $params, $signed);
1585 if (
$http->send()) {
1587 $this->extResponse =
$http->response;
1588 $this->extResponseHeaders =
$http->responseHeaders;
1591 $this->extDoc->loadXML(
$http->response);
1592 $this->extNodes = $this->
domnodeToArray($this->extDoc->documentElement);
1593 if (isset($this->extNodes[
'statusinfo'][
'codemajor']) && ($this->extNodes[
'statusinfo'][
'codemajor'] ===
'Success')) {
1599 $retry = $retry && !$newToken && !$ok;
1601 $accessToken = $this->platform->getAccessToken();
1602 $accessToken->expires = time();
1603 $accessToken->get($scope,
true);
1604 $this->platform->setAccessToken($accessToken);
1608 $this->extRequest =
$http->request;
1609 $this->extRequestHeaders =
$http->requestHeaders;
1610 $this->lastServiceRequest =
$http;
1625 $this->extRequest =
'';
1626 $this->extRequestHeaders =
'';
1627 $this->extResponse =
'';
1628 $this->extResponseHeaders =
'';
1629 $this->lastServiceRequest = null;
1632 $outcome = $resultService->get($userResult);
1633 $http = $resultService->getHttpMessage();
1634 $this->extResponse =
$http->response;
1635 $this->extResponseHeaders =
$http->responseHeaders;
1636 $this->extRequest =
$http->request;
1637 $this->extRequestHeaders =
$http->requestHeaders;
1638 $this->lastServiceRequest =
$http;
1654 $this->extRequest =
'';
1655 $this->extRequestHeaders =
'';
1656 $this->extResponse =
'';
1657 $this->extResponseHeaders =
'';
1658 $this->lastServiceRequest = null;
1661 $scoreService->submit($ltiOutcome, $userResult);
1662 $http = $scoreService->getHttpMessage();
1663 $this->extResponse =
$http->response;
1664 $this->extResponseHeaders =
$http->responseHeaders;
1666 $this->extRequest =
$http->request;
1667 $this->extRequestHeaders =
$http->requestHeaders;
1668 $this->lastServiceRequest =
$http;
1684 $this->extRequest =
'';
1685 $this->extRequestHeaders =
'';
1686 $this->extResponse =
'';
1687 $this->extResponseHeaders =
'';
1688 $this->lastServiceRequest = null;
1691 $xmlRequest = <<< EOD
1692 <?xml version =
"1.0" encoding =
"UTF-8"?>
1693 <imsx_POXEnvelopeRequest xmlns =
"http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0">
1695 <imsx_POXRequestHeaderInfo>
1696 <imsx_version>V1.0</imsx_version>
1697 <imsx_messageIdentifier>{$id}</imsx_messageIdentifier>
1698 </imsx_POXRequestHeaderInfo>
1705 </imsx_POXEnvelopeRequest>
1707 $scope =
'https://purl.imsglobal.org/spec/lti-bo/scope/basicoutcome';
1711 $accessToken = $this->platform->getAccessToken();
1713 if (empty($accessToken)) {
1715 $this->platform->setAccessToken($accessToken);
1721 $accessToken->expires = time();
1722 $accessToken->get(
$scope,
true);
1723 $this->platform->setAccessToken($accessToken);
1729 $header = $this->
getPlatform()->addSignature($url, $xmlRequest,
'POST',
'application/xml');
1731 $http = new \ILIAS\LTI\ToolProvider\Http\HttpMessage($url,
'POST', $xmlRequest, $header);
1732 if (
$http->send()) {
1734 $this->extResponse =
$http->response;
1735 $this->extResponseHeaders =
$http->responseHeaders;
1738 $this->extDoc->loadXML(
$http->response);
1739 $this->extNodes = $this->
domnodeToArray($this->extDoc->documentElement);
1740 if (isset($this->extNodes[
'imsx_POXHeader'][
'imsx_POXResponseHeaderInfo'][
'imsx_statusInfo'][
'imsx_codeMajor']) &&
1741 ($this->extNodes[
'imsx_POXHeader'][
'imsx_POXResponseHeaderInfo'][
'imsx_statusInfo'][
'imsx_codeMajor'] ===
'success')) {
1747 $retry = $retry && !$newToken && !$ok;
1749 $accessToken = $this->platform->getAccessToken();
1750 $accessToken->expires = time();
1751 $accessToken->get(
$scope,
true);
1752 $this->platform->setAccessToken($accessToken);
1756 $this->extRequest =
$http->request;
1757 $this->extRequestHeaders =
$http->requestHeaders;
1758 $this->lastServiceRequest =
$http;
1775 $lineItemService =
false;
1778 return $lineItemService;
1789 switch ($node->nodeType) {
1790 case XML_CDATA_SECTION_NODE:
1792 $output = trim($node->textContent);
1794 case XML_ELEMENT_NODE:
1795 for ($i = 0; $i < $node->childNodes->length; $i++) {
1796 $child = $node->childNodes->item($i);
1798 if (isset($child->tagName)) {
1799 $output[$child->tagName][] = $v;
1807 if (is_array($output)) {
1808 if ($node->hasAttributes()) {
1809 foreach ($node->attributes as $attrNode) {
1810 $output[
'@attributes'][$attrNode->name] = (string) $attrNode->value;
1813 foreach ($output as $t => $v) {
1814 if (is_array($v) && (count($v) === 1) && ($t !==
'@attributes')) {
1815 $output[$t] = $v[0];
getRecordId()
Get the context record ID.
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
static fromRecordId(int $id, \ILIAS\LTI\ToolProvider\DataConnector\DataConnector $dataConnector)
Load the context from the database.
Class to represent a platform context.
getDataConnector()
Get the data connector.