Files
Xes 73154ae174
Behat tests 1.11.x 🐞 / PHP 7.4 Test on ubuntu-latest (push) Canceled after 0s
PHP-CS-Fixer / composer_install (7.4) (push) Canceled after 0s
Chamilo 1.11.40 (ZIP oficial v1.11.40)
Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip
sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439
Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
2026-08-06 17:59:45 +02:00

45 lines
1.6 KiB
PHP

<?php
/* For license terms, see /license.txt */
use ChamiloSession as Session;
require_once __DIR__.'/../../../main/inc/global.inc.php';
require_once __DIR__.'/../src/LtiProvider.php';
require_once __DIR__.'/../LtiProviderPlugin.php';
$launch = LtiProvider::create()->launch();
if (!$launch->hasNrps()) {
// throw new Exception("Don't have names and roles!");
}
$launchData = $launch->getLaunchData();
$plugin = LtiProviderPlugin::create();
$toolVars = $plugin->getToolProviderVars($launchData['aud']);
$login = LtiProvider::create()->validateUser($launchData, $toolVars['courseCode'], $toolVars['toolName']);
$ltiSession = [];
if ($login) {
$values = [];
$values['issuer'] = $launchData['iss'];
$values['user_id'] = api_get_user_id();
$values['client_uid'] = $launchData['sub'];
$values['course_code'] = $toolVars['courseCode'];
$values['tool_id'] = $toolVars['toolId'];
$values['tool_name'] = $toolVars['toolName'];
$values['lti_launch_id'] = $launch->getLaunchId();
$plugin->saveResult($values);
$ltiSession = $values;
}
$cidReq = 'cidReq='.$toolVars['courseCode'].'&id_session=0&gidReq=0&gradebook=0';
if ('lp' == $toolVars['toolName']) {
$launchUrl = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.$cidReq.'&action=view&lp_id='.$toolVars['toolId'].'&isStudentView=true&lti_launch_id='.$launch->getLaunchId();
} else {
$launchUrl = api_get_path(WEB_CODE_PATH).'exercise/overview.php?'.$cidReq.'&origin=embeddable&exerciseId='.$toolVars['toolId'].'&lti_launch_id='.$launch->getLaunchId();
}
$ltiSession['launch_url'] = $launchUrl;
Session::write('_ltiProvider', $ltiSession);
header('Location: '.$launchUrl);
exit;