mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-23 00:43:48 +01:00
LSattr_html :: select_list : add values_attribute parameter
This commit is contained in:
parent
dda02c0ff4
commit
bf6ebf171d
2 changed files with 35 additions and 9 deletions
|
@ -16,6 +16,7 @@
|
|||
'object_type' => '[Type d'LSobject]',
|
||||
'display_name_format' => '[LSformat du nom d'affichage des LSobjects]',
|
||||
'value_attribute' => '[Nom de l'attribut clé]',
|
||||
'values_attribute' => '[Nom de l'attribut clé multi-valeur]',
|
||||
'filter' => '[Filtre de recherche des LSobject]',
|
||||
'scope' => '[Scope de la recherche]',
|
||||
'basedn' => '[Basedn de la recherche]'
|
||||
|
@ -85,6 +86,16 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>values_attribute</term>
|
||||
<listitem>
|
||||
<simpara>Nom de l'attribut des &LSobjects; en référence servant de catalogue de
|
||||
valeurs. Dans ce mode, la valeur n'a pas de label et est affichée directement
|
||||
dans l'interface. Ce paramètre peut-être utilisé en complément ou non du paramètre
|
||||
<emphasis>value_attribute</emphasis>.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>filter</term>
|
||||
<listitem>
|
||||
|
|
|
@ -157,7 +157,7 @@ class LSattr_html_select_list extends LSattr_html{
|
|||
protected function getLSobjectPossibleValues($conf) {
|
||||
$retInfos = array();
|
||||
|
||||
if ((!isset($conf['object_type'])) || (!isset($conf['value_attribute']))) {
|
||||
if ((!isset($conf['object_type'])) || ((!isset($conf['value_attribute'])) && (!isset($conf['values_attribute'])))) {
|
||||
LSerror :: addErrorCode('LSattr_html_select_list_01',$this -> name);
|
||||
break;
|
||||
}
|
||||
|
@ -172,23 +172,38 @@ class LSattr_html_select_list extends LSattr_html{
|
|||
'displayFormat' => (isset($conf['display_name_format'])?$conf['display_name_format']:null),
|
||||
);
|
||||
|
||||
if ($conf['value_attribute']!='dn') {
|
||||
if (isset($conf['value_attribute']) && $conf['value_attribute']!='dn') {
|
||||
$param['attributes'][] = $conf['value_attribute'];
|
||||
}
|
||||
if (isset($conf['values_attribute'])) {
|
||||
$param['attributes'][] = $conf['values_attribute'];
|
||||
}
|
||||
|
||||
$LSsearch = new LSsearch($conf['object_type'],'LSattr_html_select_list',$param,true);
|
||||
$LSsearch -> run();
|
||||
if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')) {
|
||||
$retInfos = $LSsearch -> listObjectsName();
|
||||
if (isset($val['value_attribute'])) {
|
||||
if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')) {
|
||||
$retInfos = $LSsearch -> listObjectsName();
|
||||
}
|
||||
else {
|
||||
$list = $LSsearch -> getSearchEntries();
|
||||
foreach($list as $entry) {
|
||||
$key = $entry -> get($conf['value_attribute']);
|
||||
if(is_array($key)) {
|
||||
$key = $key[0];
|
||||
}
|
||||
$retInfos[$key]=$entry -> displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isset($conf['values_attribute'])) {
|
||||
$list = $LSsearch -> getSearchEntries();
|
||||
foreach($list as $entry) {
|
||||
$key = $entry -> get($conf['value_attribute']);
|
||||
if(is_array($key)) {
|
||||
$key = $key[0];
|
||||
$keys = $entry -> get($conf['values_attribute']);
|
||||
if (!is_array($keys)) $keys=array($keys);
|
||||
foreach ($keys as $key) {
|
||||
$retInfos[$key]=$key;
|
||||
}
|
||||
$retInfos[$key]=$entry -> displayName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue