Replaced deprecated get_system_context() with the new context_system::instance()

This commit is contained in:
David Mudrak 2011-11-02 23:35:05 +01:00
parent d6d341d09b
commit dd736a87ee
3 changed files with 7 additions and 7 deletions

View File

@ -518,7 +518,7 @@ class grading_manager {
$name = $method . '_' . sha1(rand().uniqid($method, true));
// create new area record
$area = array(
'contextid' => get_system_context()->id,
'contextid' => context_system::instance()->id,
'component' => 'core_grading',
'areaname' => $name,
'activemethod' => $method);

View File

@ -99,7 +99,7 @@ if (!empty($setmethod)) {
// publish the form as a template
if (!empty($shareform)) {
require_capability('moodle/grade:sharegradingforms', get_system_context());
require_capability('moodle/grade:sharegradingforms', context_system::instance());
$controller = $manager->get_controller($method);
$definition = $controller->get_definition();
if (!$confirmed) {
@ -168,7 +168,7 @@ if (!empty($method)) {
echo $output->management_action_icon(new moodle_url($PAGE->url, array('deleteform' => $definition->id)),
get_string('manageactiondelete', 'core_grading'), 'b/edit-delete');
// icon to save the form as a new template
if (has_capability('moodle/grade:sharegradingforms', get_system_context())) {
if (has_capability('moodle/grade:sharegradingforms', context_system::instance())) {
if (empty($definition->copiedfromid)) {
$hasoriginal = false;
} else {

View File

@ -56,8 +56,8 @@ require_login($course, true, $cm);
require_capability('moodle/grade:managegradingforms', $context);
// user's capability in the templates bank
$canshare = has_capability('moodle/grade:sharegradingforms', get_system_context());
$canmanage = has_capability('moodle/grade:managesharedforms', get_system_context());
$canshare = has_capability('moodle/grade:sharegradingforms', context_system::instance());
$canmanage = has_capability('moodle/grade:managesharedforms', context_system::instance());
// setup the page
$PAGE->set_url(new moodle_url('/grade/grading/pick.php', array('targetid' => $targetid)));
@ -158,13 +158,13 @@ $params = array($method);
if (!$includeownforms) {
// search for public templates only
$sql .= " AND ga.contextid = ? AND ga.component = 'core_grading'";
$params[] = get_system_context()->id;
$params[] = context_system::instance()->id;
} else {
// search both templates and own forms in other areas
$sql .= " AND ((ga.contextid = ? AND ga.component = 'core_grading')
OR (gd.usercreated = ? AND gd.status = ?))";
$params = array_merge($params, array(get_system_context()->id, $USER->id,
$params = array_merge($params, array(context_system::instance()->id, $USER->id,
gradingform_controller::DEFINITION_STATUS_READY));
}