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");
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;
}
/// 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)) {
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;