refactoring
This commit is contained in:
parent
6f6feade86
commit
5f714c4ab5
|
@ -12,7 +12,7 @@ use \htmlHiddenInput;
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2003 - 2017 Roland Gruber
|
Copyright (C) 2003 - 2018 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -145,8 +145,8 @@ include '../main_header.php';
|
||||||
// print error messages if any
|
// print error messages if any
|
||||||
if (sizeof($errors) > 0) {
|
if (sizeof($errors) > 0) {
|
||||||
echo "<br>\n";
|
echo "<br>\n";
|
||||||
for ($i = 0; $i < sizeof($errors); $i++) {
|
foreach ($errors as $error) {
|
||||||
call_user_func_array('StatusMessage', $errors[$i]);
|
call_user_func_array('StatusMessage', $error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,13 +159,12 @@ $options = getProfileOptions($type->getId());
|
||||||
// load old profile or POST values if needed
|
// load old profile or POST values if needed
|
||||||
$old_options = array();
|
$old_options = array();
|
||||||
if (isset($_POST['save'])) {
|
if (isset($_POST['save'])) {
|
||||||
$postKeys = array_keys($_POST);
|
foreach ($_POST as $key => $value) {
|
||||||
for ($i = 0; $i < sizeof($postKeys); $i++) {
|
if (!is_array($value)) {
|
||||||
if (!is_array($_POST[$postKeys[$i]])) {
|
$old_options[$key] = array($value);
|
||||||
$old_options[$postKeys[$i]] = array($_POST[$postKeys[$i]]);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$old_options[$postKeys[$i]] = $_POST[$postKeys[$i]];
|
$old_options[$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,19 +222,20 @@ $container->addElement(new htmlSpacer(null, '15px'), true);
|
||||||
$_SESSION['profile_types'] = parseHtml(null, $container, $old_options, false, $tabindex, $type->getScope());
|
$_SESSION['profile_types'] = parseHtml(null, $container, $old_options, false, $tabindex, $type->getScope());
|
||||||
|
|
||||||
// display module options
|
// display module options
|
||||||
$modules = array_keys($options);
|
foreach ($options as $moduleName => $moduleOptions) {
|
||||||
for ($m = 0; $m < sizeof($modules); $m++) {
|
|
||||||
// ignore modules without options
|
// ignore modules without options
|
||||||
if (sizeof($options[$modules[$m]]) < 1) continue;
|
if (sizeof($moduleOptions) < 1) {
|
||||||
$module = new $modules[$m]($type->getScope());
|
continue;
|
||||||
|
}
|
||||||
|
$module = new $moduleName($type->getScope());
|
||||||
$icon = $module->getIcon();
|
$icon = $module->getIcon();
|
||||||
if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
|
if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
|
||||||
$icon = '../../graphics/' . $icon;
|
$icon = '../../graphics/' . $icon;
|
||||||
}
|
}
|
||||||
$container = new htmlTable();
|
$container = new htmlTable();
|
||||||
$container->addElement(new htmlFieldset($options[$modules[$m]], getModuleAlias($modules[$m], $type->getScope()), $icon), true);
|
$container->addElement(new htmlFieldset($moduleOptions, getModuleAlias($moduleName, $type->getScope()), $icon), true);
|
||||||
$container->addElement(new htmlSpacer(null, '15px'), true);
|
$container->addElement(new htmlSpacer(null, '15px'), true);
|
||||||
$_SESSION['profile_types'] = array_merge($_SESSION['profile_types'], parseHtml($modules[$m], $container, $old_options, false, $tabindex, $type->getScope()));
|
$_SESSION['profile_types'] = array_merge($_SESSION['profile_types'], parseHtml($moduleName, $container, $old_options, false, $tabindex, $type->getScope()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// profile name and submit/abort buttons
|
// profile name and submit/abort buttons
|
||||||
|
|
Loading…
Reference in New Issue