'displayFormat' => NULL,
'nbObjectsByPage' => NB_LSOBJECT_LIST,
'nbPageLinkByPage' => 10,
+ 'customInfos' => array(),
'withoutCache' => false
);
if (is_string($params['displayFormat'])) {
$this -> params['displayFormat'] = $params['displayFormat'];
}
+
+ // Custom Infos
+ if (is_array($params['customInfos'])) {
+ foreach($params['customInfos'] as $name => $data) {
+ if(is_array($data['function']) && is_string($data['function'][0])) {
+ LSsession::loadLSclass($data['function'][0]);
+ }
+ if (is_callable($data['function'])) {
+ $this -> params['customInfos'][$name] = array (
+ 'function' => &$data['function'],
+ 'args' => $data['args']
+ );
+ }
+ else {
+ LSerror :: addErrorCode('LSsearch_14',$name);
+ }
+ }
+ }
$this -> saveParamsInSession();
return $OK;
LSerror :: defineError('LSsearch_13',
_("LSsearch : Error sorting the search.")
);
+LSerror :: defineError('LSsearch_14',
+_("LSsearch : The function of the custum information %{name} is not callable.")
+);
?>
$this -> cache['displayName'] = $this -> getFData($this -> params['displayFormat']);
return $this -> cache['displayName'];
}
+ elseif ($key=='LSobject'||$key=='type_name'||$key=='type') {
+ return $this -> LSobject;
+ }
elseif ($key=='dn') {
return $this -> dn;
}
elseif (in_array($key,array_keys($this -> attrs))) {
return $this -> attrs[$key];
}
+ elseif (array_key_exists($key,$this->params['customInfos'])) {
+ if(isset($this -> cache['customInfos'][$key])) {
+ return $this -> cache['customInfos'][$key];
+ }
+ if(is_array($this->params['customInfos'][$key]['function']) && is_string($this->params['customInfos'][$key]['function'][0])) {
+ LSsession::loadLSclass($this->params['customInfos'][$key]['function'][0]);
+ }
+ if(is_callable($this->params['customInfos'][$key]['function'])) {
+ $this -> cache['customInfos'][$key]=call_user_func($this->params['customInfos'][$key]['function'],$this,$this->params['customInfos'][$key]['args']);
+ return $this -> cache['customInfos'][$key];
+ }
+ }
else {
+ LSlog('LSsearchEntry : '.$this -> dn.' => Unknown property '.$key.' !');
return __("Unknown property !");
}
}