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.
This commit is contained in:
+6
-7
@@ -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 '<p align="center"><font size="1">';
|
||||
print_string("welcometocourse", "", $course->shortname);
|
||||
echo '</font></p>';
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user