From 6f80940b1e13132c88154e654d446e2b6000c189 Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 16 May 2004 10:34:17 +0000 Subject: [PATCH] Simpler method for recent activity .... I had problems with the other Use last access to course if it exists, otherwise two days ... --- course/lib.php | 9 ++------- course/recent.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/course/lib.php b/course/lib.php index 9c7e380b96..7f088dcc7b 100644 --- a/course/lib.php +++ b/course/lib.php @@ -482,19 +482,14 @@ function print_recent_activity($course) { $isteacher = isteacher($course->id); - $timestart = $USER->lastlogin; + $timestart = time() - COURSE_MAX_RECENT_PERIOD; if (!empty($USER->timeaccess[$course->id])) { - if ($USER->timeaccess[$course->id] < $timestart) { + if ($USER->timeaccess[$course->id] > $timestart) { $timestart = $USER->timeaccess[$course->id]; } } - $timemaxrecent = time() - COURSE_MAX_RECENT_PERIOD; - if ($timestart < $timemaxrecent) { - $timestart = $timemaxrecent; - } - echo '
'; echo get_string("activitysince", "", userdate($timestart)); diff --git a/course/recent.php b/course/recent.php index 911d86601d..351c92df74 100644 --- a/course/recent.php +++ b/course/recent.php @@ -31,7 +31,7 @@ if (!$u = get_record("user", "id", $user) ) { error("That's an invalid user!"); } - $userinfo = "$u->firstname $u->lastname"; + $userinfo = fullname($u); } if ($date) $dateinfo = userdate($date, get_string("strftimedaydate")); @@ -53,7 +53,13 @@ } else { if (empty($date)) { // no date picked, default to last login time - $date = $USER->lastlogin; + $date = time() - COURSE_MAX_RECENT_PERIOD; + + if (!empty($USER->timeaccess[$course->id])) { + if ($USER->timeaccess[$course->id] > $date) { + $date = $USER->timeaccess[$course->id]; + } + } } if ($course->category) { -- 2.39.5