Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-15930 - admin: reorganize logic to allow ->fullnamedisplay to be …

…used as default sort.
  • Loading branch information...
commit b31f52340c53aa05145dc1dd05f87d5a822d9a85 1 parent 2713f92
@arborrow arborrow authored abgreeve committed
Showing with 16 additions and 14 deletions.
  1. +16 −14 admin/user.php
View
30 admin/user.php
@@ -177,8 +177,22 @@
$$column = "<a href=\"user.php?sort=$column&amp;dir=$columndir\">".$string[$column]."</a>$columnicon";
}
- if ($sort == "name") {
- $sort = "firstname";
+ $override = new stdClass();
+ $override->firstname = 'firstname';
+ $override->lastname = 'lastname';
+ $fullnamelanguage = get_string('fullnamedisplay', '', $override);
+ if (($CFG->fullnamedisplay == 'firstname lastname') or
+ ($CFG->fullnamedisplay == 'firstname') or
+ ($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'firstname lastname' )) {
+ $fullnamedisplay = "$firstname / $lastname";
+ if ($sort == "name") { // If sort has already been set to something else then ignore.
+ $sort = "firstname";
+ }
+ } else { // ($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'lastname firstname').
+ $fullnamedisplay = "$lastname / $firstname";
+ if ($sort == "name") { // This should give the desired sorting based on fullnamedisplay.
+ $sort = "lastname";
+ }
}
list($extrasql, $params) = $ufiltering->get_sql_filter();
@@ -231,18 +245,6 @@
$users = $nusers;
}
- $override = new stdClass();
- $override->firstname = 'firstname';
- $override->lastname = 'lastname';
- $fullnamelanguage = get_string('fullnamedisplay', '', $override);
- if (($CFG->fullnamedisplay == 'firstname lastname') or
- ($CFG->fullnamedisplay == 'firstname') or
- ($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'firstname lastname' )) {
- $fullnamedisplay = "$firstname / $lastname";
- } else { // ($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'lastname firstname')
- $fullnamedisplay = "$lastname / $firstname";
- }
-
$table = new html_table();
$table->head = array ();
$table->align = array();
Please sign in to comment.
Something went wrong with that request. Please try again.