Compare commits

...

2 commits

2 changed files with 21 additions and 22 deletions

View file

@ -256,15 +256,9 @@ class LSattribute extends LSlog_staticLoggerClass {
return false; return false;
} }
if ($data !== false) { $data = $this -> ldap -> getDisplayValue(
$data = $this -> ldap -> getDisplayValue($data); $data !== false ? $data : $this -> getValue()
} );
elseif ($this -> isUpdate()) {
$data = $this -> ldap -> getDisplayValue($this -> updateData);
}
else {
$data = $this -> ldap -> getDisplayValue($this -> data);
}
$onDisplay = $this -> getConfig('onDisplay'); $onDisplay = $this -> getConfig('onDisplay');
if ($onDisplay) { if ($onDisplay) {

View file

@ -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> * @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) { public function getDisplayValue($val, $first=false, $default=' ') {
if(isset($this -> attrs[$val])){ $return = $default;
if (method_exists($this -> attrs[$val],'getDisplayValue')) if(isset($this -> attrs[$val]) && method_exists($this -> attrs[$val], 'getDisplayValue'))
return $this -> attrs[$val] -> getDisplayValue(); $return = ensureIsArray($this -> attrs[$val] -> getDisplayValue());
else if (is_array($return) && $first)
return ' '; $return = (count($return) >= 1?$return[0]:null);
} return $return;
else {
return $this -> getValue($val);
}
} }
/** /**