diff --git a/lib/tablelib.php b/lib/tablelib.php index 9c7477483d3..b69225ae805 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -658,8 +658,21 @@ class flexible_table { $fsortorder = get_string('asc'); $lsortorder = get_string('asc'); } - $this->headers[$index] = ''.get_string('firstname').get_accesshide(get_string('sortby').' '.get_string('firstname').' '.$fsortorder).' '.$icon_sort_first.' / '. - ''.get_string('lastname').get_accesshide(get_string('sortby').' '.get_string('lastname').' '.$lsortorder).' '.$icon_sort_last; + + $override = new object(); + $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' )) { + $this->headers[$index] = ''.get_string('firstname').get_accesshide(get_string('sortby').' '.get_string('firstname').' '.$fsortorder).' '.$icon_sort_first.' / '. + ''.get_string('lastname').get_accesshide(get_string('sortby').' '.get_string('lastname').' '.$lsortorder).' '.$icon_sort_last; + } else { + $this->headers[$index] = ''.get_string('lastname').get_accesshide(get_string('sortby').' '.get_string('lastname').' '.$lsortorder).' '.$icon_sort_last.' / '. + ''.get_string('firstname').get_accesshide(get_string('sortby').' '.get_string('firstname').' '.$fsortorder).' '.$icon_sort_first; + } } break;