Avoid a set_url notice on this page when user isn't enrolled

This commit is contained in:
Martin Dougiamas 2010-05-02 09:12:18 +00:00
parent e35fb47974
commit 088e33633b

View File

@ -35,6 +35,8 @@
}
}
$PAGE->set_url('/course/view.php', array('id' => $course->id)); // Defined here to avoid notices on errors etc
preload_course_contexts($course->id);
if (!$context = get_context_instance(CONTEXT_COURSE, $course->id)) {
print_error('nocontext');
@ -89,7 +91,6 @@
$course->format = 'weeks'; // Default format is weeks
}
$PAGE->set_url('/course/view.php', array('id' => $course->id));
$PAGE->set_pagelayout('course');
$PAGE->set_pagetype('course-view-' . $course->format);
$PAGE->set_other_editing_capability('moodle/course:manageactivities');