]> git.mjollnir.org Git - moodle.git/commitdiff
No need for ismainteacher() ... it's enough to check that the user is
authormoodler <moodler>
Wed, 26 Feb 2003 05:55:31 +0000 (05:55 +0000)
committermoodler <moodler>
Wed, 26 Feb 2003 05:55:31 +0000 (05:55 +0000)
a teacher in a course, and a creator.

course/teacher.php
lib/moodlelib.php

index 6e5656481f0f2203f40dac3968aa5f1534019a9f..7fe180fe8ae5dfeb13fb32c1bbc8f04358b36d15 100644 (file)
@@ -13,7 +13,7 @@
     require_login();
 
     if (!iscreator()) {
-        error("You must be an administrator or teacher to use this page.");
+        error("You must be an administrator or course creator to use this page.");
     }
 
     $strassignteachers = get_string("assignteachers");
@@ -40,7 +40,7 @@
                print_simple_box_start("CENTER");
         
                foreach ($courses as $course) {
-                   if ($isadmin OR ismainteacher($course->id, $USER->id)){
+                   if ($isadmin OR isteacher($course->id, $USER->id)){
                            echo "<A HREF=\"teacher.php?id=$course->id\">$course->fullname</A><BR>\n";
                                $coursesfound = TRUE;
                        }
@@ -76,7 +76,7 @@
 /// Add a teacher if one is specified
 
     if (!empty($add)) {
-           if (!ismainteacher($course->id, $USER->id)){
+           if (!isteacher($course->id, $USER->id)){
                    error("You must be an administrator or teacher to modify this course.");
         }
 
 
     if (!empty($remove)) {
 
-        if (!ismainteacher($course->id, $USER->id)){
+        if (!isteacher($course->id, $USER->id)){
                error("You must be an administrator or teacher to modify this course.");
                }
         if (! $user = get_record("user", "id", $remove)) {
index 8c6d33158f7b85d54a8b627a08957dbf3ec96bc7..befe23378f804769b803bcbb2a5d025037b79e76 100644 (file)
@@ -418,24 +418,6 @@ function iscreator ($userid=0) {
     return record_exists("user_coursecreators", "userid", $userid);
 }
 
-function ismainteacher ($courseid, $userid=0){
-/// Is user the main teacher of course
-    global $USER;
-
-    if (isadmin($userid)) {  // admins can do anything the teacher can
-        return true;
-    }
-
-       if (empty($userid)) {
-        if (empty($USER->id)) {
-            return false;
-        }
-        $userid = $USER->id;
-    }
-    
-    return record_exists("user_teachers", "userid", $userid, "course", $courseid, "authority", "1");
-}
-
 function isstudent($courseid, $userid=0) {
 /// Is the user a student in this course?
     global $USER;