From: cajus Date: Fri, 7 Aug 2009 16:29:40 +0000 (+0000) Subject: Updated filter classes X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8983afb5e2e76353daf1e019f62ad5421309bb37;p=gosa.git Updated filter classes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14012 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_filter.inc b/gosa-core/include/class_filter.inc index 607b95a69..ffb878955 100755 --- a/gosa-core/include/class_filter.inc +++ b/gosa-core/include/class_filter.inc @@ -6,6 +6,7 @@ class filter { var $elements= array(); var $elementValues= array(); var $alphabetElements= array(); + var $autocompleter= array(); var $category= ""; var $objectStorage= array(); var $objectBase= ""; @@ -109,6 +110,8 @@ class filter { ""; + + $this->autocompleters[$tag]= $element['autocomplete']; } return $result; } @@ -397,6 +400,52 @@ class filter { } } + + function processAutocomplete() + { + global $class_mapping; + $result= array(); + + foreach ($this->autocompleters as $tag => $config) { + if(isset($_POST[$tag])){ + + // Is backend available? + $backend= "filter".$config['backend']; + if (!isset($class_mapping["$backend"])) { + die("Invalid backend specified in search config."); + } + + // Load filter and attributes + $filter= $config['filter']; + $attributes= $config['attribute']; + if (!is_array($attributes)) { + $attributes= array($attributes); + } + + // Make filter + $filter= preg_replace("/\\$$tag/", normalizeLDAP($_POST[$tag]), $filter); + $result= call_user_func(array($backend, 'query'), $this->base, $this->scope, $filter, $attributes, + $this->category, $this->objectStorage, $this->objectBase); + + echo ''; + } + + } + } + } ?> diff --git a/gosa-core/include/class_filterLDAP.inc b/gosa-core/include/class_filterLDAP.inc index fae29782d..222225b2b 100755 --- a/gosa-core/include/class_filterLDAP.inc +++ b/gosa-core/include/class_filterLDAP.inc @@ -4,7 +4,7 @@ class filterLDAP { static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "", $objectBase= "") { - global $config; + $config= session::global_get('config'); $ldap= $config->get_ldap_link(TRUE); $result= filterLDAP::get_list($base, $scope, $filter, $attributes, $category, $objectStorage, $objectBase, @@ -16,7 +16,8 @@ class filterLDAP { static function get_list($base, $scope, $filter, $attributes, $category, $objectStorage= array(), $objectBase= "", $flags= GL_SUBSEARCH) { - global $config, $ui; + $config= session::global_get('config'); + $ui= session::global_get('ui'); $departments= array(); /* Get LDAP link */ @@ -166,7 +167,8 @@ class filterLDAP { function get_list_old($filter, $category, $base= "", $attributes= array(), $flags= GL_SUBSEARCH) { - global $config, $ui; + $config= session::global_get('config'); + $ui= session::global_get('ui'); /* Get LDAP link */ $ldap= $config->get_ldap_link($flags & GL_SIZELIMIT); @@ -221,7 +223,6 @@ class filterLDAP { } } } - return ($result); }