mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +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]',
|
'object_type' => '[Type d'LSobject]',
|
||||||
'display_name_format' => '[LSformat du nom d'affichage des LSobjects]',
|
'display_name_format' => '[LSformat du nom d'affichage des LSobjects]',
|
||||||
'value_attribute' => '[Nom de l'attribut clé]',
|
'value_attribute' => '[Nom de l'attribut clé]',
|
||||||
|
'values_attribute' => '[Nom de l'attribut clé multi-valeur]',
|
||||||
'filter' => '[Filtre de recherche des LSobject]',
|
'filter' => '[Filtre de recherche des LSobject]',
|
||||||
'scope' => '[Scope de la recherche]',
|
'scope' => '[Scope de la recherche]',
|
||||||
'basedn' => '[Basedn de la recherche]'
|
'basedn' => '[Basedn de la recherche]'
|
||||||
|
@ -85,6 +86,16 @@
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</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>
|
<varlistentry>
|
||||||
<term>filter</term>
|
<term>filter</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|
|
@ -157,7 +157,7 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
protected function getLSobjectPossibleValues($conf) {
|
protected function getLSobjectPossibleValues($conf) {
|
||||||
$retInfos = array();
|
$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);
|
LSerror :: addErrorCode('LSattr_html_select_list_01',$this -> name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -172,23 +172,38 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
'displayFormat' => (isset($conf['display_name_format'])?$conf['display_name_format']:null),
|
'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'];
|
$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 = new LSsearch($conf['object_type'],'LSattr_html_select_list',$param,true);
|
||||||
$LSsearch -> run();
|
$LSsearch -> run();
|
||||||
if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')) {
|
if (isset($val['value_attribute'])) {
|
||||||
$retInfos = $LSsearch -> listObjectsName();
|
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();
|
$list = $LSsearch -> getSearchEntries();
|
||||||
foreach($list as $entry) {
|
foreach($list as $entry) {
|
||||||
$key = $entry -> get($conf['value_attribute']);
|
$keys = $entry -> get($conf['values_attribute']);
|
||||||
if(is_array($key)) {
|
if (!is_array($keys)) $keys=array($keys);
|
||||||
$key = $key[0];
|
foreach ($keys as $key) {
|
||||||
|
$retInfos[$key]=$key;
|
||||||
}
|
}
|
||||||
$retInfos[$key]=$entry -> displayName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue