From bd38123e989356af82b8174650eb7ee0359bbd22 Mon Sep 17 00:00:00 2001 From: moodler Date: Fri, 1 Aug 2003 14:42:14 +0000 Subject: [PATCH] Completed mods to allow teachers to make backups --- backup/backup.php | 6 +++--- backup/backup_check.html | 12 +++++++++--- backup/backup_execute.html | 12 +++++++++--- backup/backup_form.html | 12 +++++++++--- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/backup/backup.php b/backup/backup.php index 767c7c12ad..70353184f6 100644 --- a/backup/backup.php +++ b/backup/backup.php @@ -67,9 +67,9 @@ "wwwroot/$CFG->admin/index.php\">$stradministration -> $strcoursebackup -> $course->fullname ($course->shortname)"); } else { - print_header("$site->shortname: $strcoursebackup", $site->fullname, - "wwwroot/$CFG->admin/index.php\">$stradministration -> - $strcoursebackup -> $course->fullname ($course->shortname)"); + print_header("$course->shortname: $strcoursebackup", $course->fullname, + "wwwroot/course/view.php?id=$course->id\">$course->shortname -> + $strcoursebackup"); } //Print form diff --git a/backup/backup_check.html b/backup/backup_check.html index 8c75523286..08652ef9ac 100644 --- a/backup/backup_check.html +++ b/backup/backup_check.html @@ -4,11 +4,17 @@ //Check login require_login(); - //Check admin - if (!isadmin()) { - error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php"); + if (!empty($course->id)) { + if (!isteacher($course->id)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } + } else { + if (!isadmin()) { + error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } } + //Check site if (!$site = get_site()) { error("Site not found!"); diff --git a/backup/backup_execute.html b/backup/backup_execute.html index 7394e0304b..8b79a6e6dc 100644 --- a/backup/backup_execute.html +++ b/backup/backup_execute.html @@ -4,11 +4,17 @@ //Check login require_login(); - //Check admin - if (!isadmin()) { - error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php"); + if (!empty($course->id)) { + if (!isteacher($course->id)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } + } else { + if (!isadmin()) { + error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } } + //Check site if (!$site = get_site()) { error("Site not found!"); diff --git a/backup/backup_form.html b/backup/backup_form.html index fe20b0033b..90e534131f 100644 --- a/backup/backup_form.html +++ b/backup/backup_form.html @@ -4,11 +4,17 @@ //Check login require_login(); - //Check admin - if (!isadmin()) { - error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php"); + if (!empty($course->id)) { + if (!isteacher($course->id)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } + } else { + if (!isadmin()) { + error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } } + //Check site if (!$site = get_site()) { error("Site not found!"); -- 2.39.5