From c6c558d785c12fe872e0328762f72f7e36c38133 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 27 Oct 2004 06:01:20 +0000 Subject: [PATCH] Merged in changes for lastaccess on site level from stable --- user/view.php | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/user/view.php b/user/view.php index f94557c359..f7e505be21 100644 --- a/user/view.php +++ b/user/view.php @@ -38,10 +38,12 @@ add_to_log($course->id, "user", "view", "view.php?id=$user->id&course=$course->id", "$user->id"); - if ($student = get_record("user_students", "userid", $user->id, "course", $course->id)) { - $user->lastaccess = $student->timeaccess; - } else if ($teacher = get_record("user_teachers", "userid", $user->id, "course", $course->id)) { - $user->lastaccess = $teacher->timeaccess; + if ($course->id != SITEID) { + if ($student = get_record("user_students", "userid", $user->id, "course", $course->id)) { + $user->lastaccess = $student->timeaccess; + } else if ($teacher = get_record("user_teachers", "userid", $user->id, "course", $course->id)) { + $user->lastaccess = $teacher->timeaccess; + } } $fullname = fullname($user, isteacher($course->id)); @@ -159,15 +161,20 @@ ($user->maildisplay == 2 and $course->category and !isguest()) or isteacher($course->id)) { + $emailswitch = ''; + if (isteacheredit($course->id) or $currentuser) { /// Can use the enable/disable email stuff - if (!empty($_GET['enable'])) { /// Recieved a paramter to enable the email address + if (!empty($_GET['enable'])) { /// Recieved a parameter to enable the email address set_field('user', 'emailstop', 0, 'id', $user->id); $user->emailstop = 0; } - if (!empty($_GET['disable'])) { /// Recieved a paramter to disable the email address + if (!empty($_GET['disable'])) { /// Recieved a parameter to disable the email address set_field('user', 'emailstop', 1, 'id', $user->id); $user->emailstop = 1; } + } + + if (isteacheredit($course->id)) { /// Can use the enable/disable email stuff if ($user->emailstop) { $switchparam = 'enable'; $switchtitle = get_string('emaildisable'); @@ -179,11 +186,19 @@ $switchclick = get_string('emaildisableclick'); $switchpix = 'email.gif'; } - $emailswitch = " id&course=$course->id&$switchparam=$user->id\">". - "pixpath/t/$switchpix\" alt=\"\" />"; - } else { - $emailswitch = ''; + $emailswitch = " id&course=$course->id&$switchparam=1\">". + "pixpath/t/$switchpix\">"; + + } else if ($currentuser) { /// Can only re-enable an email this way + if ($user->emailstop) { // Include link that tells how to re-enable their email + $switchparam = 'enable'; + $switchtitle = get_string('emaildisable'); + $switchclick = get_string('emailenableclick'); + + $emailswitch = " (id&course=$course->id&enable=1\">$switchtitle)"; + } } print_row(get_string("email").":", obfuscate_mailto($user->email, '', $user->emailstop)."$emailswitch"); -- 2.39.5