mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +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
|
@ -119,7 +119,7 @@ class grade_export_form extends moodleform {
|
|||
|
||||
if ($grade_items = $gseq->items) {
|
||||
$needs_multiselect = false;
|
||||
$canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $COURSE->id));
|
||||
$canviewhidden = has_capability('moodle/grade:viewhidden', context_course::instance($COURSE->id));
|
||||
|
||||
foreach ($grade_items as $grade_item) {
|
||||
// Is the grade_item hidden? If so, can the user see hidden grade_items?
|
||||
|
|
|
@ -59,7 +59,7 @@ if ($id) {
|
|||
$key->courseid = $course->id;
|
||||
|
||||
require_login($course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
require_capability('moodle/grade:export', $context);
|
||||
|
||||
// extra security check
|
||||
|
|
|
@ -35,7 +35,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);
|
||||
|
||||
|
|
|
@ -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/ods:publish', $context);
|
||||
|
||||
// use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
|
||||
|
|
|
@ -33,7 +33,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/ods:view', $context);
|
||||
|
|
|
@ -32,7 +32,7 @@ class grade_export_ods extends grade_export {
|
|||
|
||||
$strgrades = get_string('grades');
|
||||
|
||||
$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)));
|
||||
|
||||
// Calculate file name
|
||||
$downloadfilename = clean_filename("$shortname $strgrades.ods");
|
||||
|
|
|
@ -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/ods:view', $context);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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\"");
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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/xls:publish', $context);
|
||||
|
||||
// use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
|
||||
|
|
|
@ -33,7 +33,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/xls:view', $context);
|
||||
|
|
|
@ -33,7 +33,7 @@ class grade_export_xls extends grade_export {
|
|||
$strgrades = get_string('grades');
|
||||
|
||||
// Calculate file name
|
||||
$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.xls");
|
||||
// Creating a workbook
|
||||
$workbook = new MoodleExcelWorkbook("-");
|
||||
|
|
|
@ -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/xls:view', $context);
|
||||
|
|
|
@ -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/xml:publish', $context);
|
||||
|
||||
// use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
|
||||
|
|
|
@ -33,7 +33,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/xml:view', $context);
|
||||
|
|
|
@ -38,7 +38,7 @@ class grade_export_xml extends grade_export {
|
|||
$strgrades = get_string('grades');
|
||||
|
||||
/// Calculate file name
|
||||
$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.xml");
|
||||
|
||||
make_temp_directory('gradeexport');
|
||||
|
|
|
@ -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/xml:view', $context);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue