mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-24 19:09:06 +01:00
Improve LSldapObject::getDisplayValue() method to match with getValue() method's parameters
This commit is contained in:
parent
95f60a534a
commit
11a8448b0a
1 changed files with 18 additions and 13 deletions
|
@ -1079,24 +1079,29 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retourne une valeur d'affichage de l'objet
|
||||
* Return an objet displayed value
|
||||
*
|
||||
* The value returned depends of the $val parameter. If the requested value is unknown, the returned value
|
||||
* will be $default (default: a space caracter = ' ').
|
||||
*
|
||||
* Supported values:
|
||||
* - [attribute name] : the displayed value of the corresponding attribute
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*
|
||||
* @param string $val Le nom de la valeur demandee
|
||||
* @param string $val The requested value
|
||||
* @param boolean $first If true and the result is an array, return only the first value (optional, default: false)
|
||||
* @param string $default Default value if unknown (optional, default: a space caracter = ' ')
|
||||
*
|
||||
* @return string la valeur demandee ou ' ' si celle-ci est inconnue.
|
||||
* @return mixed The requested value or $default if unknown
|
||||
*/
|
||||
public function getDisplayValue($val) {
|
||||
if(isset($this -> attrs[$val])){
|
||||
if (method_exists($this -> attrs[$val],'getDisplayValue'))
|
||||
return $this -> attrs[$val] -> getDisplayValue();
|
||||
else
|
||||
return ' ';
|
||||
}
|
||||
else {
|
||||
return $this -> getValue($val);
|
||||
}
|
||||
public function getDisplayValue($val, $first=false, $default=' ') {
|
||||
$return = $default;
|
||||
if(isset($this -> attrs[$val]) && method_exists($this -> attrs[$val], 'getDisplayValue'))
|
||||
$return = ensureIsArray($this -> attrs[$val] -> getDisplayValue());
|
||||
if (is_array($return) && $first)
|
||||
$return = (count($return) >= 1?$return[0]:null);
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue