summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ef92758)
raw | patch | inline | side by side (parent: ef92758)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Aug 2009 16:29:40 +0000 (16:29 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Aug 2009 16:29:40 +0000 (16:29 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14012 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_filter.inc | patch | blob | history | |
gosa-core/include/class_filterLDAP.inc | patch | blob | history |
index 607b95a69489d0154c8a1da08a22ba9e06b85d32..ffb8789553a8db5238af8e7923345e4e586870f8 100755 (executable)
var $elements= array();
var $elementValues= array();
var $alphabetElements= array();
+ var $autocompleter= array();
var $category= "";
var $objectStorage= array();
var $objectBase= "";
"<script type='text/javascript'>".
"new Ajax.Autocompleter('$tag', 'autocomplete$tag', 'autocomplete.php', { minChars: $characters, frequency: $frequency });".
"</script>";
+
+ $this->autocompleters[$tag]= $element['autocomplete'];
}
return $result;
}
}
}
+
+ 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 '<ul>';
+ foreach ($result as $entry) {
+ foreach ($attributes as $attribute) {
+ if (is_array($entry[$attribute])) {
+ for ($i= 0; $i<$entry[$attribute]['count']; $i++) {
+ echo '<li>'.$entry[$attribute][$i].'</li>';
+ }
+ } else {
+ echo '<li>'.$entry[$entry][$attribute].'</li>';
+ }
+ }
+ }
+
+ echo '</ul>';
+ }
+
+ }
+ }
+
}
?>
index fae29782dbee488832bebacab900081c2b196a26..222225b2b1950788f0e9a3b05cb148ce47bad74b 100755 (executable)
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,
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 */
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);
}
}
}
-
return ($result);
}