Merge pull request #1523 from ralpheav/master

Adding userNameFormat function with 2 parameters only
This commit is contained in:
julceslauhub
2013-04-08 09:19:03 -07:00

View File

@@ -314,6 +314,29 @@ class Configurations // extends Configuration
return null;
}
}
public function userNameFormat($username, $fullname)
{
try {
if (!isset($this->UserConfig)) {
$this->UserConfig = $this->getConfiguration('ENVIRONMENT_SETTINGS', '');
}
if (isset($this->UserConfig['format'])) {
$name = explode(' ',$fullname);
$aux = '';
$aux = str_replace('@userName', $username, $this->UserConfig['format']);
$aux = str_replace('@firstName', isset($name[0])?$name[0]:'', $aux);
$aux = str_replace('@lastName', isset($name[1])?$name[1]:'', $aux);
return $aux;
} else {
return $username;
}
} catch (Exception $oError) {
return null;
}
}
/**
* getFormats