Code

Filtered department list. Hide all subtrees in base selection, which are subtrees...
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 1 Sep 2005 06:25:11 +0000 (06:25 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 1 Sep 2005 06:25:11 +0000 (06:25 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1278 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/departments/class_departmentGeneric.inc

index d7f709f807c0bba378e15205cedf535a838916bd..3b50131dba4363bf2a9b8c43be0c183689176952 100644 (file)
@@ -70,15 +70,22 @@ class department extends plugin
        $this->config->make_idepartments();
        $smarty= get_smarty();
 
-
-       /* Show main page */
-       $smarty->assign("bases", $this->config->idepartments);
+       /* Hide all departments, that are subtrees of this department */
+       $bases  = $this->config->idepartments;
+       $tmp    = array();      
+       foreach($bases as $dn=>$base){
+               
+               /* Only attach departments which are not a subtree of this one */
+               if(!preg_match("/".$this->dn."/",$dn)){
+                       $tmp[$dn]=$base;
+               }
+       }
+       $smarty->assign("bases", $tmp);
 
        foreach ($this->attributes as $val){
                $smarty->assign("$val", $this->$val);
                $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
        }
-       $smarty->assign("bases", $this->config->idepartments);
        $smarty->assign("base_select", $this->base);
        return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
   }