1 <?php
3 class printtabs extends tabs
4 {
6 function printtabs($config, $data, $dn,$category)
7 {
9 /* Save dn */
10 $this->dn= $dn;
11 $this->config= $config;
13 $baseobject= NULL;
15 foreach ($data as $tab){
16 if(!class_available($tab['CLASS'])) continue;
18 $this->by_name[$tab['CLASS']]= $tab['NAME'];
20 if ($baseobject === NULL){
21 $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
22 $this->by_object[$tab['CLASS']]= $baseobject;
23 } else {
24 $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
25 }
27 $this->by_object[$tab['CLASS']]->parent= &$this;
28 $this->by_object[$tab['CLASS']]->set_acl_category($category);
30 /* Initialize current */
31 if ($this->current == ""){
32 $this->current= $tab['CLASS'];
33 }
34 }
36 /* Add references/acls/snapshots */
37 $this->addSpecialTabs();
38 }
41 /*! \brief Reinitializes the tab classes with fresh ldap values.
42 This maybe usefull if for example the apply button was pressed.
43 */
44 function re_init()
45 {
46 $baseobject= NULL;
47 foreach($this->by_object as $name => $object){
48 $class = get_class($object);
49 if(in_array($class,array("reference","acl"))) continue;
50 if ($baseobject === NULL){
51 $baseobject= new $class($this->config, $this->dn,NULL,$this);
52 $baseobject->enable_CSN_check();
53 $this->by_object[$name]= $baseobject;
54 } else {
55 $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
56 }
57 $this->by_object[$name]->parent= &$this;
58 $this->by_object[$name]->set_acl_category($this->acl_category);
59 }
60 }
63 function save_object($save_current= FALSE)
64 {
65 tabs::save_object($save_current);
67 /* Assign current cn */
68 $baseobject= $this->by_object['printgeneric'];
69 $baseobject->netConfigDNS->cn= $baseobject->cn;
70 }
73 function save($ignore_account= FALSE)
74 {
75 /* Check for new 'dn', in order to propagate the
76 'dn' to all plugins */
77 $baseobject= $this->by_object['printgeneric'];
78 $this->dn= "cn=$baseobject->cn,".get_ou('printerRDN').$baseobject->base;
79 $baseobject->dn= $this->dn;
81 foreach ($this->by_object as $key => $obj){
82 $this->by_object[$key]->dn= $this->dn;
83 }
85 tabs::save(FALSE);
86 }
88 }
90 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
91 ?>