From baa85365605ef800e99c86d93202c29cf915b2e4 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 12 Mar 2017 12:12:11 +0100 Subject: [PATCH] new method to get modules of a type --- lam/lib/types.inc | 13 ++++++++++++- lam/templates/config/confmodules.php | 7 ++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lam/lib/types.inc b/lam/lib/types.inc index 8a8b6551..b14f176b 100644 --- a/lam/lib/types.inc +++ b/lam/lib/types.inc @@ -4,7 +4,7 @@ namespace LAM\TYPES; $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2005 - 2016 Roland Gruber + Copyright (C) 2005 - 2017 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 @@ -339,6 +339,17 @@ class ConfiguredType { return $ret; } + /** + * Returns the names of the active modules for this type. + * + * @return string[] module names + */ + public function getModules() { + $typeSettings = $this->typeManager->getConfig()->get_typeSettings(); + $modules = !empty($typeSettings['modules_' . $this->getId()]) ? $typeSettings['modules_' . $this->getId()] : ''; + return explode(',', $modules); + } + } /** diff --git a/lam/templates/config/confmodules.php b/lam/templates/config/confmodules.php index 28980af3..0f2284c9 100644 --- a/lam/templates/config/confmodules.php +++ b/lam/templates/config/confmodules.php @@ -15,7 +15,7 @@ use \htmlDiv; $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2004 - 2016 Roland Gruber + Copyright (C) 2004 - 2017 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 @@ -272,12 +272,9 @@ echo "\n"; * @param htmlTable $container meta HTML container */ function config_showAccountModules($type, &$container) { - $conf = &$_SESSION['conf_config']; - $typeSettings = $conf->get_typeSettings(); // account modules $available = getAvailableModules($type->getScope(), true); - $selected = !empty($typeSettings['modules_' . $type->getId()]) ? $typeSettings['modules_' . $type->getId()] : ''; - $selected = explode(',', $selected); + $selected = $type->getModules(); $sortedAvailable = array(); for ($i = 0; $i < sizeof($available); $i++) { $sortedAvailable[$available[$i]] = getModuleAlias($available[$i], $type->getScope());