From 9e51847a1834d08bce5d625ce51da239ae834e07 Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 15 May 2004 14:58:12 +0000 Subject: [PATCH] Slight change to recent activity calculations in RA block. Upon login, the last access to each course is stored in the USER session variable. The earliest date of recent activity now shown is now the earliest of: - this last access time - the last login time If this value is older than two days, then just use two days instead. --- course/lib.php | 13 ++++++------- lib/datalib.php | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/course/lib.php b/course/lib.php index 8f57443a02..9c7e380b96 100644 --- a/course/lib.php +++ b/course/lib.php @@ -12,7 +12,7 @@ define('COURSE_MAX_LOGS_PER_PAGE', 1000); // records define('COURSE_LIVELOG_REFRESH', 60); // Seconds -define('COURSE_MAX_RECENT_PERIOD', 86400); // A day, in seconds +define('COURSE_MAX_RECENT_PERIOD', 172800); // Two days, in seconds define('COURSE_MAX_SUMMARIES_PER_PAGE', 10); // courses @@ -482,15 +482,14 @@ function print_recent_activity($course) { $isteacher = isteacher($course->id); + $timestart = $USER->lastlogin; - if (empty($USER->lastlogin)) { - echo '

'; - print_string("welcometocourse", "", $course->shortname); - echo '

'; - return; + if (!empty($USER->timeaccess[$course->id])) { + if ($USER->timeaccess[$course->id] < $timestart) { + $timestart = $USER->timeaccess[$course->id]; + } } - $timestart = $USER->lastlogin; $timemaxrecent = time() - COURSE_MAX_RECENT_PERIOD; if ($timestart < $timemaxrecent) { $timestart = $timemaxrecent; diff --git a/lib/datalib.php b/lib/datalib.php index 89262dc039..22887a6163 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -912,6 +912,7 @@ function get_user_info_from_db($field, $value) { if (get_field("course", "visible", "id", $student->course)) { $user->student[$student->course] = true; } + $user->timeaccess[$student->course] = $student->timeaccess; } } @@ -921,6 +922,7 @@ function get_user_info_from_db($field, $value) { if ($teacher->editall) { $user->teacheredit[$teacher->course] = true; } + $user->timeaccess[$teacher->course] = $teacher->timeaccess; } } -- 2.39.5