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
|
@ -39,7 +39,7 @@ $newvalue = optional_param('newvalue', false, PARAM_MULTILANG);
|
|||
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
||||
print_error('nocourseid');
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
require_login($course);
|
||||
|
||||
switch ($action) {
|
||||
|
|
|
@ -46,7 +46,7 @@ if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
|||
print_error('nocourseid');
|
||||
}
|
||||
require_login($course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
require_capability('gradereport/grader:view', $context);
|
||||
require_capability('moodle/grade:viewall', $context);
|
||||
|
|
|
@ -107,7 +107,7 @@ class grade_report_grader extends grade_report {
|
|||
global $CFG;
|
||||
parent::__construct($courseid, $gpr, $context, $page);
|
||||
|
||||
$this->canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $this->course->id));
|
||||
$this->canviewhidden = has_capability('moodle/grade:viewhidden', context_course::instance($this->course->id));
|
||||
|
||||
// load collapsed settings for this report
|
||||
if ($collapsed = get_user_preferences('grade_report_grader_collapsed_categories')) {
|
||||
|
|
|
@ -40,8 +40,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/grader:view', $context);
|
||||
|
||||
require('preferences_form.php');
|
||||
|
|
|
@ -40,8 +40,7 @@ class grader_report_preferences_form extends moodleform {
|
|||
$mform =& $this->_form;
|
||||
$course = $this->_customdata['course'];
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
$canviewhidden = has_capability('moodle/grade:viewhidden', $context);
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ if (!$item = $DB->get_record('grade_items', array('id' => $itemid))) {
|
|||
}
|
||||
|
||||
require_login($course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
require_capability('gradereport/grader:view', $context);
|
||||
require_capability('moodle/grade:viewall', $context);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
$row = $tabs = array();
|
||||
$tabcontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
|
||||
$tabcontext = context_course::instance($COURSE->id);
|
||||
$row[] = new tabobject('graderreport',
|
||||
$CFG->wwwroot.'/grade/report/grader/index.php?id='.$courseid,
|
||||
get_string('pluginname', 'gradereport_grader'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue