Simpler method for recent activity .... I had problems with the other
authormoodler <moodler>
Sun, 16 May 2004 10:34:17 +0000 (10:34 +0000)
committermoodler <moodler>
Sun, 16 May 2004 10:34:17 +0000 (10:34 +0000)
  Use last access to course if it exists, otherwise two days ...

course/lib.php
course/recent.php

index 9c7e380b965317997cb1d2c36d4a35a282a4eb52..7f088dcc7b745cb774826f4f735bba18bb895bf8 100644 (file)
@@ -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 '<center><font size="1">';
     echo get_string("activitysince", "", userdate($timestart));
 
index 911d86601d3c4414068479f5589cd2edfa5cb70a..351c92df7499a59bb49b96d780186f72f79d3478 100644 (file)
@@ -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"));
     } 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) {