From: moodler Date: Wed, 26 Feb 2003 05:55:31 +0000 (+0000) Subject: No need for ismainteacher() ... it's enough to check that the user is X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d92a53d182f7cb6de78324b9066acbcc33e1a445;p=moodle.git No need for ismainteacher() ... it's enough to check that the user is a teacher in a course, and a creator. --- diff --git a/course/teacher.php b/course/teacher.php index 6e5656481f..7fe180fe8a 100644 --- a/course/teacher.php +++ b/course/teacher.php @@ -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 "id\">$course->fullname
\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."); } @@ -110,7 +110,7 @@ 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)) { diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 8c6d33158f..befe23378f 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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;