mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +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;
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ foreach ($extrafields as $field) {
|
|||
|
||||
$fields = array(
|
||||
'userdetails' => $userdetails,
|
||||
'lastseen' => get_string('lastaccess'),
|
||||
'lastcourseaccess' => get_string('lastcourseaccess'),
|
||||
'role' => get_string('roles', 'role'),
|
||||
'group' => get_string('groups', 'group'),
|
||||
'enrol' => get_string('enrolmentinstances', 'enrol')
|
||||
|
@ -196,7 +196,7 @@ $fields = array(
|
|||
if (!has_capability('moodle/course:viewhiddenuserfields', $context)) {
|
||||
$hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
|
||||
if (isset($hiddenfields['lastaccess'])) {
|
||||
unset($fields['lastseen']);
|
||||
unset($fields['lastcourseaccess']);
|
||||
}
|
||||
if (isset($hiddenfields['groups'])) {
|
||||
unset($fields['group']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue