ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ltitoolregistration.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29require_once '../vendor/composer/vendor/autoload.php';
30require_once __DIR__ . '/../artifacts/bootstrap_default.php';
31entry_point('ILIAS Legacy Initialisation Adapter');
32
34
35global $DIC;
36
37$request = $DIC->http()->request();
38$body = $request->getParsedBody();
39$parameters = array_merge($request->getQueryParams(), is_array($body) ? $body : []);
40
41$log = $DIC->logger()->forComponent('lti');
42[$registered, $reason] = new ilLTIAdvantageToolRegistration()->register($parameters);
43if (!$registered) {
44 $log->warning('LTI Advantage Dynamic Registration of ILIAS failed: ' . $reason);
45}
46
47$lng = $DIC->language();
48$lng->loadLanguageModule('lti');
49$message = htmlspecialchars($lng->txt($registered ? 'lti_dyn_reg_tool_done' : 'lti_dyn_reg_tool_failed'), ENT_QUOTES);
50$close = htmlspecialchars($lng->txt('close'), ENT_QUOTES);
51$page = '<!DOCTYPE html><html lang="' . htmlspecialchars($lng->getLangKey(), ENT_QUOTES) . '"><head><meta charset="utf-8">'
52 . '<title>ILIAS</title></head><body style="font-family: sans-serif"><p>' . $message . '</p>'
53 . ($registered ? '' : '<p>' . htmlspecialchars($reason, ENT_QUOTES) . '</p>')
54 . '<button type="button" onclick="(window.opener || window.parent).postMessage({subject: \'org.imsglobal.lti.close\'}, \'*\');">'
55 . $close . '</button></body></html>';
56
57ilLTIResponse::send($registered ? 200 : 400, ilLTIResponse::CONTENT_TYPE_HTML, $page, ['Cache-Control' => 'no-store']);
const CONTEXT_SCORM
Definition: ilContext.php:42
static init(string $a_type)
Init context by type.
Definition: ilContext.php:52
LTI Advantage Dynamic Registration of ILIAS as tool with a platform of the administration.
register(array $parameters)
Registers ILIAS with the platform that opened the registration URL.
const string CONTENT_TYPE_HTML
global $DIC
if(! $registered) $lng
entry_point(string $name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: result1.php:21
catch(ilCmiXapiException $e) send($response)
Definition: xapitoken.php:99