mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-32275 enrol: Last site access column now shows last course access
This commit is contained in:
parent
272fec367f
commit
e89682d822
6 changed files with 28 additions and 13 deletions
|
@ -1099,19 +1099,26 @@ class course_enrolment_manager {
|
|||
*/
|
||||
private function prepare_user_for_display($user, $extrafields, $now) {
|
||||
$details = array(
|
||||
'userid' => $user->id,
|
||||
'courseid' => $this->get_course()->id,
|
||||
'picture' => new user_picture($user),
|
||||
'firstname' => fullname($user, has_capability('moodle/site:viewfullnames', $this->get_context())),
|
||||
'lastseen' => get_string('never'),
|
||||
'userid' => $user->id,
|
||||
'courseid' => $this->get_course()->id,
|
||||
'picture' => new user_picture($user),
|
||||
'firstname' => fullname($user, has_capability('moodle/site:viewfullnames', $this->get_context())),
|
||||
'lastseen' => get_string('never'),
|
||||
'lastcourseaccess' => get_string('never'),
|
||||
);
|
||||
foreach ($extrafields as $field) {
|
||||
$details[$field] = $user->{$field};
|
||||
}
|
||||
|
||||
// Last time user has accessed the site.
|
||||
if ($user->lastaccess) {
|
||||
$details['lastseen'] = format_time($now - $user->lastaccess);
|
||||
}
|
||||
|
||||
// Last time user has accessed the course.
|
||||
if ($user->lastseen) {
|
||||
$details['lastcourseaccess'] = format_time($now - $user->lastseen);
|
||||
}
|
||||
return $details;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue