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

@ -29,7 +29,7 @@ if (empty($CFG->gradepublishing)) {
print_error('gradepubdisable');
}
$context = get_context_instance(CONTEXT_COURSE, $id);
$context = context_course::instance($id);
require_capability('gradeexport/txt:publish', $context);
// use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa

View file

@ -34,7 +34,7 @@ if (!$course = $DB->get_record('course', array('id'=>$id))) {
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $id);
$context = context_course::instance($id);
require_capability('moodle/grade:export', $context);
require_capability('gradeexport/txt:view', $context);

View file

@ -74,7 +74,7 @@ class grade_export_txt extends grade_export {
@header('Pragma: no-cache');
}
header("Content-Type: application/download\n");
$shortname = format_string($this->course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $this->course->id)));
$shortname = format_string($this->course->shortname, true, array('context' => context_course::instance($this->course->id)));
$downloadfilename = clean_filename("$shortname $strgrades");
header("Content-Disposition: attachment; filename=\"$downloadfilename.txt\"");

View file

@ -28,7 +28,7 @@ if (!$course = $DB->get_record('course', array('id'=>$id))) {
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $id);
$context = context_course::instance($id);
require_capability('moodle/grade:export', $context);
require_capability('gradeexport/txt:view', $context);