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);
24 if($justsave){
25 if ($this->dn != $new_dn && $this->dn != "new"){
26 /* if( new_dn is subtree of this->dn ) */
27 $cnt1 = count(split(",",$this->dn));
28 $cnt2 = count(split(",",$new_dn));
29 if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
30 print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
31 }else{
32 /* Prepare to be moved */
33 $baseobject->recursive_move($this->dn, $new_dn);
34 $this->by_object['department'] = $baseobject;
35 return;
36 }
37 }
38 }else{
39 $this->dn= $new_dn;
40 return(tabs::save(TRUE));
41 }
42 }
44 }
45 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
46 ?>