diff --git a/include/class.user.php b/include/class.user.php index 0998f2348c1c6b8bc4c72b2165d50949e946dabe..125220bcefd4b2d501cdf75fc54587f178dad182 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -270,6 +270,7 @@ class PersonsName { 'short' => array("First L.", 'getShort'), 'shortformal' => array("F. Last", 'getShortFormal'), 'complete' => array("Mr. First M. Last Sr.", 'getComplete'), + 'original' => array('-- As Entered --', 'getOriginal'), ); function __construct($name) { @@ -342,6 +343,16 @@ class PersonsName { return $this->name; } + function getInitials() { + $names = array($this->parts['first']); + $names = array_merge($names, explode(' ', $this->parts['middle'])); + $names[] = $this->parts['last']; + $initials = ''; + foreach (array_filter($names) as $n) + $initials .= mb_substr($n,0,1); + return mb_convert_case($initials, MB_CASE_UPPER); + } + function asVar() { return $this->__toString(); } diff --git a/include/staff/templates/user-lookup.tmpl.php b/include/staff/templates/user-lookup.tmpl.php index c2d8951a5ed996c205ceaaa4ee3a577e6e65046c..baeaebc6ee869dfdced477108102b91b6031d112 100644 --- a/include/staff/templates/user-lookup.tmpl.php +++ b/include/staff/templates/user-lookup.tmpl.php @@ -16,7 +16,7 @@ if ($info['error']) { <i class="icon-user icon-4x pull-left icon-border"></i> <a class="action-button pull-right" style="overflow:inherit" id="unselect-user" href="#"><i class="icon-remove"></i> Add New User</a> - <div><strong id="user-name"><?php echo $user ? Format::htmlchars($user->getName()) : ''; ?></strong></div> + <div><strong id="user-name"><?php echo $user ? Format::htmlchars($user->getName()->getOriginal()) : ''; ?></strong></div> <div><<span id="user-email"><?php echo $user ? $user->getEmail() : ''; ?></span>></div> <?php if ($user) { ?> <table style="margin-top: 1em;"> diff --git a/include/staff/templates/user.tmpl.php b/include/staff/templates/user.tmpl.php index 2615cabbd72efe4173e45d65190cab3ef5cc49e8..e2f2fd3cd9b7a4f4eb78be207a549026d6a6790b 100644 --- a/include/staff/templates/user.tmpl.php +++ b/include/staff/templates/user.tmpl.php @@ -20,7 +20,7 @@ if ($info['error']) { <?php } ?> <div><b><a href="#" id="edituser"><i class="icon-edit"></i> <?php - echo Format::htmlchars($user->getName()); ?></a></b></div> + echo Format::htmlchars($user->getName()->getOriginal()); ?></a></b></div> <div><<?php echo $user->getEmail(); ?>></div> <table style="margin-top: 1em;"> <?php foreach ($user->getDynamicData() as $entry) {