Code

Updated environment printer selection dialog
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 25 Jun 2007 06:11:27 +0000 (06:11 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 25 Jun 2007 06:11:27 +0000 (06:11 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6669 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_selectPrinterDialog.inc

index 693e3425b37837cbc4412319d9916b0be8b57435..3e29356213fe48645eb94f6400a0ef26e34893f4 100644 (file)
@@ -26,34 +26,34 @@ class selectPrinterDialog extends plugin
 
     /* Get all departments within this subtree */
     $base = $this->config->current['BASE'];
-    $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
 
-    $tmp =array();
-    foreach($deps as $dep){
-      $tmp[$dep['dn']] = $dep;
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
     }
-    $deps = $tmp;
 
-    /* Load possible departments */
-    $this->ui= get_userinfo();
-    $department = array();
-    foreach($this->module as $module){
 
-      $d = $this->ui->get_module_departments($module);
-      foreach($d as $department){
-        $departments[$department] = $department;
-      }
-    }
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $this->ui = $ui;
+    $tdeps= $ui->get_module_departments("users");
     $ids = $this->config->idepartments;
-    $this->deplist = array();
-    foreach($deps as $dep){
-      if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $departments)){
-        $this->deplist[$dep['dn']] =  $ids[$dep['dn']];
+    $first = "";
+    $found = FALSE;
+    $res = array();
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+        $res[$dep] = $ids[$dep]; //$tdeps[$dep];
       }
     }
-
-    $this->depselect = key($this->deplist);
+    $this->deplist = $res;
+    $this->depselect = key($res);
   }
 
   function execute()