diff --git a/course/lib.php b/course/lib.php index 8f57443a021..9c7e380b965 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 89262dc0396..22887a61637 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; } }