Code

Bugfix for #4263
[gosa.git] / trunk / gosa-plugins / goto / admin / systems / goto / tabs_printers.inc
1 <?php
3 class printtabs extends tabs
4 {
6   function printtabs($config, $data, $dn,$category)
7   {
8     /* Save dn */
9     $this->dn= $dn;
10     $this->config= $config;
12     $baseobject= NULL;
14     /* Set acl_category */
15     $this->acl_category = $category;
17     foreach ($data as $tab){
18       if(!class_available($tab['CLASS'])) continue;
20       $this->by_name[$tab['CLASS']]= $tab['NAME'];
22       if ($baseobject === NULL){
23         $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
24         $this->by_object[$tab['CLASS']]= $baseobject;
25       } else {
26         $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
27       }
29       $this->by_object[$tab['CLASS']]->parent= &$this;
30       $this->by_object[$tab['CLASS']]->set_acl_category($category);
31       $this->read_only |= $this->by_object[$tab['CLASS']]->read_only;      
33       /* Initialize current */
34       if ($this->current == ""){
35         $this->current= $tab['CLASS'];
36       }
37     }
39     /* Add references/acls/snapshots */
40     $this->addSpecialTabs();
41   }
44   /*! \brief Reinitializes the tab classes with fresh ldap values.
45     This maybe usefull if for example the apply button was pressed.
46    */
47   function re_init()
48   {
49     $baseobject= NULL;
50     foreach($this->by_object as $name => $object){
51       $class = get_class($object);
52       if(in_array($class,array("reference","acl"))) continue;
53       if ($baseobject === NULL){
54         $baseobject= new $class($this->config, $this->dn,NULL,$this);
55         $baseobject->enable_CSN_check();
56         $this->by_object[$name]= $baseobject;
57       } else {
58         $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
59       }
60       $this->by_object[$name]->parent= &$this;
61       $this->by_object[$name]->set_acl_category($this->acl_category);
62     }
63   }
66   function save_object($save_current= FALSE)
67   {
68     tabs::save_object($save_current);
70     /* Assign current cn */
71     $baseobject= $this->by_object['printgeneric'];
72     $baseobject->netConfigDNS->cn= $baseobject->cn;
73   }
76   function save($ignore_account= FALSE)
77   {
78     /* Check for new 'dn', in order to propagate the
79        'dn' to all plugins */
80     $baseobject= $this->by_object['printgeneric'];
81     $this->dn= "cn=$baseobject->cn,".get_ou('printerRDN').$baseobject->base;
82     $baseobject->dn= $this->dn;
84     foreach ($this->by_object as $key => $obj){
85       $this->by_object[$key]->dn= $this->dn;
86     }
88     tabs::save(FALSE);
89   }
91 }
93 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
94 ?>