]> git.mjollnir.org Git - moodle.git/commitdiff
Final pieces to allow site-wide configuration of name display.
authormoodler <moodler>
Sun, 30 Nov 2003 14:02:01 +0000 (14:02 +0000)
committermoodler <moodler>
Sun, 30 Nov 2003 14:02:01 +0000 (14:02 +0000)
Site variable can override order of "firstname lastname" or it
can leave it up to the language packs.

admin/config.html
lang/en/moodle.php
lib/defaults.php
lib/moodlelib.php

index 4eff2652e79ce0020d7f32f1b064f2e474019d42..68667b328cb562bffa4763d976baab45e174abdc 100644 (file)
     <?php print_string("configmaxbytes") ?>
     </td>
 </tr>
+<tr valign=top>
+       <td align=right><p>fullnamedisplay:</td>
+       <td>
+    <?php 
+       unset($options);
+       $options['language']  = get_string('language');
+       $options['firstname lastname']  = get_string('firstname') . ' + ' . get_string('lastname');
+       $options['lastname firstname']  = get_string('lastname') . ' + ' . get_string('firstname');
+       $options['firstname']  = get_string('firstname');
+
+       choose_from_menu ($options, "fullnamedisplay", $config->fullnamedisplay, "", "", "");
+    ?>
+    </td>
+    <td>
+    <?php print_string("configfullnamedisplay") ?>
+    </td>
+</tr>
 
 <tr>
     <td colspan=3 align=center>
index af4baa278dfe1962b93332783d25e75b33263feb..d51fed5d7468396cca4f4928539e60f7ed6ca878 100644 (file)
@@ -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';
index c17a49b6851b160cf4420f8a3ef747a11e78baa6..e80bf99d349162a5dff69efb9b66225e56c69d35 100644 (file)
@@ -9,7 +9,8 @@
        "changepassword"   =>  true,
        "country"          => "",
        "debug"            =>  7,
-       "framename"        =>  "_top",
+       "fullnamedisplay"  => "firstname lastname",
+       "framename"        => "_top",
        "frontpage"        =>  0,
        "gdversion"        =>  1,
        "guestloginbutton" =>  1,
index 423b554f868838817e0c80bd379313aa0fed897c..e92d4069610793d3dbd18f43daf05689ae1f3282 100644 (file)
@@ -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);
 }