]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8343 reorganize frontpage settings in admintree - admin tree now allows to specif...
authorskodak <skodak>
Mon, 29 Jan 2007 21:29:27 +0000 (21:29 +0000)
committerskodak <skodak>
Mon, 29 Jan 2007 21:29:27 +0000 (21:29 +0000)
MDL-8352 Fully separate CONTEXT_COURSE, SITEID from COURSE_SYSTEM - first part of cleanup related to frontpage

14 files changed:
admin/roles/assign.php
admin/roles/override.php
admin/roles/tabs.php
admin/settings/appearance.php
admin/settings/frontpage.php [new file with mode: 0644]
admin/settings/server.php
admin/settings/top.php
blocks/admin/block_admin.php
blocks/moodleblock.class.php
files/index.php
index.php
lang/en_utf8/admin.php
lib/adminlib.php
lib/pagelib.php

index 70b0716c4e0d0290b9e4605bf6c9d3cea23ecc3a..4d2c103c757bb7e74a58c6adbc76ea29d9defcd8 100755 (executable)
         $adminroot = admin_get_root();
         admin_externalpage_setup('assignroles', $adminroot);
         admin_externalpage_print_header($adminroot);
+    } else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
+        $adminroot = admin_get_root();
+        admin_externalpage_setup('frontpageroles', $adminroot);
+        admin_externalpage_print_header($adminroot);
+        $currenttab = '';
+        $tabsmode = 'assign';
+        include_once('tabs.php');
     } else {
         $currenttab = '';
         $tabsmode = 'assign';
         }
     }
 
-    print_heading_with_help(get_string('assignroles', 'role'), 'assignroles');
+    if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
+        print_heading_with_help(get_string('frontpageroles', 'admin'), 'assignroles');
+    } else {
+        print_heading_with_help(get_string('assignroles', 'role'), 'assignroles');
+    }
 
     if ($roleid) {        /// prints a form to swap roles
 
         print_table($table);
     }
 
-    if ($context->contextlevel == CONTEXT_SYSTEM) {
+    if ($context->contextlevel == CONTEXT_SYSTEM or ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID)) {
         admin_externalpage_print_footer($adminroot);
     } else {
         print_footer($course);
index da7cd5a8033c2eab082fb72769a338df293fe1ab..a52124f69135cafb90b53616db9ef1618d548200 100755 (executable)
         $showroles = 1;
         $currenttab = 'override';
         include_once($CFG->dirroot.'/user/tabs.php');
+    } else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
+        require_once($CFG->libdir.'/adminlib.php');
+        $adminroot = admin_get_root();
+        admin_externalpage_setup('frontpageroles', $adminroot);
+        admin_externalpage_print_header($adminroot);
+        $currenttab = '';
+        $tabsmode = 'override';
+        include_once('tabs.php');
     } else {
         $currenttab = '';
         $tabsmode = 'override';
         print_table($table);
     }
 
-    print_footer($course);
+    if ($context->contextlevel == CONTEXT_SYSTEM or ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID)) {
+        admin_externalpage_print_footer($adminroot);
+    } else {
+        print_footer($course);
+    }
 
 ?>
index 7c721310d5fb1e0f19d451ca0d2bd732c64efa26..a69baa0101ec382c3217836575d034ee7b7c96e2 100755 (executable)
@@ -27,11 +27,13 @@ if ($currenttab != 'update') {
             break;
 
         case CONTEXT_COURSE:
-            $streditcoursesettings = get_string("editcoursesettings");
-
-            $course = get_record('course', 'id', $context->instanceid);
-            print_header($streditcoursesettings, "$course->fullname",
-                    "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $straction");
+            if ($context->instanceid != SITEID) {
+                $streditcoursesettings = get_string("editcoursesettings");
+    
+                $course = get_record('course', 'id', $context->instanceid);
+                print_header($streditcoursesettings, "$course->fullname",
+                        "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $straction");
+            }                        
             break;
 
         case CONTEXT_GROUP:
index 26c746793c403b9678c6f81c256558ea0f8362d3..3e9d484d6cd8200c1de5f29c0d79416e6574bd82 100644 (file)
@@ -15,32 +15,6 @@ $ADMIN->add('themes', $temp);
 $ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
 
 
-// "frontpage" settingpage
-$temp = new admin_settingpage('frontpage', get_string('frontpage','admin'));
-$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', ''));
-$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', ''));
-$temp->add(new admin_setting_special_frontpagedesc());
-$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
-$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
-$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'),
-               get_string('sitesectionhelp','admin'), 1));
-$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'),
-     '', 3,
-     array('0' => '0',
-           '1' => '1',
-           '2' => '2',
-           '3' => '3',
-           '4' => '4',
-           '5' => '5',
-           '6' => '6',
-           '7' => '7',
-           '8' => '8',
-           '9' => '9',
-           '10' => '10')));
-$temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
-$temp->add(new admin_setting_configcheckbox('allowvisiblecoursesinhiddencategories', get_string('allowvisiblecoursesinhiddencategories', 'admin'), get_string('configvisiblecourses', 'admin'), 0));
-$ADMIN->add('appearance', $temp);
-
 // calendar
 $temp = new admin_settingpage('calendar', get_string('calendarsettings','admin'));
 $temp->add(new admin_setting_special_adminseesall());
diff --git a/admin/settings/frontpage.php b/admin/settings/frontpage.php
new file mode 100644 (file)
index 0000000..db77184
--- /dev/null
@@ -0,0 +1,38 @@
+<?php // $Id$
+
+// This file defines everything related to frontpage
+
+$frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
+
+// "frontpage" settingpage
+$temp = new admin_settingpage('frontpagesettings', get_string('frontpagesettings','admin'), 'moodle/course:update', false, $frontpagecontext);
+$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', ''));
+$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', ''));
+$temp->add(new admin_setting_special_frontpagedesc());
+$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
+$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
+$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp','admin'), 1));
+$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), '', 3,
+     array('0' => '0',
+           '1' => '1',
+           '2' => '2',
+           '3' => '3',
+           '4' => '4',
+           '5' => '5',
+           '6' => '6',
+           '7' => '7',
+           '8' => '8',
+           '9' => '9',
+           '10' => '10')));
+$temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
+$temp->add(new admin_setting_configcheckbox('allowvisiblecoursesinhiddencategories', get_string('allowvisiblecoursesinhiddencategories', 'admin'), get_string('configvisiblecourses', 'admin'), 0));
+$ADMIN->add('frontpage', $temp);
+
+$ADMIN->add('frontpage', new admin_externalpage('frontpageroles', get_string('frontpageroles', 'admin'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $frontpagecontext->id, 'moodle/role:assign', false, $frontpagecontext));
+
+$ADMIN->add('frontpage', new admin_externalpage('frontpagebackup', get_string('frontpagebackup', 'admin'), $CFG->wwwroot.'/backup/backup.php?id='.SITEID, 'moodle/site:backup', false, $frontpagecontext));
+
+$ADMIN->add('frontpage', new admin_externalpage('frontpagerestore', get_string('frontpagerestore', 'admin'), $CFG->wwwroot.'/files/index.php?id='.SITEID.'&amp;wdir=/backupdata', 'moodle/site:restore', false, $frontpagecontext));
+
+$ADMIN->add('frontpage', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID, 'moodle/course:managefiles', false, $frontpagecontext));
+?>
\ No newline at end of file
index 8993484f3a5837ab68dadac8a9d3f268fe83607a..30e1b701c31a5f0a24cc94758efa5406c5c98ca4 100644 (file)
@@ -125,8 +125,6 @@ $temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'ad
 $temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), 0, PARAM_INT));
 $ADMIN->add('server', $temp);
 
-$ADMIN->add('server', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID));
-
 $ADMIN->add('server', new admin_externalpage('maintenancemode', get_string('sitemaintenancemode', 'admin'), "$CFG->wwwroot/$CFG->admin/maintenance.php"));
 
 
index e638989bf4436d9e20e82a280badd9d911504766..e538b68c313ebc41612ab5ba2ec232f3e2715893 100644 (file)
@@ -25,6 +25,7 @@ $ADMIN->add('modules', new admin_externalpage('managefilters', get_string('manag
 
 $ADMIN->add('root', new admin_category('security', get_string('security','admin')));
 $ADMIN->add('root', new admin_category('appearance', get_string('appearance','admin')));
+$ADMIN->add('root', new admin_category('frontpage', get_string('frontpage','admin')));
 $ADMIN->add('root', new admin_category('server', get_string('server','admin')));
 $ADMIN->add('root', new admin_category('mnet', get_string('net','mnet')));
 
index 23f31d93df8be0ee7fb9e5e227052600e9e68b33..ebc31816ebe564bd7fc184fd904dace027038de6 100644 (file)
@@ -64,7 +64,7 @@ class block_admin extends block_list {
 
     /// Assign roles to the course
 
-        if (has_capability('moodle/role:assign', $context)) { 
+        if (has_capability('moodle/role:assign', $context) && ($course->id!==SITEID)) { 
             $this->content->items[]='<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id.'">'.get_string('assignroles', 'role').'</a>';
             $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/roles.gif" class="icon" alt="" />';         
             
@@ -94,13 +94,13 @@ class block_admin extends block_list {
 
     /// Backup this course
 
-        if (has_capability('moodle/site:backup', $context)) { 
+        if (has_capability('moodle/site:backup', $context)&& ($course->id!==SITEID)) { 
             $this->content->items[]='<a href="'.$CFG->wwwroot.'/backup/backup.php?id='.$this->instance->pageid.'">'.get_string('backup').'</a>';
             $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/backup.gif" class="icon" alt="" />';
         }
             
     /// Restore to this course
-        if (has_capability('moodle/site:restore', $context)) {
+        if (has_capability('moodle/site:restore', $context) && ($course->id!==SITEID)) {
             $this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->instance->pageid.'&amp;wdir=/backupdata">'.get_string('restore').'</a>';
             $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/restore.gif" class="icon" alt="" />';
         }
index 38e4287fa04acfc3d48f81e4426d9d4b2e9a3024..27cda71f1eed53a91ad9a82812077ca91637538e 100644 (file)
@@ -309,12 +309,7 @@ class block_base {
         
         switch ($this->instance->pagetype) {
             case 'course-view':
-                if ($this->instance->pageid == SITEID) {
-                      $context = get_context_instance(CONTEXT_SYSTEM, $this->instance->pageid);
-                } else {
-                    $context = get_context_instance(CONTEXT_COURSE, $this->instance->pageid);
-                }
-                
+                $context = get_context_instance(CONTEXT_COURSE, $this->instance->pageid);
                 if (!has_capability('moodle/site:manageblocks', $context)) {
                     return null;
                 }
index 87b83c1b38f24f652438d6f2a8a7c3762c804efd..1c6e43d1f13ef1a7ab957da303c49bbf157513e3 100644 (file)
@@ -9,6 +9,7 @@
 
     require('../config.php');
     require($CFG->libdir.'/filelib.php');
+    require($CFG->libdir.'/adminlib.php');
 
     $id      = required_param('id', PARAM_INT);
     $file    = optional_param('file', '', PARAM_PATH);
         error("That's an invalid course id");
     }
 
-    require_login($course->id);
+    require_login($course);
 
     require_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $course->id));
 
     function html_footer() {
-        global $course, $choose;
+        global $course, $choose, $adminroot;
 
         echo '</td></tr></table>';
 
-        print_footer($course);
+        if ($course->id == SITEID) {
+                admin_externalpage_print_footer($adminroot);
+        } else {
+            print_footer($course);
+        }
     }
 
     function html_header($course, $wdir, $formfield=""){
         global $CFG, $ME, $choose;
 
-        if (! $site = get_site()) {
-            error("Invalid site!");
-        }
-
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             $strfiles = get_string("sitefiles");
         } else {
             $strfiles = get_string("files");
             $fullnav = str_replace('->', '&raquo;', "$course->shortname -> $fullnav");
             echo '<div id="nav-bar">'.$fullnav.'</div>';
 
-            if ($course->id == $site->id) {
+            if ($course->id == SITEID and $wdir != "/backupdata") {
                 print_heading(get_string("publicsitefileswarning"), "center", 2);
             }
 
         } else {
 
-            if ($course->id == $site->id) {
-                print_header("$course->shortname: $strfiles", "$course->fullname",
-                             "<a href=\"../$CFG->admin/index.php\">".get_string("administration").
-                             "</a> -> $fullnav", $formfield);
+            if ($course->id == SITEID) {
 
-                print_heading(get_string("publicsitefileswarning"), "center", 2);
+                if ($wdir == "/backupdata") {
+                    $adminroot = admin_get_root();
+                    admin_externalpage_setup('frontpagerestore', $adminroot);
+                    admin_externalpage_print_header($adminroot);
+                } else {
+                    $adminroot = admin_get_root();
+                    admin_externalpage_setup('sitefiles', $adminroot);
+                    admin_externalpage_print_header($adminroot);
+
+                    print_heading(get_string("publicsitefileswarning"), "center", 2);
+                    
+                }
 
             } else {
                 print_header("$course->shortname: $strfiles", "$course->fullname",
index 95a48f7c795822f0560804e53263418dec1d5412..3696cb2a17d538986d916c4430fc606da87205e8 100644 (file)
--- a/index.php
+++ b/index.php
@@ -49,7 +49,7 @@
     }
 
     if ($CFG->rolesactive) { // if already using roles system
-        if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
+        if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
             if (moodle_needs_upgrading()) {
                 redirect($CFG->wwwroot .'/'. $CFG->admin .'/index.php');
             }
 
             case FRONTPAGECOURSELIST:
 
-                if (isloggedin() and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)) and !isguest() and empty($CFG->disablemycourses)) {
+                if (isloggedin() and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() and empty($CFG->disablemycourses)) {
                     print_heading_block(get_string('mycourses'));
                     print_my_moodle();
-                } else if ((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)) and !isguest()) or (count_records('course') <= FRONTPAGECOURSELIMIT)) {
+                } else if ((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest()) or (count_records('course') <= FRONTPAGECOURSELIMIT)) {
                     // admin should not see list of courses when there are too many of them
                     print_heading_block(get_string('availablecourses'));
                     print_courses(0, '100%', true);
             case 'right':
 // uh-changes end
     // The right column
-    if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing || has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
+    if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing || has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, SITEID))) {
         echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
 // uh-changes start
         if (!empty($THEME->roundcorners)) {
             echo '<div class="i1"><div class="i2"><div class="i3">';
         }
 // uh-changes end
-        if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
+        if (has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, SITEID))) {
             echo '<div style="text-align:center">'.update_course_icon($SITE->id).'</div>';
             echo '<br />';
         }
index 5d89d63f380dca77dcdad012b3357827c5d52d45..99a74365ebd8cd46c7ff26473ba0f9bc1bcf12a4 100644 (file)
@@ -278,7 +278,11 @@ $string['forceloginforprofiles'] = 'Force users to login for profiles';
 $string['forcetimezone'] = 'Force default timezone';
 $string['framename'] = 'Frame name';
 $string['frontpage'] = 'Front Page';
+$string['frontpagebackup'] = 'Front Page backup';
 $string['frontpageloggedin'] = 'Front page items when logged in';
+$string['frontpagerestore'] = 'Front Page restore';
+$string['frontpageroles'] = 'Front Page roles';
+$string['frontpagesettings'] = 'Front Page settings';
 $string['fullnamedisplay'] = 'Full Name Format';
 $string['gdversion'] = 'GD version';
 $string['generalsettings'] = 'General settings';
index 0f22ea1d8776fcaeb855087121b6cbcda9a0a592..30255f5de0caefe513c09d15506683399af830bf 100644 (file)
@@ -512,7 +512,7 @@ function create_admin_user() {
         if (!$adminroles = get_roles_with_capability('moodle/legacy:admin', CAP_ALLOW)) {
             error('No admin role could be found');
         }
-        $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
+        $sitecontext = get_context_instance(CONTEXT_SYSTEM);
         foreach ($adminroles as $adminrole) {
             role_assign($adminrole->id, $user->id, 0, $sitecontext->id);
         }
@@ -1113,6 +1113,11 @@ class admin_externalpage extends part_of_admin_tree {
      */
     var $req_capability;
 
+    /**
+     * @var object The context in which capability/permission should be checked, default is site context.
+     */
+    var $context;
+
     /**
      * @var bool hidden in admin tree block.
      */
@@ -1126,7 +1131,7 @@ class admin_externalpage extends part_of_admin_tree {
      * @param string $url The external URL that we should link to when someone requests this external page.
      * @param mixed $req_capability The role capability/permission a user must have to access this external page. Defaults to 'moodle/site:config'.
      */
-    function admin_externalpage($name, $visiblename, $url, $req_capability = 'moodle/site:config', $hidden=false) {
+    function admin_externalpage($name, $visiblename, $url, $req_capability = 'moodle/site:config', $hidden=false, $context=false) {
         $this->name = $name;
         $this->visiblename = $visiblename;
         $this->url = $url;
@@ -1136,6 +1141,7 @@ class admin_externalpage extends part_of_admin_tree {
             $this->req_capability = array($req_capability);
         }
         $this->hidden = $hidden;
+        $this->context = $context;
     }
 
     /**
@@ -1180,7 +1186,7 @@ class admin_externalpage extends part_of_admin_tree {
         if (!get_site()) {
             return true; // no access check before site is fully set up
         }
-        $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+        $context = empty($this->context) ? get_context_instance(CONTEXT_SYSTEM) : $this->context;
         foreach($this->req_capability as $cap) {
             if (has_capability($cap, $context)) {
                 return true;
@@ -1227,6 +1233,11 @@ class admin_settingpage extends part_of_admin_tree {
      */
     var $req_capability;
 
+    /**
+     * @var object The context in which capability/permission should be checked, default is site context.
+     */
+    var $context;
+
     /**
      * @var bool hidden in admin tree block.
      */
@@ -1253,7 +1264,7 @@ class admin_settingpage extends part_of_admin_tree {
     }
 
     // see admin_externalpage
-    function admin_settingpage($name, $visiblename, $req_capability = 'moodle/site:config', $hidden=false) {
+    function admin_settingpage($name, $visiblename, $req_capability = 'moodle/site:config', $hidden=false, $context=false) {
         global $CFG;
         $this->settings = new stdClass();
         $this->name = $name;
@@ -1264,6 +1275,7 @@ class admin_settingpage extends part_of_admin_tree {
             $this->req_capability = array($req_capability);
         }
         $this->hidden = false;
+        $this->context = $context;
     }
 
     // not the same as add for admin_category. adds an admin_setting to this admin_settingpage. settings appear (on the settingpage) in the order in which they're added
@@ -1283,7 +1295,7 @@ class admin_settingpage extends part_of_admin_tree {
         if (!get_site()) {
             return true; // no access check before site is fully set up
         }
-        $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+        $context = empty($this->context) ? get_context_instance(CONTEXT_SYSTEM) : $this->context;
         foreach($this->req_capability as $cap) {
             if (has_capability($cap, $context)) {
                 return true;
index 7924d199e5fe3f8bd9aa1dfbd2e47bafbd79027a..69cdccfe2ed8a05b6e7007494364e99232c3de83 100644 (file)
@@ -295,7 +295,7 @@ class page_base {
 
     // is this  page always editable, regardless of anything else?
     function edit_always() {
-        return (has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID)) &&  defined('ADMIN_STICKYBLOCKS'));
+        return (has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM)) &&  defined('ADMIN_STICKYBLOCKS'));
     }
 }
 
@@ -347,7 +347,7 @@ class page_course extends page_base {
     // This is also about editting of blocks BUT mainly activities in course page layout, see
     // update_course_icon() - it must use the same capability
     function user_allowed_editing() {
-        if (has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID)) && defined('ADMIN_STICKYBLOCKS')) {
+        if (has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM)) && defined('ADMIN_STICKYBLOCKS')) {
             return true;
         }
         return has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $this->id));
@@ -355,7 +355,7 @@ class page_course extends page_base {
 
     // Is the user actually editing this course page or "sticky page" right now?
     function user_is_editing() {
-        if (has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID)) && defined('ADMIN_STICKYBLOCKS')) {
+        if (has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM)) && defined('ADMIN_STICKYBLOCKS')) {
             //always in edit mode on sticky page
             return true;
         }