From: moodler Date: Sun, 30 Nov 2003 14:02:01 +0000 (+0000) Subject: Final pieces to allow site-wide configuration of name display. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b5cbb64dc5ead42a93c1b8bdce544e1255cae814;p=moodle.git Final pieces to allow site-wide configuration of name display. Site variable can override order of "firstname lastname" or it can leave it up to the language packs. --- diff --git a/admin/config.html b/admin/config.html index 4eff2652e7..68667b328c 100644 --- a/admin/config.html +++ b/admin/config.html @@ -336,6 +336,23 @@ + +

fullnamedisplay: + + fullnamedisplay, "", "", ""); + ?> + + + + + diff --git a/lang/en/moodle.php b/lang/en/moodle.php index af4baa278d..d51fed5d74 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -112,6 +112,7 @@ $string['configcountry'] = 'If you set a country here, then this country will be $string['configdebug'] = 'If you turn this on, then PHP\'s error_reporting will be increased so that more warnings are printed. This is only useful for developers.'; $string['configerrorlevel'] = 'Choose the amount of PHP warnings that you want to be displayed. Normal is usually the best choice.'; $string['configframename'] = 'If you are embedding Moodle within a web frame, then put the name of this frame here. Otherwise this value should remain as \'_top\''; +$string['configfullnamedisplay'] = 'This defines how names are shown when they are displayed in full. For most mono-lingual sites the most efficient setting is the default \"Given names + Surname\", but you may choose to hide surnames altogether, or to leave it up to the current language pack to decide (some languages have different conventions).'; $string['configgdversion'] = 'Indicate the version of GD that is installed. The version shown by default is the one that has been auto-detected. Don\'t change this unless you really know what you\'re doing.'; $string['confightmleditor'] = 'Choose whether or not to allow use of the embedded HTML text editor. Even if you choose allow, this editor will only appear when the user is using a compatible browser (IE 5.5 or later). Users can also choose not to use it.'; $string['configidnumber'] = 'This option specifies whether (a) Users are not be asked for an ID number at all, (b) Users are asked for an ID number but can leave it blank or (c) Users are asked for an ID Number and cannot leave it blank. If given the User\'s ID number is displayed in their Profile.'; @@ -312,7 +313,7 @@ $string['files'] = 'Files'; $string['filesfolders'] = 'Files/folders'; $string['filloutallfields'] = 'Please fill out all fields in this form'; $string['findmorecourses'] = 'Find more courses...'; -$string['firstname'] = 'First name'; +$string['firstname'] = 'Given name(s)'; $string['firsttime'] = 'Is this your first time here?'; $string['followingoptional'] = 'The following items are optional'; $string['followingrequired'] = 'The following items are required'; @@ -334,6 +335,7 @@ $string['frontpageformat'] = 'Front page format'; $string['frontpagenews'] = 'Show news items'; $string['fulllistofcourses'] = 'All courses'; $string['fullname'] = 'Full name'; +$string['fullnamedisplay'] = '$a->firstname $a->lastname'; $string['fullprofile'] = 'Full profile'; $string['fullsitename'] = 'Full site name'; $string['gd1'] = 'GD 1.x is installed'; @@ -409,7 +411,7 @@ $string['lastaccess'] = 'Last access'; $string['lastedited'] = 'Last edited'; $string['lastlogin'] = 'Last Login'; $string['lastmodified'] = 'Last modified'; -$string['lastname'] = 'Last name'; +$string['lastname'] = 'Surname'; $string['latestlanguagepack'] = 'Check for latest language pack on moodle.org'; $string['latestnews'] = 'Latest news'; $string['leavetokeep'] = 'Leave blank to keep current password'; diff --git a/lib/defaults.php b/lib/defaults.php index c17a49b685..e80bf99d34 100644 --- a/lib/defaults.php +++ b/lib/defaults.php @@ -9,7 +9,8 @@ "changepassword" => true, "country" => "", "debug" => 7, - "framename" => "_top", + "fullnamedisplay" => "firstname lastname", + "framename" => "_top", "frontpage" => 0, "gdversion" => 1, "guestloginbutton" => 1, diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 423b554f86..e92d406961 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -497,19 +497,30 @@ function ismoving($courseid) { } function fullname($user, $override=false) { -/// Given a user object, this function returns a -/// string with the full name of the person. +/// Given an object containing firstname and lastname +/// values, this function returns a string with the +/// full name of the person. /// The result may depend on system settings -/// or language. Override will force both names +/// or language. 'override' will force both names /// to be used even if system settings specify one. + global $CFG; - /// XXX - /// XXX this function is not finished yet! - /// XXX + if ($CFG->fullnamedisplay == 'firstname lastname') { + return "$user->firstname $user->lastname"; + + } else if ($CFG->fullnamedisplay == 'lastname firstname') { + return "$user->lastname $user->firstname"; - return "$user->firstname $user->lastname"; + } else if ($CFG->fullnamedisplay == 'firstname') { + if ($override) { + return get_string('fullnamedisplay', '', $user); + } else { + return $user->firstname; + } + } + return get_string('fullnamedisplay', '', $user); }