]> git.mjollnir.org Git - moodle.git/commitdiff
Only editing teachers can see files
authormoodler <moodler>
Sat, 17 Jan 2004 05:39:29 +0000 (05:39 +0000)
committermoodler <moodler>
Sat, 17 Jan 2004 05:39:29 +0000 (05:39 +0000)
course/lib.php
files/index.php

index 613de57e50a1bb69172c2a1e0adbe26e567a3a31..f3f382c8d43d4adbf5f68c78dfcade77740a7fee 100644 (file)
@@ -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[]="<img src=\"$CFG->pixpath/i/edit.gif\" height=16 width=16 alt=\"\">";
             if (isediting($course->id)) {
                 $admindata[]="<a href=\"view.php?id=$course->id&edit=off\">".get_string("turneditingoff")."</a>";
@@ -887,7 +891,7 @@ function print_course_admin_links($course, $width=180) {
         $admindata[]="<a href=\"student.php?id=$course->id\">$course->students...</a>";
         $adminicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
 
-        if (isteacheredit($course->id)) {
+        if ($isteacheredit) {
             $admindata[]="<a href=\"$CFG->wwwroot/backup/backup.php?id=$course->id\">".get_string("backup")."...</a>";
             $adminicon[]="<img src=\"$CFG->pixpath/i/backup.gif\" height=16 width=16 alt=\"\">";
         
@@ -903,8 +907,10 @@ function print_course_admin_links($course, $width=180) {
         $admindata[]="<a href=\"log.php?id=$course->id\">".get_string("logs")."...</a>";
         $adminicon[]="<img src=\"$CFG->pixpath/i/log.gif\" height=16 width=16 alt=\"\">";
 
-        $admindata[]="<a href=\"$CFG->wwwroot/files/index.php?id=$course->id\">".get_string("files")."...</a>";
-        $adminicon[]="<img src=\"$CFG->pixpath/i/files.gif\" height=16 width=16 alt=\"\">";
+        if ($isteacheredit) {
+            $admindata[]="<a href=\"$CFG->wwwroot/files/index.php?id=$course->id\">".get_string("files")."...</a>";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/files.gif\" height=16 width=16 alt=\"\">";
+        }
 
         $admindata[]="<a href=\"$CFG->wwwroot/doc/view.php?id=$course->id&file=teacher.html\">".get_string("help")."...</a>";
         $adminicon[]="<img src=\"$CFG->modpixpath/resource/icon.gif\" height=16 width=16 alt=\"\">";
index 2260d1bbb92132379391cca39762cc8466239abd..ba0300cba737b698deee0d53b32a53b7b5b6cde0 100644 (file)
@@ -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() {