mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-33061 - lib - Replacement of get_context_instance with the new function call (group 3)
This commit is contained in:
parent
147dc9dafd
commit
41b3836067
9 changed files with 74 additions and 74 deletions
|
@ -45,7 +45,7 @@ $returnurl = new moodle_url('/blog/index.php');
|
|||
|
||||
if (!empty($courseid) && empty($modid)) {
|
||||
$returnurl->param('courseid', $courseid);
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_COURSE, $courseid));
|
||||
$PAGE->set_context(context_course::instance($courseid));
|
||||
}
|
||||
|
||||
// If a modid is given, guess courseid
|
||||
|
@ -53,12 +53,12 @@ if (!empty($modid)) {
|
|||
$returnurl->param('modid', $modid);
|
||||
$courseid = $DB->get_field('course_modules', 'course', array('id' => $modid));
|
||||
$returnurl->param('courseid', $courseid);
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_MODULE, $modid));
|
||||
$PAGE->set_context(context_module::instance($modid));
|
||||
}
|
||||
|
||||
// If courseid is empty use the system context
|
||||
if (empty($courseid)) {
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
}
|
||||
|
||||
$blogheaders = blog_get_headers();
|
||||
|
@ -77,7 +77,7 @@ if (isguestuser()) {
|
|||
print_error('noguestentry', 'blog');
|
||||
}
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$sitecontext = context_system::instance();
|
||||
if (!has_capability('moodle/blog:create', $sitecontext) && !has_capability('moodle/blog:manageentries', $sitecontext)) {
|
||||
print_error('cannoteditentryorblog');
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ if (!empty($entry->id)) {
|
|||
if ($CFG->useblogassociations && ($blogassociations = $DB->get_records('blog_association', array('blogid' => $entry->id)))) {
|
||||
|
||||
foreach ($blogassociations as $assocrec) {
|
||||
$context = get_context_instance_by_id($assocrec->contextid);
|
||||
$context = context::instance_by_id($assocrec->contextid);
|
||||
|
||||
switch ($context->contextlevel) {
|
||||
case CONTEXT_COURSE:
|
||||
|
@ -215,13 +215,13 @@ switch ($action) {
|
|||
|
||||
//pre-select the course for associations
|
||||
if ($courseid) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
$context = context_course::instance($courseid);
|
||||
$entry->courseassoc = $context->id;
|
||||
}
|
||||
|
||||
//pre-select the mod for associations
|
||||
if ($modid) {
|
||||
$context = get_context_instance(CONTEXT_MODULE, $modid);
|
||||
$context = context_module::instance($modid);
|
||||
$entry->modassoc = $context->id;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue