◆ __construct()
◆ executeCommand()
ilLTIConsumerContentGUI::executeCommand |
( |
| ) |
|
◆ getEmbeddedAutoStartFormular()
ilLTIConsumerContentGUI::getEmbeddedAutoStartFormular |
( |
| ) |
|
|
protected |
Definition at line 261 of file class.ilLTIConsumerContentGUI.php.
References $context, $ltiMessageHint, CLIENT_ID, ilObjLTIConsumer\getIliasHttpPath(), initCmixUser(), ILIAS\Repository\object(), and ilSession\set().
Referenced by showEmbedded().
264 $user_ident = $this->cmixUser->getUsrIdent();
266 $context = $ilLTIConsumerLaunch->getContext();
267 $contextType = $ilLTIConsumerLaunch::getLTIContextType($context[
"type"]);
268 $contextId = $context[
"id"];
269 $contextTitle = $context[
"title"];
275 $output =
'<form id="lti_launch_form" name="lti_launch_form" action="' . $this->
object->getProvider()->getInitiateLogin() .
'" method="post" target="' . $target .
'" encType="application/x-www-form-urlencoded">';
277 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />',
'target_link_uri', $this->
object->getProvider()->getProviderUrl()) .
"\n";
278 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />',
'login_hint', $user_ident) .
"\n";
279 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />',
'lti_message_hint',
$ltiMessageHint) .
"\n";
280 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />',
'client_id', $this->
object->getProvider()->getClientId()) .
"\n";
281 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />',
'lti_deployment_id', $this->
object->getProvider()->getId()) .
"\n";
282 $output .=
'</form>';
284 $output .=
"<script type=\"text/javascript\">\n" .
286 "document.lti_launch_form.submit();\n" .
static getIliasHttpPath()
static set(string $a_var, $a_val)
Set a value.
◆ getLaunchParameters()
ilLTIConsumerContentGUI::getLaunchParameters |
( |
| ) |
|
|
protected |
Definition at line 329 of file class.ilLTIConsumerContentGUI.php.
References $token, ilCmiXapiAuthToken\fillToken(), ilLTIConsumerLaunch\getContext(), ilLTIConsumerLaunch\getLTIContextType(), and ILIAS\Repository\object().
Referenced by showEmbedded().
332 $launchContext = $ilLTIConsumerLaunch->
getContext();
335 $launchContextId = $launchContext[
"id"];
336 $launchContextTitle = $launchContext[
"title"];
339 $this->dic->user()->getId(),
340 $this->
object->getRefId(),
341 $this->
object->getId()
344 return $this->
object->buildLaunchParameters(
getContext(?array $a_valid_types=array('crs', 'grp', 'cat', 'root'))
get info about the context in which the link is used The most outer matching course or group is used ...
static fillToken(int $usrId, int $refId, int $objId, int $lrsTypeId=0)
static getLTIContextType(string $a_type)
◆ getLaunchParametersLTI13()
ilLTIConsumerContentGUI::getLaunchParametersLTI13 |
( |
string |
$endpoint, |
|
|
string |
$clientId, |
|
|
int |
$deploymentId, |
|
|
string |
$nonce |
|
) |
| |
|
protected |
◆ getLoginLTI13Form()
ilLTIConsumerContentGUI::getLoginLTI13Form |
( |
| ) |
|
|
protected |
Definition at line 112 of file class.ilLTIConsumerContentGUI.php.
References $params, $r, ilSession\clear(), ilSession\get(), getLaunchParametersLTI13(), initCmixUser(), null, ILIAS\Repository\object(), and validateLTI13InitalLogin().
Referenced by launch().
122 if (isset($loginData[
'state'])) {
123 $params[
'state'] = $loginData[
'state'];
126 $r =
'<form action="' . $loginData[
'redirect_uri'] .
"\" name=\"ltiAuthForm\" id=\"ltiAuthForm\" " .
127 "method=\"post\" enctype=\"application/x-www-form-urlencoded\">\n";
129 foreach (
$params as $key => $value) {
130 $key = htmlspecialchars($key);
131 $value = htmlspecialchars($value);
132 $r .=
" <input type=\"hidden\" name=\"{$key}\" value=\"{$value}\"/>\n";
136 $r .=
"<script type=\"text/javascript\">\n" .
138 "document.ltiAuthForm.submit();\n" .
static get(string $a_var)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
getLaunchParametersLTI13(string $endpoint, string $clientId, int $deploymentId, string $nonce)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
validateLTI13InitalLogin(array $loginData)
static clear(string $a_var)
◆ getRequestValue()
ilLTIConsumerContentGUI::getRequestValue |
( |
string |
$key, |
|
|
|
$default = null |
|
) |
| |
|
protected |
- Parameters
-
- Returns
- mixed|null
Definition at line 498 of file class.ilLTIConsumerContentGUI.php.
References $DIC, and null.
501 if (isset($DIC->http()->request()->getQueryParams()[$key])) {
502 return $DIC->http()->request()->getQueryParams()[$key];
505 if (isset($DIC->http()->request()->getParsedBody()[$key])) {
506 return $DIC->http()->request()->getParsedBody()[$key];
509 return $default ??
null;
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ getStartButtonTxt11()
ilLTIConsumerContentGUI::getStartButtonTxt11 |
( |
| ) |
|
|
protected |
Definition at line 146 of file class.ilLTIConsumerContentGUI.php.
References $context, $token, ilLTIConsumeProvider\AVAILABILITY_NONE, ilCmiXapiAuthToken\fillToken(), ilCmiXapiUser\getIdent(), ilObjLTIConsumer\getIliasHttpPath(), ilCmiXapiUser\getUsrIdent(), ILIAS\Repository\lng(), null, ILIAS\Repository\object(), ilCmiXapiUser\save(), ilCmiXapiUser\setUsrIdent(), and ILIAS\Repository\user().
Referenced by launch().
148 if ($this->
object->getOfflineStatus() ||
149 $this->
object->isLaunchMethodEmbedded() ||
156 $this->
user->getId(),
157 $this->
object->getProvider()->getPrivacyIdent()
160 if ($user_ident ==
'' || $user_ident ==
null) {
166 $context = $ilLTIConsumerLaunch->getContext();
167 $contextType = $ilLTIConsumerLaunch::getLTIContextType($context[
"type"]);
168 $contextId = $context[
"id"];
169 $contextTitle = $context[
"title"];
172 $this->dic->user()->getId(),
173 $this->
object->getRefId(),
174 $this->
object->getId()
177 $returnUrl = !$this->
object->isLaunchMethodOwnWin() ?
'' : str_replace(
183 $launchParameters = $this->
object->buildLaunchParameters(
192 $target = $this->
object->getLaunchMethod() ==
"newWin" ?
"_blank" :
"_self";
193 $button =
'<input class="btn btn-default ilPre" type="button" onClick="ltilaunch()" value = "' . $this->
lng->txt(
"show_content") .
'" />';
194 $output =
'<form id="lti_launch_form" name="lti_launch_form" action="' . $this->
object->getProvider()->getProviderUrl() .
'" method="post" target="' . $target .
'" encType="application/x-www-form-urlencoded">';
195 foreach ($launchParameters as $field => $value) {
196 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />', $field, $value) .
"\n";
199 $output .=
'</form>';
200 $output .=
'<span id ="lti_launched" style="display:none">' . $this->
lng->txt(
"launched") .
'</span>';
201 $output .=
'<script type="text/javascript"> 202 function ltilaunch() { 203 document.lti_launch_form.submit(); 204 document.getElementById("lti_launch_form").style.display = "none"; 205 document.getElementById("lti_launched").style.display = "inline";
static fillToken(int $usrId, int $refId, int $objId, int $lrsTypeId=0)
static getIdent(int $userIdentMode, ilObjUser $user)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getIliasHttpPath()
setUsrIdent(string $usrIdent)
◆ getStartButtonTxt13()
ilLTIConsumerContentGUI::getStartButtonTxt13 |
( |
| ) |
|
|
protected |
Definition at line 210 of file class.ilLTIConsumerContentGUI.php.
References $context, $ltiMessageHint, $token, ilLTIConsumeProvider\AVAILABILITY_NONE, CLIENT_ID, ilCmiXapiAuthToken\fillToken(), ilObjLTIConsumer\getIliasHttpPath(), initCmixUser(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilSession\set().
Referenced by launch().
212 if ($this->
object->getOfflineStatus() ||
213 $this->
object->isLaunchMethodEmbedded() ||
218 $user_ident = $this->cmixUser->getUsrIdent();
220 $context = $ilLTIConsumerLaunch->getContext();
221 $contextType = $ilLTIConsumerLaunch::getLTIContextType($context[
"type"]);
222 $contextId = $context[
"id"];
223 $contextTitle = $context[
"title"];
226 $this->dic->user()->getId(),
227 $this->
object->getRefId(),
228 $this->
object->getId()
231 $returnUrl = !$this->
object->isLaunchMethodOwnWin() ?
'' : str_replace(
237 $target = $this->
object->getLaunchMethod() ==
"newWin" ?
"_blank" :
"_self";
238 $button =
'<input class="btn btn-default ilPre" type="button" onClick="ltilaunch()" value = "' . $this->
lng->txt(
"show_content") .
'" />';
241 $output =
'<form id="lti_launch_form" name="lti_launch_form" action="' . $this->
object->getProvider()->getInitiateLogin() .
'" method="post" target="' . $target .
'" encType="application/x-www-form-urlencoded">';
243 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />',
'target_link_uri', $this->
object->getProvider()->getProviderUrl()) .
"\n";
244 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />',
'login_hint', $user_ident) .
"\n";
245 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />',
'lti_message_hint',
$ltiMessageHint) .
"\n";
246 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />',
'client_id', $this->
object->getProvider()->getClientId()) .
"\n";
247 $output .= sprintf(
'<input type="hidden" name="%s" value="%s" />',
'lti_deployment_id', $this->
object->getProvider()->getId()) .
"\n";
249 $output .=
'</form>';
250 $output .=
'<span id ="lti_launched" style="display:none">' . $this->
lng->txt(
"launched") .
'</span>';
251 $output .=
'<script type="text/javascript"> 252 function ltilaunch() { 253 document.lti_launch_form.submit(); 254 document.getElementById("lti_launch_form").style.display = "none"; 255 document.getElementById("lti_launched").style.display = "inline";
static fillToken(int $usrId, int $refId, int $objId, int $lrsTypeId=0)
static getIliasHttpPath()
static set(string $a_var, $a_val)
Set a value.
◆ initCmixUser()
ilLTIConsumerContentGUI::initCmixUser |
( |
| ) |
|
|
protected |
◆ isEmbeddedLaunchRequest()
static ilLTIConsumerContentGUI::isEmbeddedLaunchRequest |
( |
| ) |
|
|
static |
◆ launch()
ilLTIConsumerContentGUI::launch |
( |
| ) |
|
|
protected |
- Exceptions
-
Definition at line 72 of file class.ilLTIConsumerContentGUI.php.
References $response, ilSession\get(), getLoginLTI13Form(), getStartButtonTxt11(), getStartButtonTxt13(), null, and ILIAS\Repository\object().
74 if ($this->
object->getProvider()->getLtiVersion() ==
"LTI-1p0") {
75 if ($this->
object->isLaunchMethodEmbedded()) {
76 $tpl =
new ilTemplate(
'tpl.lti_content.html',
true,
true,
'components/ILIAS/LTIConsumer');
77 $tpl->setVariable(
"EMBEDDED_IFRAME_SRC", $this->dic->ctrl()->getLinkTarget(
79 self::CMD_SHOW_EMBEDDED
81 $this->dic->ui()->mainTemplate()->setContent($tpl->get());
87 $tpl =
new ilTemplate(
'tpl.lti_content.html',
true,
true,
'components/ILIAS/LTIConsumer');
88 $tpl->setVariable(
"EMBEDDED_IFRAME_SRC", $this->dic->ctrl()->getLinkTarget(
90 self::CMD_SHOW_EMBEDDED
92 $this->dic->ui()->mainTemplate()->setContent($tpl->get());
98 $this->dic->ui()->mainTemplate()->setOnScreenMessage(
'failure',
'initialLogin Error: ',
true);
101 $this->dic->http()->saveResponse(
$response);
102 $this->dic->http()->sendResponse();
103 $this->dic->http()->close();
static get(string $a_var)
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ showEmbedded()
ilLTIConsumerContentGUI::showEmbedded |
( |
| ) |
|
|
protected |
- Exceptions
-
Definition at line 297 of file class.ilLTIConsumerContentGUI.php.
References $response, exit, getEmbeddedAutoStartFormular(), ilUtil\getImagePath(), getLaunchParameters(), ILIAS_VERSION_NUMERIC, initCmixUser(), and ILIAS\Repository\object().
299 if ($this->
object->getProvider()->getLtiVersion() ==
"LTI-1p0") {
301 $tpl =
new ilTemplate(
'tpl.lti_embedded.html',
true,
true,
'components/ILIAS/LTIConsumer');
303 $tpl->setCurrentBlock(
'launch_parameter');
304 $tpl->setVariable(
'LAUNCH_PARAMETER', $field);
305 $tpl->setVariable(
'LAUNCH_PARAM_VALUE', $value);
306 $tpl->parseCurrentBlock();
310 $tpl->setVariable(
"DELOS_CSS_HREF",
'templates/default/delos.css' . $v);
311 $tpl->setVariable(
"JQUERY_SRC",
'public/node_modules/jquery/dist/jquery.js' . $v);
314 $tpl->setVariable(
'LAUNCH_URL', $this->
object->getProvider()->getProviderUrl());
316 #$DIC->ui()->mainTemplate()->getStandardTemplate(); 317 #$DIC->ui()->mainTemplate()->setContent($tpl->get()); 323 $this->dic->http()->saveResponse(
$response);
324 $this->dic->http()->sendResponse();
325 $this->dic->http()->close();
Interface Observer Contains several chained tasks and infos about them.
const ILIAS_VERSION_NUMERIC
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getEmbeddedAutoStartFormular()
◆ validateLTI13InitalLogin()
ilLTIConsumerContentGUI::validateLTI13InitalLogin |
( |
array |
$loginData | ) |
|
|
private |
Definition at line 401 of file class.ilLTIConsumerContentGUI.php.
References $ref_id, $scope, ilSession\get(), ilCmiXapiUser\getIdent(), ilCmiXapiUser\getUsrIdent(), ILIAS\Repository\int(), null, ILIAS\Repository\object(), ilCmiXapiUser\save(), ilCmiXapiUser\setUsrIdent(), and ILIAS\Repository\user().
Referenced by getLoginLTI13Form().
403 $scope = $loginData[
'scope'];
404 $responsetype = $loginData[
'response_type'];
405 $clientid = $loginData[
'client_id'];
406 $redirecturi = $loginData[
'redirect_uri'];
407 $loginhint = $loginData[
'login_hint'];
408 $ltimessagehint = $loginData[
'lti_message_hint'];
409 $state = $loginData[
'state'];
410 $responsemode = $loginData[
'response_mode'];
411 $nonce = $loginData[
'nonce'];
412 $prompt = $loginData[
'prompt'];
414 $ok = !empty(
$scope) && !empty($responsetype) && !empty($clientid) &&
415 !empty($redirecturi) && !empty($loginhint) &&
419 $error =
'invalid_request';
421 if ($ok && (
$scope !==
'openid')) {
423 $error =
'invalid_scope';
425 if ($ok && ($responsetype !==
'id_token')) {
427 $error =
'unsupported_response_type';
433 $error =
'invalid_request';
435 if ($this->
object->getProvider()->getClientId() !== $clientid) {
437 $error =
'unauthorized_client';
444 $this->
user->getId(),
445 $this->
object->getProvider()->getPrivacyIdent()
449 if ($user_ident ==
'' || $user_ident ==
null) {
455 if ((
string) $loginhint !== $user_ident) {
457 $error =
'access_denied';
460 $uris =
array_map(
"trim", explode(
",", $this->
object->getProvider()->getRedirectionUris()));
461 if (!in_array($redirecturi, $uris)) {
463 $error =
'invalid_request';
467 if (isset($responsemode)) {
468 $ok = ($responsemode ===
'form_post');
470 $error =
'invalid_request';
471 $desc =
'Invalid response_mode';
475 $error =
'invalid_request';
476 $desc =
'Missing response_mode';
479 if ($ok && !empty($prompt) && ($prompt !==
'none')) {
481 $error =
'invalid_request';
482 $desc =
'Invalid prompt';
static get(string $a_var)
static getIdent(int $userIdentMode, ilObjUser $user)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setUsrIdent(string $usrIdent)
◆ $cmixUser
◆ $dic
ILIAS DI Container ilLTIConsumerContentGUI::$dic |
|
private |
◆ $lng
◆ $object
◆ $user
◆ CMD_LAUNCH
const ilLTIConsumerContentGUI::CMD_LAUNCH = 'launch' |
◆ CMD_SHOW_EMBEDDED
const ilLTIConsumerContentGUI::CMD_SHOW_EMBEDDED = 'showEmbedded' |
The documentation for this class was generated from the following file: