Merge branch 'wip-MDL-42577-master' of git://github.com/marinaglancy/moodle

This commit is contained in:
Sam Hemelryk 2013-11-04 14:24:46 +08:00
commit 8e23283cbb

View File

@ -79,8 +79,25 @@ if ($displaytype == RESOURCELIB_DISPLAY_OPEN) {
if ($redirect) {
// coming from course page or url index page,
// the redirection is needed for completion tracking and logging
$fullurl = url_get_full_url($url, $cm, $course);
redirect(str_replace('&', '&', $fullurl));
$fullurl = str_replace('&', '&', url_get_full_url($url, $cm, $course));
if (!course_get_format($course)->has_view_page()) {
// If course format does not have a view page, add redirection delay with a link to the edit page.
// Otherwise teacher is redirected to the external URL without any possibility to edit activity or course settings.
$editurl = null;
if (has_capability('moodle/course:manageactivities', $context)) {
$editurl = new moodle_url('/course/modedit.php', array('update' => $cm->id));
$edittext = get_string('editthisactivity');
} else if (has_capability('moodle/course:update', $context->get_course_context())) {
$editurl = new moodle_url('/course/edit.php', array('id' => $course->id));
$edittext = get_string('editcoursesettings');
}
if ($editurl) {
redirect($fullurl, html_writer::link($editurl, $edittext)."<br/>".
get_string('pageshouldredirect'), 10);
}
}
redirect($fullurl);
}
switch ($displaytype) {