support htmlTable merging

This commit is contained in:
Roland Gruber 2010-09-25 14:28:37 +00:00
parent ab1194e7fe
commit 4b386e0d7d
2 changed files with 20 additions and 2 deletions

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2009 Roland Gruber
Copyright (C) 2003 - 2010 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -652,6 +652,9 @@ abstract class baseModule {
if (is_array($this->meta['config_options'][$scopes[$i]])) {
$return = array_merge($return, $this->meta['config_options'][$scopes[$i]]);
}
elseif (isset($return[0]) && ($return[0] instanceof htmlTable) && ($this->meta['config_options'][$scopes[$i]] instanceof htmlTable)) {
$return[0]->mergeTableElements($this->meta['config_options'][$scopes[$i]]);
}
else {
$return[] = $this->meta['config_options'][$scopes[$i]];
}
@ -661,6 +664,9 @@ abstract class baseModule {
if (is_array($this->meta['config_options']['all'])) {
$return = array_merge($return, $this->meta['config_options']['all']);
}
elseif (isset($return[0]) && ($return[0] instanceof htmlTable) && ($this->meta['config_options']['all'] instanceof htmlTable)) {
$return[0]->mergeTableElements($this->meta['config_options']['all']);
}
else {
$return[] = $this->meta['config_options']['all'];
}

View File

@ -197,7 +197,7 @@ class htmlTable extends htmlElement {
* @param string $scope Account type
* @return array List of input field names and their type (name => type)
*/
function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) {
public function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) {
$return = array();
echo htmlTable::header;
// print all contained elements
@ -220,6 +220,18 @@ class htmlTable extends htmlElement {
echo htmlTable::footer;
return $return;
}
/**
* Merges the content of another htmlTable object into this table.
*
* @param $table table to get elements
*/
public function mergeTableElements($table) {
if (is_null($table) || !($table instanceof htmlTable)) {
return;
}
$this->elements = array_merge($this->elements, $table->elements);
}
}