Merge branch 'MDL-34461-master-integration' of git://github.com/FMCorz/moodle
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ $action = required_param('action', PARAM_ALPHANUMEXT);
|
||||
$PAGE->set_url(new moodle_url('/enrol/ajax.php', array('id'=>$id, 'action'=>$action)));
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
throw new moodle_exception('invalidcourse');
|
||||
|
||||
@@ -206,7 +206,7 @@ function send_welcome_messages($orderdata) {
|
||||
$sender = get_admin();
|
||||
}
|
||||
else {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $ei->courseid);
|
||||
$context = context_course::instance($ei->courseid);
|
||||
$paymentmanagers = get_users_by_capability($context, 'enrol/authorize:managepayments', '', '', '0', '1');
|
||||
$sender = array_shift($paymentmanagers);
|
||||
}
|
||||
@@ -217,7 +217,7 @@ function send_welcome_messages($orderdata) {
|
||||
$lastuserid = $ei->userid;
|
||||
|
||||
while ($ei && $ei->userid == $lastuserid) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $ei->courseid);
|
||||
$context = context_course::instance($ei->courseid);
|
||||
$usercourses[] = format_string($ei->fullname, true, array('context' => $context));
|
||||
if (!$rs->valid()) {
|
||||
break;
|
||||
@@ -233,7 +233,7 @@ function send_welcome_messages($orderdata) {
|
||||
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$lastuserid";
|
||||
$a->paymenturl = "$CFG->wwwroot/enrol/authorize/index.php?user=$lastuserid";
|
||||
$emailmessage = get_string('welcometocoursesemail', 'enrol_authorize', $a);
|
||||
$subject = get_string("enrolmentnew", 'enrol', format_string($SITE->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID))));
|
||||
$subject = get_string("enrolmentnew", 'enrol', format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))));
|
||||
|
||||
$eventdata = new stdClass();
|
||||
$eventdata->modulename = 'moodle';
|
||||
@@ -269,7 +269,7 @@ function authorize_verify_account() {
|
||||
|
||||
$original_antest = $plugin->get_config('an_test');
|
||||
$plugin->set_config('an_test', 1); // Test mode
|
||||
$shortname = format_string($SITE->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
|
||||
$shortname = format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID)));
|
||||
|
||||
$order = new stdClass();
|
||||
$order->id = -1;
|
||||
|
||||
@@ -54,7 +54,7 @@ function authorize_print_orders($courseid, $userid) {
|
||||
$searchtype = optional_param('searchtype', 'orderid', PARAM_ALPHA);
|
||||
$status = optional_param('status', AN_STATUS_NONE, PARAM_INT);
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$coursecontext = context_course::instance($courseid);
|
||||
|
||||
$searchmenu = array('orderid' => $authstrs->orderid, 'transid' => $authstrs->transid, 'cclastfour' => $authstrs->cclastfour);
|
||||
$buttons = "<form method='post' action='index.php' autocomplete='off'><div>";
|
||||
@@ -63,7 +63,7 @@ function authorize_print_orders($courseid, $userid) {
|
||||
$buttons .= "<input type='submit' value='$strs->search' />";
|
||||
$buttons .= "</div></form>";
|
||||
|
||||
if (has_capability('enrol/authorize:uploadcsv', get_context_instance(CONTEXT_USER, $USER->id))) {
|
||||
if (has_capability('enrol/authorize:uploadcsv', context_user::instance($USER->id))) {
|
||||
$buttons .= "<form method='get' action='uploadcsv.php'><div><input type='submit' value='".get_string('uploadcsv', 'enrol_authorize')."' /></div></form>";
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ function authorize_print_order($orderid)
|
||||
print_error('nousers', '', "$CFG->wwwroot/enrol/authorize/index.php");
|
||||
}
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
if ($USER->id != $order->userid) { // Current user viewing someone else's order
|
||||
require_capability('enrol/authorize:managepayments', $coursecontext);
|
||||
}
|
||||
@@ -288,7 +288,7 @@ function authorize_print_order($orderid)
|
||||
if (empty($do))
|
||||
{
|
||||
if (empty($statusandactions->actions)) {
|
||||
if ((AN_METHOD_ECHECK == $order->paymentmethod) && has_capability('enrol/authorize:uploadcsv', get_context_instance(CONTEXT_USER, $USER->id))) {
|
||||
if ((AN_METHOD_ECHECK == $order->paymentmethod) && has_capability('enrol/authorize:uploadcsv', context_user::instance($USER->id))) {
|
||||
$buttons .= "<form method='get' action='uploadcsv.php'><div><input type='submit' value='".get_string('uploadcsv', 'enrol_authorize')."' /></div></form>";
|
||||
}
|
||||
}
|
||||
@@ -574,7 +574,7 @@ function authorize_get_status_action($order)
|
||||
$ret = new stdClass();
|
||||
$ret->actions = array();
|
||||
|
||||
$canmanage = has_capability('enrol/authorize:managepayments', get_context_instance(CONTEXT_COURSE, $order->courseid));
|
||||
$canmanage = has_capability('enrol/authorize:managepayments', context_course::instance($order->courseid));
|
||||
|
||||
if (floatval($order->transid) == 0) { // test transaction or new order
|
||||
if ($order->timecreated < $newordertime) {
|
||||
|
||||
@@ -33,7 +33,7 @@ require_once('import_form.php');
|
||||
|
||||
/// Require capabilities
|
||||
require_login();
|
||||
require_capability('enrol/authorize:uploadcsv', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('enrol/authorize:uploadcsv', context_system::instance());
|
||||
|
||||
/// Print header
|
||||
$struploadcsv = get_string('uploadcsv', 'enrol_authorize');
|
||||
@@ -202,7 +202,7 @@ function authorize_process_csv($filename) {
|
||||
$ignoredlines .= $transid . ": Could not find this course: " . $order->courseid . "\n";
|
||||
continue;
|
||||
}
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id, IGNORE_MISSING);
|
||||
if (!$coursecontext) {
|
||||
$ignored++;
|
||||
$ignoredlines .= $transid . ": Could not find course context: " . $order->courseid . "\n";
|
||||
@@ -248,7 +248,7 @@ function authorize_process_csv($filename) {
|
||||
$eventdata->name = 'authorize_enrolment';
|
||||
$eventdata->userfrom = $admin;
|
||||
$eventdata->userto = $admin;
|
||||
$eventdata->subject = format_string($SITE->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID))).': Authorize.net CSV ERROR LOG';
|
||||
$eventdata->subject = format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID))).': Authorize.net CSV ERROR LOG';
|
||||
$eventdata->fullmessage = $ignoredlines;
|
||||
$eventdata->fullmessageformat = FORMAT_PLAIN;
|
||||
$eventdata->fullmessagehtml = '';
|
||||
|
||||
@@ -36,7 +36,7 @@ $action = optional_param('action', '', PARAM_ALPHANUMEXT);
|
||||
$filter = optional_param('ifilter', 0, PARAM_INT);
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
redirect(new moodle_url('/'));
|
||||
|
||||
@@ -48,7 +48,7 @@ class enrol_category_handler {
|
||||
|
||||
// make sure the role is to be actually synchronised
|
||||
// please note we are ignoring overrides of the synchronised capability (for performance reasons in full sync)
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$syscontext = context_system::instance();
|
||||
if (!$DB->record_exists('role_capabilities', array('contextid'=>$syscontext->id, 'roleid'=>$ra->roleid, 'capability'=>'enrol/category:synchronised', 'permission'=>CAP_ALLOW))) {
|
||||
return true;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ class enrol_category_handler {
|
||||
}
|
||||
|
||||
// now this is going to be a bit slow, take all enrolments in child courses and verify each separately
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$syscontext = context_system::instance();
|
||||
if (!$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext)) {
|
||||
return true;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ class enrol_category_handler {
|
||||
$params['userid'] = $ra->userid;
|
||||
|
||||
foreach ($rs as $instance) {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $instance->courseid);
|
||||
$coursecontext = context_course::instance($instance->courseid);
|
||||
$contextids = get_parent_contexts($coursecontext);
|
||||
array_pop($contextids); // remove system context, we are interested in categories only
|
||||
|
||||
@@ -152,7 +152,7 @@ function enrol_category_sync_course($course) {
|
||||
|
||||
$plugin = enrol_get_plugin('category');
|
||||
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$syscontext = context_system::instance();
|
||||
$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext);
|
||||
|
||||
if (!$roles) {
|
||||
@@ -166,7 +166,7 @@ function enrol_category_sync_course($course) {
|
||||
}
|
||||
|
||||
// first find out if any parent category context contains interesting role assignments
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$contextids = get_parent_contexts($coursecontext);
|
||||
array_pop($contextids); // remove system context, we are interested in categories only
|
||||
|
||||
@@ -246,7 +246,7 @@ function enrol_category_sync_full() {
|
||||
|
||||
$plugin = enrol_get_plugin('category');
|
||||
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$syscontext = context_system::instance();
|
||||
|
||||
// any interesting roles worth synchronising?
|
||||
if (!$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext)) {
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once("$CFG->dirroot/enrol/cohort/locallib.php");
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login($course);
|
||||
require_capability('moodle/course:enrolconfig', $context);
|
||||
|
||||
@@ -34,7 +34,7 @@ class enrol_cohort_addinstance_form extends moodleform {
|
||||
|
||||
$mform = $this->_form;
|
||||
$course = $this->_customdata;
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
|
||||
$enrol = enrol_get_plugin('cohort');
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ $action = required_param('action', PARAM_ALPHANUMEXT);
|
||||
$PAGE->set_url(new moodle_url('/enrol/cohort/ajax.php', array('id'=>$id, 'action'=>$action)));
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
throw new moodle_exception('invalidcourse');
|
||||
|
||||
@@ -47,7 +47,7 @@ class enrol_cohort_plugin extends enrol_plugin {
|
||||
} else if (empty($instance->name)) {
|
||||
$enrol = $this->get_name();
|
||||
if ($role = $DB->get_record('role', array('id'=>$instance->roleid))) {
|
||||
$role = role_get_name($role, get_context_instance(CONTEXT_COURSE, $instance->courseid));
|
||||
$role = role_get_name($role, context_course::instance($instance->courseid, IGNORE_MISSING));
|
||||
return get_string('pluginname', 'enrol_'.$enrol) . ' (' . format_string($DB->get_field('cohort', 'name', array('id'=>$instance->customint1))) . ' - ' . $role .')';
|
||||
} else {
|
||||
return get_string('pluginname', 'enrol_'.$enrol) . ' (' . format_string($DB->get_field('cohort', 'name', array('id'=>$instance->customint1))) . ')';
|
||||
@@ -81,7 +81,7 @@ class enrol_cohort_plugin extends enrol_plugin {
|
||||
protected function can_add_new_instances($courseid) {
|
||||
global $DB;
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$coursecontext = context_course::instance($courseid);
|
||||
if (!has_capability('moodle/course:enrolconfig', $coursecontext) or !has_capability('enrol/cohort:config', $coursecontext)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ if ($ADMIN->fulltree) {
|
||||
|
||||
//--- enrol instance defaults ----------------------------------------------------------------------------
|
||||
if (!during_initial_install()) {
|
||||
$options = get_default_enrol_roles(get_context_instance(CONTEXT_SYSTEM));
|
||||
$options = get_default_enrol_roles(context_system::instance());
|
||||
$student = get_archetype_roles('student');
|
||||
$student = reset($student);
|
||||
$settings->add(new admin_setting_configselect('enrol_cohort/roleid',
|
||||
|
||||
@@ -214,7 +214,7 @@ class enrol_database_plugin extends enrol_plugin {
|
||||
$this->enrol_user($instance, $user->id, $roleid, 0, 0, ENROL_USER_ACTIVE);
|
||||
}
|
||||
|
||||
if (!$context = get_context_instance(CONTEXT_COURSE, $instance->courseid)) {
|
||||
if (!$context = context_course::instance($instance->courseid, IGNORE_MISSING)) {
|
||||
//weird
|
||||
continue;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ class enrol_database_plugin extends enrol_plugin {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$context = get_context_instance(CONTEXT_COURSE, $instance->courseid)) {
|
||||
if (!$context = context_course::instance($instance->courseid, IGNORE_MISSING)) {
|
||||
//weird
|
||||
continue;
|
||||
}
|
||||
@@ -416,7 +416,7 @@ class enrol_database_plugin extends enrol_plugin {
|
||||
if (!$instance = $DB->get_record('enrol', array('id'=>$course->enrolid))) {
|
||||
continue; //weird
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
// get current list of enrolled users with their roles
|
||||
$current_roles = array();
|
||||
|
||||
@@ -81,7 +81,7 @@ if ($ADMIN->fulltree) {
|
||||
$settings->add(new admin_setting_configtext('enrol_database/remoterolefield', get_string('remoterolefield', 'enrol_database'), get_string('remoterolefield_desc', 'enrol_database'), ''));
|
||||
|
||||
if (!during_initial_install()) {
|
||||
$options = get_default_enrol_roles(get_context_instance(CONTEXT_SYSTEM));
|
||||
$options = get_default_enrol_roles(context_system::instance());
|
||||
$student = get_archetype_roles('student');
|
||||
$student = reset($student);
|
||||
$settings->add(new admin_setting_configselect('enrol_database/defaultrole', get_string('defaultrole', 'enrol_database'), get_string('defaultrole_desc', 'enrol_database'), $student->id, $options));
|
||||
|
||||
@@ -73,7 +73,7 @@ class core_enrol_external extends external_api {
|
||||
$result = array();
|
||||
|
||||
foreach ($courses as $course) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id, IGNORE_MISSING);
|
||||
try {
|
||||
self::validate_context($context);
|
||||
} catch (Exception $e) {
|
||||
@@ -195,7 +195,7 @@ class core_enrol_external extends external_api {
|
||||
}
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$coursecontext = context_course::instance($courseid, IGNORE_MISSING);
|
||||
if ($courseid == SITEID) {
|
||||
$context = get_system_context();
|
||||
} else {
|
||||
@@ -531,9 +531,9 @@ class moodle_enrol_external extends external_api {
|
||||
'onlyactive'=>$onlyactive)
|
||||
);
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $params['courseid']);
|
||||
$coursecontext = context_course::instance($params['courseid'], IGNORE_MISSING);
|
||||
if ($courseid == SITEID) {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
$context = $coursecontext;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ class enrol_flatfile_plugin extends enrol_plugin {
|
||||
unset($elog);
|
||||
|
||||
// Create/resurrect a context object
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
if ($action == 'add') {
|
||||
$instance = $DB->get_record('enrol',
|
||||
|
||||
@@ -28,7 +28,7 @@ require('../../config.php');
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login($course);
|
||||
require_capability('moodle/course:enrolconfig', $context);
|
||||
|
||||
+4
-4
@@ -85,7 +85,7 @@ class enrol_guest_plugin extends enrol_plugin {
|
||||
|
||||
if ($allow) {
|
||||
// Temporarily assign them some guest role for this context
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid);
|
||||
$context = context_course::instance($instance->courseid);
|
||||
load_temp_course_role($context, $CFG->guestroleid);
|
||||
return ENROL_MAX_TIMESTAMP;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class enrol_guest_plugin extends enrol_plugin {
|
||||
public function get_newinstance_link($courseid) {
|
||||
global $DB;
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid, MUST_EXIST);
|
||||
$context = context_course::instance($courseid, MUST_EXIST);
|
||||
|
||||
if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/guest:config', $context)) {
|
||||
return NULL;
|
||||
@@ -140,7 +140,7 @@ class enrol_guest_plugin extends enrol_plugin {
|
||||
if ($instance->id == $instanceid) {
|
||||
if ($data = $form->get_data()) {
|
||||
// add guest role
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid);
|
||||
$context = context_course::instance($instance->courseid);
|
||||
$USER->enrol_guest_passwords[$instance->id] = $data->guestpassword; // this is a hack, ideally we should not add stuff to $USER...
|
||||
if (isset($USER->enrol['tempguest'][$instance->courseid])) {
|
||||
remove_temp_course_roles($context);
|
||||
@@ -280,7 +280,7 @@ class enrol_guest_plugin extends enrol_plugin {
|
||||
public function course_updated($inserted, $course, $data) {
|
||||
global $DB;
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
if (has_capability('enrol/guest:config', $context)) {
|
||||
if ($inserted) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
||||
require_login(0, false);
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
|
||||
$site = get_site();
|
||||
|
||||
/// get language strings
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
|
||||
$PAGE->set_url('/enrol/imsenterprise/importnow.php');
|
||||
$PAGE->set_title(get_string('importimsfile', 'enrol_imsenterprise'));
|
||||
|
||||
@@ -635,7 +635,7 @@ function process_membership_tag($tagcontents){
|
||||
// The actual processing (ensuring a group record exists, etc) occurs below, in the enrol-a-student clause
|
||||
}
|
||||
|
||||
$rolecontext = get_context_instance(CONTEXT_COURSE, $ship->courseid);
|
||||
$rolecontext = context_course::instance($ship->courseid);
|
||||
$rolecontext = $rolecontext->id; // All we really want is the ID
|
||||
//$this->log_line("Context instance for course $ship->courseid is...");
|
||||
//print_r($rolecontext);
|
||||
|
||||
@@ -56,7 +56,7 @@ if ($ADMIN->fulltree) {
|
||||
$settings->add(new admin_setting_heading('enrol_imsenterprise_usersettings_roles', get_string('roles', 'enrol_imsenterprise'), get_string('imsrolesdescription', 'enrol_imsenterprise')));
|
||||
|
||||
if (!during_initial_install()) {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, SITEID);
|
||||
$coursecontext = context_course::instance(SITEID);
|
||||
$assignableroles = get_assignable_roles($coursecontext);
|
||||
$assignableroles = array('0' => get_string('ignore', 'enrol_imsenterprise')) + $assignableroles;
|
||||
$imsroles = new imsenterprise_roles();
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ if (!isloggedin()) {
|
||||
}
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
// Everybody is enrolled on the frontpage
|
||||
if ($course->id == SITEID) {
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ $instanceid = optional_param('instance', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
redirect("$CFG->wwwroot/");
|
||||
|
||||
+2
-2
@@ -250,7 +250,7 @@ class enrol_ldap_plugin extends enrol_plugin {
|
||||
// Deal with unenrolments.
|
||||
$transaction = $DB->start_delegated_transaction();
|
||||
foreach ($enrolments[$role->id]['current'] as $course) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->courseid);
|
||||
$context = context_course::instance($course->courseid);
|
||||
$instance = $DB->get_record('enrol', array('id'=>$course->enrolid));
|
||||
switch ($this->get_config('unenrolaction')) {
|
||||
case ENROL_EXT_REMOVED_UNENROL:
|
||||
@@ -448,7 +448,7 @@ class enrol_ldap_plugin extends enrol_plugin {
|
||||
JOIN {enrol} e ON (e.id = ue.enrolid)
|
||||
WHERE u.deleted = 0 AND e.courseid = :courseid ";
|
||||
$params = array('roleid'=>$role->id, 'courseid'=>$course_obj->id);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course_obj->id);
|
||||
$context = context_course::instance($course_obj->id);
|
||||
if (!empty($ldapmembers)) {
|
||||
list($ldapml, $params2) = $DB->get_in_or_equal($ldapmembers, SQL_PARAMS_NAMED, 'm', false);
|
||||
$sql .= "AND u.idnumber $ldapml";
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ class course_enrolment_manager {
|
||||
*/
|
||||
public function __construct(moodle_page $moodlepage, $course, $instancefilter = null) {
|
||||
$this->moodlepage = $moodlepage;
|
||||
$this->context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$this->context = context_course::instance($course->id);
|
||||
$this->course = $course;
|
||||
$this->instancefilter = $instancefilter;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ $action = required_param('action', PARAM_ALPHANUMEXT);
|
||||
$PAGE->set_url(new moodle_url('/enrol/ajax.php', array('id'=>$id, 'action'=>$action)));
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
throw new moodle_exception('invalidcourse');
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once('edit_form.php');
|
||||
$courseid = required_param('courseid', PARAM_INT);
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login($course);
|
||||
require_capability('enrol/manual:config', $context);
|
||||
|
||||
@@ -57,7 +57,7 @@ if ($course->id == SITEID) {
|
||||
// Obviously
|
||||
require_login($course);
|
||||
// Make sure the user can manage manual enrolments for this course
|
||||
require_capability("enrol/manual:manage", get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST));
|
||||
require_capability("enrol/manual:manage", context_course::instance($course->id, MUST_EXIST));
|
||||
|
||||
// Get the enrolment manager for this course
|
||||
$manager = new course_enrolment_manager($PAGE, $course, $filter);
|
||||
|
||||
@@ -93,7 +93,7 @@ class enrol_manual_external extends external_api {
|
||||
|
||||
foreach ($params['enrolments'] as $enrolment) {
|
||||
// Ensure the current user is allowed to run this function in the enrolment context
|
||||
$context = get_context_instance(CONTEXT_COURSE, $enrolment['courseid']);
|
||||
$context = context_course::instance($enrolment['courseid'], IGNORE_MISSING);
|
||||
self::validate_context($context);
|
||||
|
||||
//check that the user has the permission to manual enrol
|
||||
|
||||
@@ -65,7 +65,7 @@ class enrol_manual_plugin extends enrol_plugin {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid, MUST_EXIST);
|
||||
$context = context_course::instance($instance->courseid, MUST_EXIST);
|
||||
|
||||
if (!has_capability('enrol/manual:manage', $context) or !has_capability('enrol/manual:enrol', $context) or !has_capability('enrol/manual:unenrol', $context)) {
|
||||
return NULL;
|
||||
@@ -88,7 +88,7 @@ class enrol_manual_plugin extends enrol_plugin {
|
||||
throw new coding_exception('Invalid enrol instance type!');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid);
|
||||
$context = context_course::instance($instance->courseid);
|
||||
if (has_capability('enrol/manual:config', $context)) {
|
||||
$managelink = new moodle_url('/enrol/manual/edit.php', array('courseid'=>$instance->courseid));
|
||||
$instancesnode->add($this->get_instance_name($instance), $managelink, navigation_node::TYPE_SETTING);
|
||||
@@ -106,7 +106,7 @@ class enrol_manual_plugin extends enrol_plugin {
|
||||
if ($instance->enrol !== 'manual') {
|
||||
throw new coding_exception('invalid enrol instance!');
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid);
|
||||
$context = context_course::instance($instance->courseid);
|
||||
|
||||
$icons = array();
|
||||
|
||||
@@ -130,7 +130,7 @@ class enrol_manual_plugin extends enrol_plugin {
|
||||
public function get_newinstance_link($courseid) {
|
||||
global $DB;
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid, MUST_EXIST);
|
||||
$context = context_course::instance($courseid, MUST_EXIST);
|
||||
|
||||
if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/manual:config', $context)) {
|
||||
return NULL;
|
||||
|
||||
@@ -33,7 +33,7 @@ $extendbase = optional_param('extendbase', 3, PARAM_INT);
|
||||
|
||||
$instance = $DB->get_record('enrol', array('id'=>$enrolid, 'enrol'=>'manual'), '*', MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login($course);
|
||||
require_capability('enrol/manual:enrol', $context);
|
||||
|
||||
@@ -48,7 +48,7 @@ if ($ADMIN->fulltree) {
|
||||
get_string('defaultperiod', 'enrol_manual'), get_string('defaultperiod_desc', 'enrol_manual'), 0, PARAM_INT));
|
||||
|
||||
if (!during_initial_install()) {
|
||||
$options = get_default_enrol_roles(get_context_instance(CONTEXT_SYSTEM));
|
||||
$options = get_default_enrol_roles(context_system::instance());
|
||||
$student = get_archetype_roles('student');
|
||||
$student = reset($student);
|
||||
$settings->add(new admin_setting_configselect('enrol_manual/roleid',
|
||||
|
||||
@@ -31,7 +31,7 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
$instance = $DB->get_record('enrol', array('id'=>$enrolid, 'enrol'=>'manual'), '*', MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login();
|
||||
if (!is_enrolled($context)) {
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once("$CFG->dirroot/enrol/meta/locallib.php");
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
$PAGE->set_url('/enrol/meta/addinstance.php', array('id'=>$course->id));
|
||||
$PAGE->set_pagelayout('admin');
|
||||
|
||||
@@ -46,7 +46,7 @@ class enrol_meta_addinstance_form extends moodleform {
|
||||
if ($c->id == SITEID or $c->id == $course->id or isset($existing[$c->id])) {
|
||||
continue;
|
||||
}
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $c->id);
|
||||
$coursecontext = context_course::instance($c->id);
|
||||
if (!$c->visible and !has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
|
||||
continue;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class enrol_meta_addinstance_form extends moodleform {
|
||||
if (!$c = $DB->get_record('course', array('id'=>$data['link']))) {
|
||||
$errors['link'] = get_string('required');
|
||||
} else {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $c->id);
|
||||
$coursecontext = context_course::instance($c->id);
|
||||
$existing = $DB->get_records('enrol', array('enrol'=>'meta', 'courseid'=>$this->course->id), '', 'customint1, id');
|
||||
if (!$c->visible and !has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
|
||||
$errors['link'] = get_string('error');
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ class enrol_meta_plugin extends enrol_plugin {
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_newinstance_link($courseid) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid, MUST_EXIST);
|
||||
$context = context_course::instance($courseid, MUST_EXIST);
|
||||
if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/meta:config', $context)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once($CFG->dirroot.'/mnet/service/enrol/locallib.php');
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login($course);
|
||||
require_capability('moodle/course:enrolconfig', $context);
|
||||
|
||||
@@ -36,7 +36,7 @@ class enrol_mnet_addinstance_form extends moodleform {
|
||||
$course = $this->_customdata['course'];
|
||||
$enrol = $this->_customdata['enrol'];
|
||||
$service = $this->_customdata['service'];
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
|
||||
$subscribers = $service->get_remote_subscribers();
|
||||
$hosts = array(0 => get_string('remotesubscribersall', 'enrol_mnet'));
|
||||
|
||||
@@ -88,7 +88,7 @@ class enrol_mnet_mnetservice_enrol {
|
||||
// use the record if it does not exist yet or is host-specific
|
||||
if (empty($courses[$course->remoteid]) or ($course->customint1 > 0)) {
|
||||
unset($course->customint1); // the client does not need to know this
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->remoteid);
|
||||
$context = context_course::instance($course->remoteid);
|
||||
// Rewrite file URLs so that they are correct
|
||||
$course->summary = file_rewrite_pluginfile_urls($course->summary, 'pluginfile.php', $context->id, 'course', 'summary', false);
|
||||
$courses[$course->remoteid] = $course;
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ class enrol_mnet_plugin extends enrol_plugin {
|
||||
} else if (empty($instance->name)) {
|
||||
$enrol = $this->get_name();
|
||||
if ($role = $DB->get_record('role', array('id'=>$instance->roleid))) {
|
||||
$role = role_get_name($role, get_context_instance(CONTEXT_COURSE, $instance->courseid));
|
||||
$role = role_get_name($role, context_course::instance($instance->courseid, IGNORE_MISSING));
|
||||
} else {
|
||||
$role = get_string('error');
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class enrol_mnet_plugin extends enrol_plugin {
|
||||
if (!$service->is_available()) {
|
||||
return null;
|
||||
}
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$coursecontext = context_course::instance($courseid);
|
||||
if (!has_capability('moodle/course:enrolconfig', $coursecontext)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ if ($ADMIN->fulltree) {
|
||||
|
||||
//--- enrol instance defaults ----------------------------------------------------------------------------
|
||||
if (!during_initial_install()) {
|
||||
$options = get_default_enrol_roles(get_context_instance(CONTEXT_SYSTEM));
|
||||
$options = get_default_enrol_roles(context_system::instance());
|
||||
$student = get_archetype_roles('student');
|
||||
$student = reset($student);
|
||||
$settings->add(new admin_setting_configselect_with_advanced('enrol_mnet/roleid',
|
||||
|
||||
@@ -33,7 +33,7 @@ $action = optional_param('action', '', PARAM_ALPHANUMEXT);
|
||||
$filter = optional_param('ifilter', 0, PARAM_INT);
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login($course);
|
||||
require_capability('moodle/role:assign', $context);
|
||||
|
||||
@@ -32,7 +32,7 @@ $courseid = required_param('courseid', PARAM_INT);
|
||||
$instanceid = optional_param('id', 0, PARAM_INT); // instanceid
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login($course);
|
||||
require_capability('enrol/paypal:config', $context);
|
||||
|
||||
@@ -76,7 +76,7 @@ if (! $course = $DB->get_record("course", array("id"=>$data->courseid))) {
|
||||
die;
|
||||
}
|
||||
|
||||
if (! $context = get_context_instance(CONTEXT_COURSE, $course->id)) {
|
||||
if (! $context = context_course::instance($course->id, IGNORE_MISSING)) {
|
||||
message_paypal_error_to_admin("Not a valid context id", $data);
|
||||
die;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ while (!feof($fp)) {
|
||||
die;
|
||||
}
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$coursecontext = context_course::instance($course->id, IGNORE_MISSING);
|
||||
|
||||
// Check that amount paid is the correct amount
|
||||
if ( (float) $plugin_instance->cost <= 0 ) {
|
||||
|
||||
@@ -80,7 +80,7 @@ class enrol_paypal_plugin extends enrol_plugin {
|
||||
throw new coding_exception('Invalid enrol instance type!');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid);
|
||||
$context = context_course::instance($instance->courseid);
|
||||
if (has_capability('enrol/paypal:config', $context)) {
|
||||
$managelink = new moodle_url('/enrol/paypal/edit.php', array('courseid'=>$instance->courseid, 'id'=>$instance->id));
|
||||
$instancesnode->add($this->get_instance_name($instance), $managelink, navigation_node::TYPE_SETTING);
|
||||
@@ -98,7 +98,7 @@ class enrol_paypal_plugin extends enrol_plugin {
|
||||
if ($instance->enrol !== 'paypal') {
|
||||
throw new coding_exception('invalid enrol instance!');
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid);
|
||||
$context = context_course::instance($instance->courseid);
|
||||
|
||||
$icons = array();
|
||||
|
||||
@@ -116,7 +116,7 @@ class enrol_paypal_plugin extends enrol_plugin {
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_newinstance_link($courseid) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid, MUST_EXIST);
|
||||
$context = context_course::instance($courseid, MUST_EXIST);
|
||||
|
||||
if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/paypal:config', $context)) {
|
||||
return NULL;
|
||||
@@ -151,7 +151,7 @@ class enrol_paypal_plugin extends enrol_plugin {
|
||||
}
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$instance->courseid));
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
$shortname = format_string($course->shortname, true, array('context' => $context));
|
||||
$strloginto = get_string("loginto", "", $shortname);
|
||||
|
||||
@@ -34,7 +34,7 @@ if (!$course = $DB->get_record("course", array("id"=>$id))) {
|
||||
redirect($CFG->wwwroot);
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login();
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ if ($ADMIN->fulltree) {
|
||||
$settings->add(new admin_setting_configselect('enrol_paypal/currency', get_string('currency', 'enrol_paypal'), '', 'USD', $paypalcurrencies));
|
||||
|
||||
if (!during_initial_install()) {
|
||||
$options = get_default_enrol_roles(get_context_instance(CONTEXT_SYSTEM));
|
||||
$options = get_default_enrol_roles(context_system::instance());
|
||||
$student = get_archetype_roles('student');
|
||||
$student = reset($student);
|
||||
$settings->add(new admin_setting_configselect('enrol_paypal/roleid',
|
||||
|
||||
@@ -31,7 +31,7 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
$instance = $DB->get_record('enrol', array('id'=>$enrolid, 'enrol'=>'paypal'), '*', MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login();
|
||||
if (!is_enrolled($context)) {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ $courseid = required_param('courseid', PARAM_INT);
|
||||
$instanceid = optional_param('id', 0, PARAM_INT); // instanceid
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login($course);
|
||||
require_capability('enrol/self:config', $context);
|
||||
|
||||
@@ -57,7 +57,7 @@ if ($course->id == SITEID) {
|
||||
// Obvioulsy
|
||||
require_login($course);
|
||||
// The user must be able to manage self enrolments within the course
|
||||
require_capability("enrol/self:manage", get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST));
|
||||
require_capability("enrol/self:manage", context_course::instance($course->id, MUST_EXIST));
|
||||
|
||||
// Get the enrolment manager for this course
|
||||
$manager = new course_enrolment_manager($PAGE, $course, $filter);
|
||||
|
||||
+5
-5
@@ -74,7 +74,7 @@ class enrol_self_plugin extends enrol_plugin {
|
||||
|
||||
if (empty($instance->name)) {
|
||||
if (!empty($instance->roleid) and $role = $DB->get_record('role', array('id'=>$instance->roleid))) {
|
||||
$role = ' (' . role_get_name($role, get_context_instance(CONTEXT_COURSE, $instance->courseid)) . ')';
|
||||
$role = ' (' . role_get_name($role, context_course::instance($instance->courseid, IGNORE_MISSING)) . ')';
|
||||
} else {
|
||||
$role = '';
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class enrol_self_plugin extends enrol_plugin {
|
||||
throw new coding_exception('Invalid enrol instance type!');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid);
|
||||
$context = context_course::instance($instance->courseid);
|
||||
if (has_capability('enrol/self:config', $context)) {
|
||||
$managelink = new moodle_url('/enrol/self/edit.php', array('courseid'=>$instance->courseid, 'id'=>$instance->id));
|
||||
$instancesnode->add($this->get_instance_name($instance), $managelink, navigation_node::TYPE_SETTING);
|
||||
@@ -133,7 +133,7 @@ class enrol_self_plugin extends enrol_plugin {
|
||||
if ($instance->enrol !== 'self') {
|
||||
throw new coding_exception('invalid enrol instance!');
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_COURSE, $instance->courseid);
|
||||
$context = context_course::instance($instance->courseid);
|
||||
|
||||
$icons = array();
|
||||
|
||||
@@ -151,7 +151,7 @@ class enrol_self_plugin extends enrol_plugin {
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_newinstance_link($courseid) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid, MUST_EXIST);
|
||||
$context = context_course::instance($courseid, MUST_EXIST);
|
||||
|
||||
if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/self:config', $context)) {
|
||||
return NULL;
|
||||
@@ -282,7 +282,7 @@ class enrol_self_plugin extends enrol_plugin {
|
||||
|
||||
$subject = get_string('welcometocourse', 'enrol_self', format_string($course->fullname));
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
$rusers = array();
|
||||
if (!empty($CFG->coursecontact)) {
|
||||
$croles = explode(',', $CFG->coursecontact);
|
||||
|
||||
@@ -58,7 +58,7 @@ if ($ADMIN->fulltree) {
|
||||
get_string('groupkey', 'enrol_self'), get_string('groupkey_desc', 'enrol_self'), 0, $options));
|
||||
|
||||
if (!during_initial_install()) {
|
||||
$options = get_default_enrol_roles(get_context_instance(CONTEXT_SYSTEM));
|
||||
$options = get_default_enrol_roles(context_system::instance());
|
||||
$student = get_archetype_roles('student');
|
||||
$student = reset($student);
|
||||
$settings->add(new admin_setting_configselect('enrol_self/roleid',
|
||||
|
||||
@@ -31,7 +31,7 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
$instance = $DB->get_record('enrol', array('id'=>$enrolid, 'enrol'=>'self'), '*', MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
require_login();
|
||||
if (!is_enrolled($context)) {
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ $action = optional_param('action', '', PARAM_ALPHANUMEXT);
|
||||
$filter = optional_param('ifilter', 0, PARAM_INT);
|
||||
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
redirect(new moodle_url('/'));
|
||||
|
||||
@@ -36,7 +36,7 @@ class enrol_users_assign_form extends moodleform {
|
||||
|
||||
$user = $this->_customdata['user'];
|
||||
$course = $this->_customdata['course'];
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
$assignable = $this->_customdata['assignable'];
|
||||
$assignable = array_reverse($assignable, true); // students first
|
||||
|
||||
@@ -87,7 +87,7 @@ class enrol_users_addmember_form extends moodleform {
|
||||
|
||||
$user = $this->_customdata['user'];
|
||||
$course = $this->_customdata['course'];
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id, IGNORE_MISSING);
|
||||
$allgroups = $this->_customdata['allgroups'];
|
||||
$usergroups = groups_get_all_groups($course->id, $user->id, 0, 'g.id');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user