'alternativeLSformats' => array (
'[LSformat 1]',
'[LSformat 2]'
- )
+ ),
+ 'formaterLSformat' => '[LSformat]',
)
),
'customActions' => array (
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>formaterLSformat</term>
+ <listitem>
+ <simpara>&LSformat; optionnel permettant de mettre en forme le résultat obtenu des
+ &LSformats; précédents. Ce &LSformat; ne sera utilisé que si le résultat obtenu
+ précédement n'est pas vide. Il est ainsi possible d'utiliser les paramètres <literal>
+ LSformat</literal> et <literal>alternativeLSformats</literal> afin de récupérer la
+ valeur à afficher, puis de la mettre en forme grâce à ce &LSformat;. Ce format est
+ composé à partir des attributs des objets LDAP dans leur format brut et de la valeur
+ retournés précedement accessible via la variable <literal>val</literal>.</simpara>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</listitem>
</varlistentry>
else {
$attrs=array_merge($attrs,getFieldInFormat($conf['alternativeLSformats']));
}
+ if(isset($conf['formaterLSformat'])) {
+ $attrs=array_unique(array_merge($attrs,getFieldInFormat($conf['formaterLSformat'])));
+ if(($key = array_search('val', $attrs)) !== false) {
+ unset($attrs[$key]);
+ }
+ }
if(is_array($retval['attributes'])) {
$retval['attributes']=array_merge($attrs,$retval['attributes']);
}
// Cache
private $cache=array();
+
+ // Other values
+ private $other_values=array();
/**
* Constructor
if (in_array($key,array_keys($this -> attrs))) {
return $this -> attrs[$key];
}
+ elseif (array_key_exists($key,$this->other_values)) {
+ return $this->other_values[$key];
+ }
elseif ($key=='subDn' || $key=='subDnName') {
return $this -> subDn;
}
}
/**
+ * Add value in array $this -> other_values
+ *
+ * @param[in] $name string The value name
+ * @param[in] $value mixed The value
+ *
+ * @retval void
+ **/
+ function registerOtherValue($name,$value) {
+ $this -> other_values[$name]=$value;
+ }
+
+ /**
* Get formated text value of entry
*
* @param[in] $format string The format of the value
if (!empty($ret)) break;
}
}
+ if (!empty($ret) && isset($this->LSsearch->extraDisplayedColumns[$key]['formaterLSformat'])) {
+ $this -> registerOtherValue('val',$ret);
+ $ret=$this -> getFData($this->LSsearch->extraDisplayedColumns[$key]['formaterLSformat']);
+ }
$this -> cache[$key] = $ret;
return $ret;
}