Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LabNbook
LabNbook-Moodle
Commits
2dd4bbd5
Verified
Commit
2dd4bbd5
authored
Sep 11, 2020
by
David Beniamine
Browse files
Directly redirect to LNB for user binding/creation
parent
b4e5eec5
Changes
1
Hide whitespace changes
Inline
Side-by-side
user-binding.php
View file @
2dd4bbd5
...
...
@@ -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
);
require_login
(
$course
);
...
...
@@ -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
;
$PAGE
->
set_url
(
'/mod/labnbook/user-binding.php'
);
$PAGE
->
set_title
(
"LabNbook"
);
$PAGE
->
set_heading
(
"LabNbook"
);
$PAGE
->
set_context
(
$context
);
/* @var $OUTPUT moodle_core_output */
global
$OUTPUT
;
echo
$OUTPUT
->
header
();
?>
<p>
Vous n'avez pas de compte dans LabNbook, ou ce compte n'est pas encore connu de Moodle.
</p>
<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>
</form>
</div>
</div>
</div>
<?php
echo
$OUTPUT
->
footer
();
$url
=
$fetchInstitution
->
getRedirectUrl
();
$token
=
$fetchInstitution
->
getBindingTokenForRedirect
(
$CFG
->
wwwroot
.
$returnUrl
,
$role
,
$USER
);
redirect
(
$url
.
"?token="
.
$token
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment