mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 09:59:06 +01:00
Code cleaning
This commit is contained in:
parent
ee69cc302c
commit
6cfde7f084
2 changed files with 32 additions and 23 deletions
|
@ -47,7 +47,13 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
*/
|
*/
|
||||||
public function addToForm (&$form, $idForm, $data=NULL) {
|
public function addToForm (&$form, $idForm, $data=NULL) {
|
||||||
$this -> config['attrObject'] = $this;
|
$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) {
|
if(!$element) {
|
||||||
LSerror :: addErrorCode('LSform_06', $this -> name);
|
LSerror :: addErrorCode('LSform_06', $this -> name);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1024,37 +1024,40 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
*
|
*
|
||||||
* @param Net_LDAP2_Filter|string|null $filter LDAP search filter
|
* @param Net_LDAP2_Filter|string|null $filter LDAP search filter
|
||||||
* @param string|null $sbasedn Base DN of the search
|
* @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 string|false $displayFormat LSformat of objects's display name
|
||||||
* @param bool $cache Enable/disable cache (default: true)
|
* @param bool $cache Enable/disable cache (default: true)
|
||||||
*
|
*
|
||||||
* @return array|false Tableau dn => name correspondant au resultat de la recherche, ou false
|
* @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')) {
|
if (!LSsession :: loadLSclass('LSsearch')) {
|
||||||
LSerror::addErrorCode('LSsession_05', 'LSsearch');
|
LSerror::addErrorCode('LSsession_05', 'LSsearch');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$displayFormat) {
|
$params = [
|
||||||
$displayFormat = $this -> getDisplayNameFormat();
|
'displayFormat' => $displayFormat?$displayFormat:$this -> getDisplayNameFormat(),
|
||||||
}
|
|
||||||
|
|
||||||
$params = array(
|
|
||||||
'displayFormat' => $displayFormat,
|
|
||||||
'basedn' => $sbasedn,
|
'basedn' => $sbasedn,
|
||||||
'filter' => $filter
|
'filter' => $filter
|
||||||
|
];
|
||||||
|
|
||||||
|
$LSsearch = new LSsearch(
|
||||||
|
$this -> type_name,
|
||||||
|
'LSldapObject::listObjectsName',
|
||||||
|
(
|
||||||
|
is_array($sparams)?
|
||||||
|
$params = array_merge($sparams, $params):
|
||||||
|
$sparams
|
||||||
|
),
|
||||||
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
if (is_array($sparams)) {
|
return (
|
||||||
$params=array_merge($sparams,$params);
|
$LSsearch -> run($cache)?
|
||||||
}
|
$LSsearch -> listObjectsName():
|
||||||
|
false
|
||||||
$LSsearch = new LSsearch($this -> type_name,'LSldapObject::listObjectsName',$params,true);
|
);
|
||||||
|
|
||||||
$LSsearch -> run($cache);
|
|
||||||
|
|
||||||
return $LSsearch -> listObjectsName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue