mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56:38 +02:00
Merge branch 'MDL-56339-master' of git://github.com/junpataleta/moodle
This commit is contained in:
commit
85c9053aec
1 changed files with 13 additions and 8 deletions
|
@ -287,6 +287,9 @@ class tool_provider extends ToolProvider {
|
||||||
helper::update_user_profile_image($user->id, $image);
|
helper::update_user_profile_image($user->id, $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if we need to force the page layout to embedded.
|
||||||
|
$isforceembed = $this->resourceLink->getSetting('custom_force_embed') == 1;
|
||||||
|
|
||||||
// Check if we are an instructor.
|
// Check if we are an instructor.
|
||||||
$isinstructor = $this->user->isStaff() || $this->user->isAdmin();
|
$isinstructor = $this->user->isStaff() || $this->user->isAdmin();
|
||||||
|
|
||||||
|
@ -294,25 +297,27 @@ class tool_provider extends ToolProvider {
|
||||||
$courseid = $context->instanceid;
|
$courseid = $context->instanceid;
|
||||||
$urltogo = new moodle_url('/course/view.php', ['id' => $courseid]);
|
$urltogo = new moodle_url('/course/view.php', ['id' => $courseid]);
|
||||||
|
|
||||||
// May still be set from previous session, so unset it.
|
|
||||||
unset($SESSION->forcepagelayout);
|
|
||||||
} else if ($context->contextlevel == CONTEXT_MODULE) {
|
} else if ($context->contextlevel == CONTEXT_MODULE) {
|
||||||
$cm = get_coursemodule_from_id(false, $context->instanceid, 0, false, MUST_EXIST);
|
$cm = get_coursemodule_from_id(false, $context->instanceid, 0, false, MUST_EXIST);
|
||||||
$urltogo = new moodle_url('/mod/' . $cm->modname . '/view.php', ['id' => $cm->id]);
|
$urltogo = new moodle_url('/mod/' . $cm->modname . '/view.php', ['id' => $cm->id]);
|
||||||
|
|
||||||
// If we are a student in the course module context we do not want to display blocks.
|
// If we are a student in the course module context we do not want to display blocks.
|
||||||
if (!$isinstructor) {
|
if (!$isforceembed && !$isinstructor) {
|
||||||
// Force the page layout.
|
$isforceembed = true;
|
||||||
$SESSION->forcepagelayout = 'embedded';
|
|
||||||
} else {
|
|
||||||
// May still be set from previous session, so unset it.
|
|
||||||
unset($SESSION->forcepagelayout);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print_error('invalidcontext');
|
print_error('invalidcontext');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force page layout to embedded if necessary.
|
||||||
|
if ($isforceembed) {
|
||||||
|
$SESSION->forcepagelayout = 'embedded';
|
||||||
|
} else {
|
||||||
|
// May still be set from previous session, so unset it.
|
||||||
|
unset($SESSION->forcepagelayout);
|
||||||
|
}
|
||||||
|
|
||||||
// Enrol the user in the course with no role.
|
// Enrol the user in the course with no role.
|
||||||
$result = helper::enrol_user($tool, $user->id);
|
$result = helper::enrol_user($tool, $user->id);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue