mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-34463 - lib - Alteration of the get_context_instance function to utilize the new function context_XXXX::instance().
This commit is contained in:
parent
3294034b80
commit
d40604724b
61 changed files with 95 additions and 100 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue