MDL-34463 - lib - Alteration of the get_context_instance function to utilize the new function context_XXXX::instance().

This commit is contained in:
Adrian Greeve 2012-07-24 14:04:40 +08:00
parent 3294034b80
commit d40604724b
61 changed files with 95 additions and 100 deletions

View file

@ -38,8 +38,8 @@ if (!$course = $DB->get_record('course', array('id' => $courseid))) {
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
$context = context_course::instance($course->id);
$systemcontext = context_system::instance();
require_capability('gradereport/overview:view', $context);
if (empty($userid)) {
@ -64,7 +64,7 @@ if (has_capability('moodle/grade:viewall', $systemcontext)) {
//ok - can view own course grades
$access = true;
} else if (has_capability('moodle/grade:viewall', get_context_instance(CONTEXT_USER, $userid)) and $course->showgrades) {
} else if (has_capability('moodle/grade:viewall', context_user::instance($userid)) and $course->showgrades) {
// ok - can view grades of this user- parent most probably
$access = true;
}

View file

@ -122,7 +122,7 @@ class grade_report_overview extends grade_report {
continue;
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$coursecontext = context_course::instance($course->id);
if (!$course->visible && !has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
// The course is hidden and the user isn't allowed to see it