Verified Commit 2dd4bbd5 authored by David Beniamine's avatar David Beniamine
Browse files

Directly redirect to LNB for user binding/creation

parent b4e5eec5
......@@ -13,7 +13,6 @@ require_once \dirname(__DIR__, 2) . '/config.php';
$returnUrl = \base64_decode(required_param('return', PARAM_ALPHANUM));
$courseid = required_param('courseid', PARAM_INT);
$create = optional_param('create', false, PARAM_BOOL);
$course = $DB->get_record('course', ['id' => $courseid], '*', MUST_EXIST);
......@@ -22,34 +21,7 @@ $fetchInstitution = new fetch\institution();
$context = context_course::instance($courseid);
$isTeacher = has_capability('mod/labnbook:addinstance', $context);
$role = ($isTeacher ? 'teacher' : 'learner');
/* @var $PAGE moodle_page */
global $PAGE;
global $USER;
/* @var $OUTPUT moodle_core_output */
global $OUTPUT;
echo $OUTPUT->header();
Vous n'avez pas de compte dans LabNbook, ou ce compte n'est pas encore connu de Moodle.
<div class="container-fluid">
<div class="row">
<div class="col" style="text-align: center">
<form action="<?= $fetchInstitution->getRedirectUrl(); ?>" method="GET">
<input type="hidden" name="token" value="<?= $fetchInstitution->getBindingTokenForRedirect($CFG->wwwroot . $returnUrl, $role, $USER); ?>" />
<button type="submit" class="btn btn-primary">Se connecter à LabNbook</button>
echo $OUTPUT->footer();
$url = $fetchInstitution->getRedirectUrl();
$token=$fetchInstitution->getBindingTokenForRedirect($CFG->wwwroot . $returnUrl, $role, $USER);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment