mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 00:09:06 +01:00
Code cleaning
This commit is contained in:
parent
9224c54304
commit
0e8009420c
2 changed files with 32 additions and 23 deletions
|
@ -45,11 +45,17 @@ class LSattr_html_select_object extends LSattr_html{
|
|||
*
|
||||
* @return LSformElement|false L'element du formulaire ajouté, ou false
|
||||
*/
|
||||
public function addToForm (&$form,$idForm,$data=NULL) {
|
||||
public function addToForm (&$form, $idForm, $data=NULL) {
|
||||
$this -> config['attrObject'] = $this;
|
||||
$element=$form -> addElement($this -> LSformElement_type, $this -> name, $this -> getLabel(), $this -> config, $this);
|
||||
$element = $form -> addElement(
|
||||
$this -> LSformElement_type,
|
||||
$this -> name,
|
||||
$this -> getLabel(),
|
||||
$this -> config,
|
||||
$this
|
||||
);
|
||||
if(!$element) {
|
||||
LSerror :: addErrorCode('LSform_06',$this -> name);
|
||||
LSerror :: addErrorCode('LSform_06', $this -> name);
|
||||
return false;
|
||||
}
|
||||
if ($data) {
|
||||
|
@ -71,8 +77,8 @@ class LSattr_html_select_object extends LSattr_html{
|
|||
*
|
||||
* @return array La valeur formatée de l'attribut (array('DNs' => 'displayName'))
|
||||
**/
|
||||
public function refreshForm($data,$fromDNs=false) {
|
||||
return $this -> getFormValues($data,$fromDNs);
|
||||
public function refreshForm($data, $fromDNs=false) {
|
||||
return $this -> getFormValues($data, $fromDNs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1024,37 +1024,40 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
|||
*
|
||||
* @param Net_LDAP2_Filter|string|null $filter LDAP search filter
|
||||
* @param string|null $sbasedn Base DN of the search
|
||||
* @param array $sparams Search parameters (as expected by Net_LDAP2::search())
|
||||
* @param array|null $sparams Search parameters (as expected by Net_LDAP2::search())
|
||||
* @param string|false $displayFormat LSformat of objects's display name
|
||||
* @param bool $cache Enable/disable cache (default: true)
|
||||
*
|
||||
* @return array|false Tableau dn => name correspondant au resultat de la recherche, ou false
|
||||
*/
|
||||
public function listObjectsName($filter=NULL,$sbasedn=NULL,$sparams=array(),$displayFormat=false,$cache=true) {
|
||||
public function listObjectsName($filter=NULL, $sbasedn=NULL, $sparams=null, $displayFormat=false, $cache=true) {
|
||||
if (!LSsession :: loadLSclass('LSsearch')) {
|
||||
LSerror::addErrorCode('LSsession_05','LSsearch');
|
||||
LSerror::addErrorCode('LSsession_05', 'LSsearch');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$displayFormat) {
|
||||
$displayFormat = $this -> getDisplayNameFormat();
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'displayFormat' => $displayFormat,
|
||||
$params = [
|
||||
'displayFormat' => $displayFormat?$displayFormat:$this -> getDisplayNameFormat(),
|
||||
'basedn' => $sbasedn,
|
||||
'filter' => $filter
|
||||
];
|
||||
|
||||
$LSsearch = new LSsearch(
|
||||
$this -> type_name,
|
||||
'LSldapObject::listObjectsName',
|
||||
(
|
||||
is_array($sparams)?
|
||||
$params = array_merge($sparams, $params):
|
||||
$sparams
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if (is_array($sparams)) {
|
||||
$params=array_merge($sparams,$params);
|
||||
}
|
||||
|
||||
$LSsearch = new LSsearch($this -> type_name,'LSldapObject::listObjectsName',$params,true);
|
||||
|
||||
$LSsearch -> run($cache);
|
||||
|
||||
return $LSsearch -> listObjectsName();
|
||||
return (
|
||||
$LSsearch -> run($cache)?
|
||||
$LSsearch -> listObjectsName():
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue