1 <?php
3 class deptabs extends tabs
4 {
5 var $base= "";
7 function deptabs($config, $data, $dn)
8 {
9 tabs::tabs($config, $data, $dn);
10 $this->base= $this->by_object['department']->base;
11 }
13 function check()
14 {
15 return (tabs::check(TRUE));
16 }
19 function save($justsave = false)
20 {
21 $baseobject= $this->by_object['department'];
22 $ou= preg_replace('/,/', '\,', $baseobject->ou);
23 $new_dn= @LDAP::convert('ou='.$ou.','.$baseobject->base);
25 if($justsave){
26 if ($this->dn != $new_dn && $this->dn != "new"){
27 /* if( new_dn is subtree of this->dn ) */
28 $cnt1 = count(split(",",$this->dn));
29 $cnt2 = count(split(",",$new_dn));
30 if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
31 print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
32 }else{
33 /* Prepare to be moved */
34 $baseobject->recursive_move($this->dn, $new_dn);
35 $this->by_object['department'] = $baseobject;
36 return;
37 }
38 }
39 }
40 $this->dn= $new_dn;
41 $baseobject->dn= $this->dn;
42 $this->by_object['department']= $baseobject;
43 return(tabs::save(TRUE));
44 }
46 }
47 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
48 ?>