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;
17 $baseobject= NULL;
19 foreach ($data as $tab){
20 if(!class_available($tab['CLASS'])) continue;
22 $this->by_name[$tab['CLASS']]= $tab['NAME'];
24 if ($baseobject === NULL){
25 $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
26 $this->by_object[$tab['CLASS']]= $baseobject;
27 } else {
28 $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
29 }
31 $this->by_object[$tab['CLASS']]->parent= &$this;
32 $this->by_object[$tab['CLASS']]->set_acl_category($category);
33 $this->read_only |= $this->by_object[$tab['CLASS']]->read_only;
35 /* Initialize current */
36 if ($this->current == ""){
37 $this->current= $tab['CLASS'];
38 }
39 }
41 /* Add references/acls/snapshots */
42 $this->addSpecialTabs();
43 }
46 /*! \brief Reinitializes the tab classes with fresh ldap values.
47 This maybe usefull if for example the apply button was pressed.
48 */
49 function re_init()
50 {
51 $baseobject= NULL;
52 foreach($this->by_object as $name => $object){
53 $class = get_class($object);
54 if(in_array($class,array("reference","acl"))) continue;
55 if ($baseobject === NULL){
56 $baseobject= new $class($this->config, $this->dn,NULL,$this);
57 $baseobject->enable_CSN_check();
58 $this->by_object[$name]= $baseobject;
59 } else {
60 $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
61 }
62 $this->by_object[$name]->parent= &$this;
63 $this->by_object[$name]->set_acl_category($this->acl_category);
64 }
65 }
68 function save_object($save_current= FALSE)
69 {
70 tabs::save_object($save_current);
72 /* Assign current cn */
73 $baseobject= $this->by_object['printgeneric'];
74 $baseobject->netConfigDNS->cn= $baseobject->cn;
75 }
78 function save($ignore_account= FALSE)
79 {
80 /* Check for new 'dn', in order to propagate the
81 'dn' to all plugins */
82 $baseobject= $this->by_object['printgeneric'];
83 $this->dn= "cn=$baseobject->cn,".get_ou('printerRDN').$baseobject->base;
84 $baseobject->dn= $this->dn;
86 foreach ($this->by_object as $key => $obj){
87 $this->by_object[$key]->dn= $this->dn;
88 }
90 tabs::save(FALSE);
91 }
93 }
95 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
96 ?>