new type API
This commit is contained in:
parent
953ea96aa0
commit
ef1eec558a
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
use LAM\TYPES\ConfiguredType;
|
use LAM\TYPES\ConfiguredType;
|
||||||
|
use \LAM\TYPES\TypeManager;
|
||||||
/*
|
/*
|
||||||
$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 - 2016 Roland Gruber
|
Copyright (C) 2003 - 2017 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
|
||||||
|
@ -306,14 +306,16 @@ function getAvailableModules($scope, $mustSupportAdminInterface = false) {
|
||||||
/**
|
/**
|
||||||
* Returns the elements for the profile page.
|
* Returns the elements for the profile page.
|
||||||
*
|
*
|
||||||
* @param string $scope account type (user, group, host)
|
* @param string $typeId account type (user, group, host)
|
||||||
* @return array profile elements
|
* @return array profile elements
|
||||||
*/
|
*/
|
||||||
function getProfileOptions($scope) {
|
function getProfileOptions($typeId) {
|
||||||
$mods = $_SESSION['config']->get_AccountModules($scope);
|
$typeManager = new TypeManager();
|
||||||
|
$type = $typeManager->getConfiguredType($typeId);
|
||||||
|
$mods = $type->getModules();
|
||||||
$return = array();
|
$return = array();
|
||||||
for ($i = 0; $i < sizeof($mods); $i++) {
|
for ($i = 0; $i < sizeof($mods); $i++) {
|
||||||
$module = moduleCache::getModule($mods[$i], $scope);
|
$module = moduleCache::getModule($mods[$i], $type->getScope());
|
||||||
$return[$mods[$i]] = $module->get_profileOptions();
|
$return[$mods[$i]] = $module->get_profileOptions();
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
|
|
|
@ -239,7 +239,7 @@ $modules = array_keys($options);
|
||||||
for ($m = 0; $m < sizeof($modules); $m++) {
|
for ($m = 0; $m < sizeof($modules); $m++) {
|
||||||
// ignore modules without options
|
// ignore modules without options
|
||||||
if (sizeof($options[$modules[$m]]) < 1) continue;
|
if (sizeof($options[$modules[$m]]) < 1) continue;
|
||||||
$module = new $modules[$m]($type->getId());
|
$module = new $modules[$m]($type->getScope());
|
||||||
$icon = $module->getIcon();
|
$icon = $module->getIcon();
|
||||||
if (($icon != null) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
|
if (($icon != null) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
|
||||||
$icon = '../../graphics/' . $icon;
|
$icon = '../../graphics/' . $icon;
|
||||||
|
|
Loading…
Reference in New Issue