mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-62244 Resource: label view redirects to label, not course
This commit is contained in:
parent
f0eb6a5729
commit
2f8a102da7
@ -30,7 +30,7 @@ $l = optional_param('l',0,PARAM_INT); // Label ID
|
||||
|
||||
if ($id) {
|
||||
$PAGE->set_url('/mod/label/index.php', array('id'=>$id));
|
||||
if (! $cm = get_coursemodule_from_id('label', $id)) {
|
||||
if (! $cm = get_coursemodule_from_id('label', $id, 0, true)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
@ -50,13 +50,15 @@ if ($id) {
|
||||
if (! $course = $DB->get_record("course", array("id"=>$label->course)) ){
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
if (! $cm = get_coursemodule_from_instance("label", $label->id, $course->id)) {
|
||||
if (! $cm = get_coursemodule_from_instance("label", $label->id, $course->id, true)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
|
||||
require_login($course, true, $cm);
|
||||
|
||||
redirect("$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
$url = course_get_url($course, $cm->sectionnum, []);
|
||||
$url->set_anchor('module-' . $id);
|
||||
redirect($url);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user