Code

Starting move
[gosa.git] / gosa-core / plugins / admin / departments / tabs_department.inc
1 <?php
3 class deptabs extends tabs
4 {
5   var $base= "";
7   function deptabs($config, $data, $dn,$category)
8   {
9     tabs::tabs($config, $data, $dn,$category);
10     $this->base= $this->by_object['department']->base;
12     /* Add references/acls/snapshots */
13     $this->addSpecialTabs();
14   }
16   function check($ignore_account= FALSE)
17   {
18     return (tabs::check(TRUE));
19   }
22   function save($ignore_account= FALSE)
23   {
24     $baseobject= $this->by_object['department'];
25     $ou= preg_replace('/,/', '\,', $baseobject->ou);
26     $new_dn= @LDAP::convert('ou='.$ou.','.$baseobject->base);
27     
28     if($ignore_account){
29       if ($this->dn != $new_dn && $this->dn != "new"){
30         /* if( new_dn is subtree of this->dn ) */
31         $cnt1 = count(split(",",$this->dn));
32         $cnt2 = count(split(",",$new_dn));
33         if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
34           print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
35         }else{
36           /* Prepare to be moved */
37           $baseobject->recursive_move($this->dn, $new_dn);                      
38           $this->by_object['department'] = $baseobject;
39           return;
40         }
41       }
42     }
43     $this->dn= $new_dn;
44     $baseobject->dn= $this->dn;
45     $this->by_object['department']= $baseobject;
46     return(tabs::save(TRUE));
47   }
50 }
51 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
52 ?>