From eef16119b967a437efd3595d916689ced3867ca3 Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 17 Jan 2004 05:39:29 +0000 Subject: [PATCH] Only editing teachers can see files --- course/lib.php | 14 ++++++++++---- files/index.php | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/course/lib.php b/course/lib.php index 613de57e50..f3f382c8d4 100644 --- a/course/lib.php +++ b/course/lib.php @@ -861,8 +861,12 @@ function print_course_admin_links($course, $width=180) { if (isguest()) { return true; } + if (isteacher($course->id)) { - if (isteacheredit($course->id)) { + + $isteacheredit = isteacheredit($course->id); + + if ($isteacheredit) { $adminicon[]="pixpath/i/edit.gif\" height=16 width=16 alt=\"\">"; if (isediting($course->id)) { $admindata[]="id&edit=off\">".get_string("turneditingoff").""; @@ -887,7 +891,7 @@ function print_course_admin_links($course, $width=180) { $admindata[]="id\">$course->students..."; $adminicon[]="pixpath/i/users.gif\" height=16 width=16 alt=\"\">"; - if (isteacheredit($course->id)) { + if ($isteacheredit) { $admindata[]="wwwroot/backup/backup.php?id=$course->id\">".get_string("backup")."..."; $adminicon[]="pixpath/i/backup.gif\" height=16 width=16 alt=\"\">"; @@ -903,8 +907,10 @@ function print_course_admin_links($course, $width=180) { $admindata[]="id\">".get_string("logs")."..."; $adminicon[]="pixpath/i/log.gif\" height=16 width=16 alt=\"\">"; - $admindata[]="wwwroot/files/index.php?id=$course->id\">".get_string("files")."..."; - $adminicon[]="pixpath/i/files.gif\" height=16 width=16 alt=\"\">"; + if ($isteacheredit) { + $admindata[]="wwwroot/files/index.php?id=$course->id\">".get_string("files")."..."; + $adminicon[]="pixpath/i/files.gif\" height=16 width=16 alt=\"\">"; + } $admindata[]="wwwroot/doc/view.php?id=$course->id&file=teacher.html\">".get_string("help")."..."; $adminicon[]="modpixpath/resource/icon.gif\" height=16 width=16 alt=\"\">"; diff --git a/files/index.php b/files/index.php index 2260d1bbb9..ba0300cba7 100644 --- a/files/index.php +++ b/files/index.php @@ -20,8 +20,8 @@ require_login($course->id); - if (! isteacher($course->id) ) { - error("Only teachers can edit files"); + if (! isteacheredit($course->id) ) { + error("You need to be a teacher with editing privileges"); } function html_footer() { -- 2.39.5