mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'wip-MDL-46921-master' of git://github.com/abgreeve/moodle
This commit is contained in:
commit
e6b00f032d
9 changed files with 145 additions and 44 deletions
|
@ -243,16 +243,8 @@ class course_enrolment_manager {
|
|||
JOIN {enrol} e ON (e.id = ue.enrolid)
|
||||
LEFT JOIN {user_lastaccess} ul ON (ul.courseid = e.courseid AND ul.userid = u.id)
|
||||
LEFT JOIN {groups_members} gm ON u.id = gm.userid
|
||||
WHERE $filtersql";
|
||||
if ($sort === 'firstname') {
|
||||
$sql .= " ORDER BY u.firstname $direction, u.lastname $direction";
|
||||
} else if ($sort === 'lastname') {
|
||||
$sql .= " ORDER BY u.lastname $direction, u.firstname $direction";
|
||||
} else if ($sort === 'email') {
|
||||
$sql .= " ORDER BY u.email $direction, u.lastname $direction, u.firstname $direction";
|
||||
} else if ($sort === 'lastseen') {
|
||||
$sql .= " ORDER BY ul.timeaccess $direction, u.lastname $direction, u.firstname $direction";
|
||||
}
|
||||
WHERE $filtersql
|
||||
ORDER BY u.$sort $direction";
|
||||
$this->users[$key] = $DB->get_records_sql($sql, $params, $page*$perpage, $perpage);
|
||||
}
|
||||
return $this->users[$key];
|
||||
|
|
|
@ -420,8 +420,8 @@ class course_enrolment_table extends html_table implements renderable {
|
|||
* @static
|
||||
* @var array
|
||||
*/
|
||||
protected static $sortablefields = array('firstname', 'lastname', 'idnumber', 'email',
|
||||
'phone1', 'phone2', 'institution', 'department' );
|
||||
protected static $sortablefields = array('firstname', 'lastname', 'firstnamephonetic', 'lastnamephonetic', 'middlename',
|
||||
'alternatename', 'idnumber', 'email', 'phone1', 'phone2', 'institution', 'department' );
|
||||
|
||||
/**
|
||||
* Constructs the table
|
||||
|
@ -709,7 +709,8 @@ class course_enrolment_users_table extends course_enrolment_table {
|
|||
* @static
|
||||
* @var array
|
||||
*/
|
||||
protected static $sortablefields = array('firstname', 'lastname', 'email', 'lastaccess');
|
||||
protected static $sortablefields = array('firstname', 'lastname', 'firstnamephonetic', 'lastnamephonetic', 'middlename',
|
||||
'alternatename', 'email', 'lastaccess');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -174,11 +174,25 @@ if ($action) {
|
|||
|
||||
|
||||
$renderer = $PAGE->get_renderer('core_enrol');
|
||||
$userdetails = array (
|
||||
'picture' => false,
|
||||
'firstname' => get_string('firstname'),
|
||||
'lastname' => get_string('lastname'),
|
||||
);
|
||||
$userdetails = array('picture' => false);
|
||||
// Get all the user names in a reasonable default order.
|
||||
$allusernames = get_all_user_name_fields(false, null, null, null, true);
|
||||
// Initialise the variable for the user's names in the table header.
|
||||
$usernameheader = null;
|
||||
// Get the alternative full name format for users with the viewfullnames capability.
|
||||
$fullusernames = $CFG->alternativefullnameformat;
|
||||
// If fullusernames is empty or accidentally set to language then fall back on the $allusernames set up.
|
||||
if ($fullusernames == 'language' || empty($fullusernames)) {
|
||||
$usernameheader = $allusernames;
|
||||
} else {
|
||||
// If everything is as expected then put them in the order specified by the alternative full name format setting.
|
||||
$usernameheader = order_in_string($allusernames, $fullusernames);
|
||||
}
|
||||
|
||||
// Loop through each name and return the language string.
|
||||
foreach ($usernameheader as $key => $username) {
|
||||
$userdetails[$username] = get_string($username);
|
||||
}
|
||||
$extrafields = get_extra_user_fields($context);
|
||||
foreach ($extrafields as $field) {
|
||||
$userdetails[$field] = get_user_field_name($field);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue