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:
moodler
2004-05-15 14:58:12 +00:00
parent 411a96bfed
commit 9e51847a18
2 changed files with 8 additions and 7 deletions
+6 -7
View File
@@ -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;
+2
View File
@@ -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;
}
}