mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26: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
|
@ -1104,14 +1104,21 @@ class course_enrolment_manager {
|
|||
'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']);
|
||||
|
|
|
@ -779,6 +779,7 @@ $string['first'] = 'First';
|
|||
$string['firstaccess'] = 'First access';
|
||||
$string['firstname'] = 'First name';
|
||||
$string['firstnamephonetic'] = 'First name - phonetic';
|
||||
$string['firstsiteaccess'] = 'First access to site';
|
||||
$string['firsttime'] = 'Is this your first time here?';
|
||||
$string['folder'] = 'Folder';
|
||||
$string['folderclosed'] = 'Closed folder';
|
||||
|
@ -1007,12 +1008,14 @@ $string['language'] = 'Language';
|
|||
$string['languagegood'] = 'This language pack is up-to-date! :-)';
|
||||
$string['last'] = 'Last';
|
||||
$string['lastaccess'] = 'Last access';
|
||||
$string['lastcourseaccess'] = 'Last access to course';
|
||||
$string['lastedited'] = 'Last edited';
|
||||
$string['lastip'] = 'Last IP address';
|
||||
$string['lastlogin'] = 'Last login';
|
||||
$string['lastmodified'] = 'Last modified';
|
||||
$string['lastname'] = 'Surname';
|
||||
$string['lastnamephonetic'] = 'Surname - phonetic';
|
||||
$string['lastsiteaccess'] = 'Last access to site';
|
||||
$string['lastyear'] = 'Last year';
|
||||
$string['latestlanguagepack'] = 'Check for latest language pack on moodle.org';
|
||||
$string['layouttable'] = 'Layout table';
|
||||
|
|
|
@ -363,7 +363,12 @@ if ($mode === MODE_BRIEF && !isset($hiddenfields['country'])) {
|
|||
}
|
||||
if (!isset($hiddenfields['lastaccess'])) {
|
||||
$tablecolumns[] = 'lastaccess';
|
||||
$tableheaders[] = get_string('lastaccess');
|
||||
if ($course->id == SITEID) {
|
||||
// Exception case for viewing participants on site home.
|
||||
$tableheaders[] = get_string('lastsiteaccess');
|
||||
} else {
|
||||
$tableheaders[] = get_string('lastcourseaccess');
|
||||
}
|
||||
}
|
||||
|
||||
if ($bulkoperations && $mode === MODE_USERDETAILS) {
|
||||
|
@ -376,8 +381,8 @@ $table->define_columns($tablecolumns);
|
|||
$table->define_headers($tableheaders);
|
||||
$table->define_baseurl($baseurl->out());
|
||||
|
||||
if (!isset($hiddenfields['lastaccess'])) {
|
||||
$table->sortable(true, 'lastaccess', SORT_DESC);
|
||||
if (!isset($hiddenfields['lastcourseaccess'])) {
|
||||
$table->sortable(true, 'lastcourseaccess', SORT_DESC);
|
||||
} else {
|
||||
$table->sortable(true, 'firstname', SORT_ASC);
|
||||
}
|
||||
|
|
|
@ -407,7 +407,7 @@ if (!isset($hiddenfields['firstaccess'])) {
|
|||
} else {
|
||||
$datestring = get_string("never");
|
||||
}
|
||||
echo html_writer::tag('dt', get_string('firstaccess'));
|
||||
echo html_writer::tag('dt', get_string('firstsiteaccess'));
|
||||
echo html_writer::tag('dd', $datestring);
|
||||
}
|
||||
if (!isset($hiddenfields['lastaccess'])) {
|
||||
|
@ -416,7 +416,7 @@ if (!isset($hiddenfields['lastaccess'])) {
|
|||
} else {
|
||||
$datestring = get_string("never");
|
||||
}
|
||||
echo html_writer::tag('dt', get_string('lastaccess'));
|
||||
echo html_writer::tag('dt', get_string('lastsiteaccess'));
|
||||
echo html_writer::tag('dd', $datestring);
|
||||
}
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ if (!isset($hiddenfields['lastaccess'])) {
|
|||
} else {
|
||||
$datestring = get_string("never");
|
||||
}
|
||||
echo html_writer::tag('dt', get_string('lastaccess'));
|
||||
echo html_writer::tag('dt', get_string('lastcourseaccess'));
|
||||
echo html_writer::tag('dd', $datestring);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue