Skip to content

Commit

Permalink
Set proper lti context id (needs latest tsugi as of 03/2024)
Browse files Browse the repository at this point in the history
  • Loading branch information
torinfo committed Apr 1, 2024
1 parent 78b6741 commit a4f4733
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lti_launch.php
Expand Up @@ -71,6 +71,7 @@
$nrps = $LAUNCH->context->loadNamesAndRoles(false, $msg);
//DONE: get all emails of current users add to array
// https://gitlab.tor.nl/xerte-dashboard/dashboard/-/blob/master/index.php line 80
_debug('LTI 1.3 names and roles result: ' . print_r($nrps, true));
$xerte_toolkits_site->lti_users = array();
foreach ($nrps->members as $i => $member){
if ($member->status == 'Active' && in_array('Learner', $member->roles))
Expand Down Expand Up @@ -135,18 +136,33 @@
{
$xerte_toolkits_site->module = $module;
}
if (isset($LAUNCH->context->context_id))
{
$lticontextid = $LAUNCH->context->context_id;
_debug('Context id set from context->context_id');
}
else
{
$lticontextid = $LAUNCH->ltiParameter('context_id');
if ($lticontextid !== false)
{
_debug('Context id set from parameter');
}
if ($lticontextid === false)
{
$lticontextid = $LAUNCH->ltiCustomGet('context_id');
_debug('Context id set from custom parameter');
}
if ($lticontextid===false && isset($_REQUEST['context_id']))
{
$lticontextid = $_REQUEST['context_id'];
_debug('Context id set from request');
}
if ($lticontextid === false)
{
$lticontextid = $LAUNCH->context->id;
_debug('Context id set from context->id');
}
}
if ($lticontextid !== false)
{
Expand Down

0 comments on commit a4f4733

Please sign in to comment.