Code

8160246ba40f0fe511bbc8550e2bd4d959a5c577
[gosa.git] / gosa-plugins / goto / admin / systems / goto / tabs_printers.inc
1 <?php
3 class printtabs extends tabs
4 {
6   function printtabs($config, $data, $dn,$category,$hide_refs = FALSE, $hide_acls = FALSE)
7   {
9     /* Save dn */
10     $this->dn= $dn;
11     $this->config= $config;
13     $this->hide_acls = $hide_acls;
14     $this->hide_refs = $hide_refs;
16     $this->acl_category = $category;
18     $baseobject= NULL;
20     foreach ($data as $tab){
21       if(!class_available($tab['CLASS'])) continue;
23       $this->by_name[$tab['CLASS']]= $tab['NAME'];
25       if ($baseobject === NULL){
26         $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
27         $this->by_object[$tab['CLASS']]= $baseobject;
28       } else {
29         $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
30       }
32       $this->by_object[$tab['CLASS']]->parent= &$this;
33       $this->by_object[$tab['CLASS']]->set_acl_category($category);
34       $this->read_only |= $this->by_object[$tab['CLASS']]->read_only;      
36       /* Initialize current */
37       if ($this->current == ""){
38         $this->current= $tab['CLASS'];
39       }
40     }
42     /* Add references/acls/snapshots */
43     $this->addSpecialTabs();
44   }
47   /*! \brief Reinitializes the tab classes with fresh ldap values.
48     This maybe usefull if for example the apply button was pressed.
49    */
50   function re_init()
51   {
52     $baseobject= NULL;
53     foreach($this->by_object as $name => $object){
54       $class = get_class($object);
55       if(in_array($class,array("reference","acl"))) continue;
56       if ($baseobject === NULL){
57         $baseobject= new $class($this->config, $this->dn,NULL,$this);
58         $baseobject->enable_CSN_check();
59         $this->by_object[$name]= $baseobject;
60       } else {
61         $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
62       }
63       $this->by_object[$name]->parent= &$this;
64       $this->by_object[$name]->set_acl_category($this->acl_category);
65     }
66   }
69   function save_object($save_current= FALSE)
70   {
71     tabs::save_object($save_current);
73     /* Assign current cn */
74     $baseobject= $this->by_object['printgeneric'];
75     $baseobject->netConfigDNS->cn= $baseobject->cn;
76   }
79   function save($ignore_account= FALSE)
80   {
81     /* Check for new 'dn', in order to propagate the
82        'dn' to all plugins */
83     $baseobject= $this->by_object['printgeneric'];
84     $cn      = preg_replace('/,/', '\,', $baseobject->cn);
85     $cn      = preg_replace('/"/', '\"', $cn);
86     $this->dn= "cn={$cn},".get_ou("printgeneric", "printerRDN").$baseobject->base;
87     $baseobject->dn= $this->dn;
89     foreach ($this->by_object as $key => $obj){
90       $this->by_object[$key]->dn= $this->dn;
91     }
93     tabs::save(FALSE);
94   }
96 }
98 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
99 ?>