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