MDL-47558 resource: allow to edit module without being redirected

Thanks to Nathan Lewis for the code suggestion
This commit is contained in:
Marina Glancy
2015-02-06 13:10:26 +08:00
parent 88cd577ef3
commit e2b8f37da5
+7
View File
@@ -94,6 +94,13 @@ if ($displaytype == RESOURCELIB_DISPLAY_OPEN || $displaytype == RESOURCELIB_DISP
}
}
// Don't redirect teachers, otherwise they can not access course or module settings.
if ($redirect && !course_get_format($course)->has_view_page() &&
(has_capability('moodle/course:manageactivities', $context) ||
has_capability('moodle/course:update', context_course::instance($course->id)))) {
$redirect = false;
}
if ($redirect) {
// coming from course page or url index page
// this redirect trick solves caching problems when tracking views ;-)