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

@ -39,7 +39,7 @@ if (!$course = $DB->get_record('course', array('id' => $courseid))) {
require_login($course);
$PAGE->set_pagelayout('report');
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$context = context_course::instance($course->id);
require_capability('gradereport/user:view', $context);
if (empty($userid)) {
@ -60,7 +60,7 @@ if (has_capability('moodle/grade:viewall', $context)) {
//ok - can view own 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

@ -203,7 +203,7 @@ class grade_report_user extends grade_report {
$this->tabledata = array();
$this->canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $this->courseid));
$this->canviewhidden = has_capability('moodle/grade:viewhidden', context_course::instance($this->courseid));
// get the user (for full name)
$this->user = $DB->get_record('user', array('id' => $userid));
@ -870,7 +870,7 @@ function grade_report_user_profilereport($course, $user) {
global $OUTPUT;
if (!empty($course->showgrades)) {
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$context = context_course::instance($course->id);
//first make sure we have proper final grades - this must be done before constructing of the grade tree
grade_regrade_final_grades($course->id);