diff --git a/admin/roles/assign.php b/admin/roles/assign.php
index 70b0716c4e0..4d2c103c757 100755
--- a/admin/roles/assign.php
+++ b/admin/roles/assign.php
@@ -114,6 +114,13 @@
$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';
@@ -192,7 +199,11 @@
}
}
- 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
@@ -269,7 +280,7 @@
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);
diff --git a/admin/roles/override.php b/admin/roles/override.php
index da7cd5a8033..a52124f6913 100755
--- a/admin/roles/override.php
+++ b/admin/roles/override.php
@@ -135,6 +135,14 @@
$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';
@@ -199,6 +207,10 @@
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);
+ }
?>
diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php
index 7c721310d5f..a69baa0101e 100755
--- a/admin/roles/tabs.php
+++ b/admin/roles/tabs.php
@@ -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",
- "wwwroot/course/view.php?id=$course->id\">$course->shortname -> $straction");
+ if ($context->instanceid != SITEID) {
+ $streditcoursesettings = get_string("editcoursesettings");
+
+ $course = get_record('course', 'id', $context->instanceid);
+ print_header($streditcoursesettings, "$course->fullname",
+ "wwwroot/course/view.php?id=$course->id\">$course->shortname -> $straction");
+ }
break;
case CONTEXT_GROUP:
diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php
index 26c746793c4..3e9d484d6cd 100644
--- a/admin/settings/appearance.php
+++ b/admin/settings/appearance.php
@@ -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
index 00000000000..db771848612
--- /dev/null
+++ b/admin/settings/frontpage.php
@@ -0,0 +1,38 @@
+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.'&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
diff --git a/admin/settings/server.php b/admin/settings/server.php
index 8993484f3a5..30e1b701c31 100644
--- a/admin/settings/server.php
+++ b/admin/settings/server.php
@@ -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"));
diff --git a/admin/settings/top.php b/admin/settings/top.php
index e638989bf44..e538b68c313 100644
--- a/admin/settings/top.php
+++ b/admin/settings/top.php
@@ -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')));
diff --git a/blocks/admin/block_admin.php b/blocks/admin/block_admin.php
index 23f31d93df8..ebc31816ebe 100644
--- a/blocks/admin/block_admin.php
+++ b/blocks/admin/block_admin.php
@@ -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[]=''.get_string('assignroles', 'role').'';
$this->content->icons[]='
';
@@ -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[]=''.get_string('backup').'';
$this->content->icons[]='
';
}
/// Restore to this course
- if (has_capability('moodle/site:restore', $context)) {
+ if (has_capability('moodle/site:restore', $context) && ($course->id!==SITEID)) {
$this->content->items[]=''.get_string('restore').'';
$this->content->icons[]='
';
}
diff --git a/blocks/moodleblock.class.php b/blocks/moodleblock.class.php
index 38e4287fa04..27cda71f1ee 100644
--- a/blocks/moodleblock.class.php
+++ b/blocks/moodleblock.class.php
@@ -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;
}
diff --git a/files/index.php b/files/index.php
index 87b83c1b38f..1c6e43d1f13 100644
--- a/files/index.php
+++ b/files/index.php
@@ -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);
@@ -33,26 +34,26 @@
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 '';
- 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");
@@ -107,18 +108,26 @@
$fullnav = str_replace('->', '»', "$course->shortname -> $fullnav");
echo '