new){ /* Load attributes */ $this->dhcpPrimaryDN= $attrs['dhcpPrimaryDN'][0]; } else { /* We keep the parent dn here if it's new */ $this->statements['default-lease-time']= 600; $this->statements['max-lease-time']= 1700; $this->statements['authoritative']= TRUE; $this->statements['ddns-update-style']= 'none'; } $this->advanced->setAutoStatements(array("default-lease-time", "max-lease-time", "authoritative", "server-identifier", "ddns-update-style")); $this->advanced->setAutoOptions(array("server-name")); /* Save for later action */ $this->orig_dhcpPrimaryDN= $this->dhcpPrimaryDN; } function execute() { /* Show main page */ $smarty= get_smarty(); $smarty->assign('ddns_styles', $this->ddns_styles); foreach (array('max_lease_time', 'default_lease_time', 'ddns_update_style') as $value){ if (isset($this->statements[preg_replace('/_/', '-', $value)])){ $smarty->assign("$value", $this->statements[preg_replace('/_/', '-', $value)]); } else { $smarty->assign("$value", ""); } } if (isset($this->statements['authoritative'])){ $smarty->assign("authoritative", "checked"); } else { $smarty->assign("authoritative", ""); } /* Show main page */ $display= $smarty->fetch(get_template_path('dhcp_service.tpl', TRUE)).$this->network->execute(); /* Merge arrays for advanced view */ foreach (array("options", "statements") as $type){ $this->advanced->$type= $this->$type + $this->network->$type;; } $display.= $this->advanced->execute(); /* Merge back for removals */ foreach (array("options", "statements") as $type){ $this->$type= $this->advanced->$type; $this->network->$type= $this->advanced->$type; } /* Add footer */ $display.= "