]> git.mjollnir.org Git - moodle.git/commitdiff
Admin can now also 'login as' course creators
authormoodler <moodler>
Mon, 6 Sep 2004 14:03:17 +0000 (14:03 +0000)
committermoodler <moodler>
Mon, 6 Sep 2004 14:03:17 +0000 (14:03 +0000)
lib/weblib.php
user/view.php

index 32cec99e5af06b1bea30abb58a22cf45b4b327a0..c1eea0abb837a067c9d10e6ce05bb4f711ec2fcb 100644 (file)
@@ -1428,6 +1428,7 @@ function print_user($user, $course) {
     static $datestring;
     static $countries;
     static $isteacher;
+    static $isadmin;
 
     if (empty($string)) {     // Cache all the strings for the rest of the page
 
@@ -1454,6 +1455,7 @@ function print_user($user, $course) {
         $countries = get_list_of_countries();
 
         $isteacher = isteacher($course->id);
+        $isadmin   = isadmin();
     }
 
     echo '<table width="80%" align="center" border="0" cellpadding="10" cellspacing="0" class="userinfobox">';
@@ -1496,7 +1498,7 @@ function print_user($user, $course) {
     if ($isteacher) {
         $timemidnight = usergetmidnight(time());
         echo "<a href=\"$CFG->wwwroot/course/user.php?id=$course->id&user=$user->id\">$string->activity</a><br>";
-        if (!iscreator($user->id)) {  // Includes admins
+        if (!iscreator($user->id) or ($isadmin and !isadmin($user->id))) {  // Includes admins
             if ($course->category and isteacheredit($course->id) and isstudent($course->id, $user->id)) {  // Includes admins
                 echo "<a href=\"$CFG->wwwroot/course/unenrol.php?id=$course->id&user=$user->id\">$string->unenrol</a><br />";
             }
index afffb11c4269ec4c2482edc7346971e229c092a5..dbcbeed339bbdbe6dd4cb2521c7749e3cf7a638f 100644 (file)
         echo "<input type=submit value=\"".get_string("activityreport")."\">";
         echo "</form></p></td>";
     }
-    if (isteacher($course->id) and ($USER->id != $user->id) and !iscreator($user->id)) {
+    if ((isadmin() and !isadmin($user->id)) or (isteacher($course->id) and ($USER->id != $user->id) and !iscreator($user->id))) {
         echo "<td nowrap><p><form action=\"../course/loginas.php\" method=get>";
         echo "<input type=hidden name=id value=\"$course->id\">";
         echo "<input type=hidden name=user value=\"$user->id\">";