From: hickert Date: Thu, 30 Oct 2008 08:26:21 +0000 (+0000) Subject: Imroved speed of department listings, X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5be8f019b360e8c91f3614573c7a24767813654d;p=gosa.git Imroved speed of department listings, git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12819 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_MultiSelectWindow.inc b/gosa-core/include/class_MultiSelectWindow.inc index 54df235d0..0e40eab1e 100644 --- a/gosa-core/include/class_MultiSelectWindow.inc +++ b/gosa-core/include/class_MultiSelectWindow.inc @@ -659,7 +659,7 @@ class MultiSelectWindow{ $types = departmentManagement::get_support_departments(); $ui = get_userinfo(); $module_deps = $ui->get_module_departments($this->module); - + $found_deps = array(); /* check for a valid base */ if(!$base){ @@ -693,29 +693,17 @@ class MultiSelectWindow{ } } } - uksort($departments, 'strnatcasecmp'); /* Detect allowed departments */ $deps = array_intersect($found_deps,$module_deps); + uksort($deps, 'strnatcasecmp'); $key = 0; foreach($deps as $name => $dn){ $key ++; $val = $departments[$name]; $this->departments[$key] = $val; - - /* Check if this department contains sub-departments - Display different image in this case - */ - $img = $val['TYPE']['IMG']; -# foreach($this->config->departments as $keyd){ -# if(preg_match("/,".normalizePreg($val['dn'])."$/",$keyd)){ -# $img = $val['TYPE']['IMG_FULL']; -# } -# } - - - $img = ""; + $img = ""; /* Add spacer cols to divlist */ @@ -757,45 +745,34 @@ class MultiSelectWindow{ function create_department_list($modules) { - /* Load possible departments */ + $departments = array(); $ui= get_userinfo(); $first = ""; $found = FALSE; + $options =""; - if(!is_array($modules)){ - $modules = array($modules); - } - - $department = $departments = array(); $ids = $this->config->idepartments; - foreach($modules as $module){ - $d = $ui->get_module_departments($module); - - foreach($ids as $department => $desc){ - if(in_array($department,$d)){ - $departments[$department] = $department; - } - } + $d = $ui->get_module_departments($modules); + $k_ids = array_keys($ids); + $deps = array_intersect($d,$k_ids); + foreach($k_ids as $department){ + $departments[$department] = $ids[$department]; } - $first = ""; - $found = FALSE; - $options =""; - foreach($departments as $dep => $name){ + foreach($departments as $value => $name){ /* Keep first base dn in mind, we could need this * info if no valid base was found */ if(empty($first)) { - $first = $dep['dn']; + $first = $value; } - $value = $ids[$dep]; - if ($this->selectedBase == $dep){ + if ($this->selectedBase == $value){ $found = TRUE; - $options.= ""; + $options.= ""; } else { - $options.= ""; + $options.= ""; } }