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